Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #114637

Merged
merged 24 commits into from
Aug 9, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2d213f7
Make ExitStatus an inhabited type on all platforms
ijackson Jan 3, 2023
23a5c0a
Mention style for new syntax in tracking issue template
compiler-errors Jul 11, 2023
72dd53c
add aarch64-unknown-teeos target
Sword-Destiny Jul 7, 2023
1f1d49a
impl Default for ExitStatus
ijackson Jan 3, 2023
f837c48
CFI: Fix error compiling core with LLVM CFI enabled
rcvalle Jul 11, 2023
a7132bf
interpret: remove incomplete protection against invalid where clauses
RalfJung Aug 8, 2023
da00356
prevent constant rebuilds of rustc-main (and thus everything else)
pietroalbini Aug 8, 2023
bcf7bfc
remove llvm-wrapper include to silence deprecation warning
lqd Aug 8, 2023
15d408c
Allow reimplementation of drops_elaborated query
cedihegi Aug 8, 2023
ff574b7
tests: Uncomment now valid GAT code behind FIXME
Enselic Aug 6, 2023
0166092
Added comment on reason for method being public
cedihegi Aug 8, 2023
95d1f6b
add test from chalk#788 for new solver
lcnr Aug 8, 2023
381ef83
Migrate GUI colors test to original CSS color format
GuillaumeGomez Aug 8, 2023
b355089
Rollup merge of #106425 - ijackson:exit-status-default, r=dtolnay
matthiaskrgr Aug 8, 2023
0887636
Rollup merge of #113480 - Sword-Destiny:master, r=petrochenkov
matthiaskrgr Aug 8, 2023
095619a
Rollup merge of #113586 - compiler-errors:style, r=joshtriplett
matthiaskrgr Aug 8, 2023
c097e48
Rollup merge of #113593 - rcvalle:rust-cfi-fix-90546, r=wesleywiser
matthiaskrgr Aug 8, 2023
54a9c2c
Rollup merge of #114612 - lqd:east-17-warning, r=nikic
matthiaskrgr Aug 8, 2023
4f82fb8
Rollup merge of #114613 - ferrocene:pa-fix-rebuild, r=lqd
matthiaskrgr Aug 8, 2023
5c5ae6c
Rollup merge of #114615 - RalfJung:interpret-invalid-where, r=lcnr
matthiaskrgr Aug 8, 2023
acf3791
Rollup merge of #114628 - cedihegi:master, r=oli-obk
matthiaskrgr Aug 8, 2023
61d7a4b
Rollup merge of #114629 - Enselic:uncomment-gat-code, r=compiler-errors
matthiaskrgr Aug 8, 2023
c84732c
Rollup merge of #114630 - GuillaumeGomez:migrate-gui-test-color-30, r…
matthiaskrgr Aug 8, 2023
a5e91ed
Rollup merge of #114631 - lcnr:chalk-cycle-test, r=compiler-errors
matthiaskrgr Aug 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
interpret: remove incomplete protection against invalid where clauses
  • Loading branch information
RalfJung committed Aug 8, 2023
commit a7132bf3873d63d3534c28dc7be85c5b363395f6
2 changes: 0 additions & 2 deletions compiler/rustc_const_eval/messages.ftl
Original file line number Diff line number Diff line change
@@ -303,8 +303,6 @@ const_eval_remainder_overflow =
overflow in signed remainder (dividing MIN by -1)
const_eval_scalar_size_mismatch =
scalar size mismatch: expected {$target_size} bytes but got {$data_size} bytes instead
const_eval_size_of_unsized =
size_of called on unsized type `{$ty}`
const_eval_size_overflow =
overflow computing total size of `{$name}`

4 changes: 0 additions & 4 deletions compiler/rustc_const_eval/src/errors.rs
Original file line number Diff line number Diff line change
@@ -862,7 +862,6 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
InvalidProgramInfo::FnAbiAdjustForForeignAbi(_) => {
rustc_middle::error::middle_adjust_for_foreign_abi_error
}
InvalidProgramInfo::SizeOfUnsizedType(_) => const_eval_size_of_unsized,
InvalidProgramInfo::ConstPropNonsense => {
panic!("We had const-prop nonsense, this should never be printed")
}
@@ -890,9 +889,6 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
builder.set_arg("arch", arch);
builder.set_arg("abi", abi.name());
}
InvalidProgramInfo::SizeOfUnsizedType(ty) => {
builder.set_arg("ty", ty);
}
}
}
}
7 changes: 2 additions & 5 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
@@ -269,13 +269,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
let ty = self.subst_from_current_frame_and_normalize_erasing_regions(ty)?;
let layout = self.layout_of(ty)?;
if let mir::NullOp::SizeOf | mir::NullOp::AlignOf = null_op && layout.is_unsized() {
// FIXME: This should be a span_bug, but const generics can run MIR
// that is not properly type-checked yet (#97477).
self.tcx.sess.delay_span_bug(
span_bug!(
self.frame().current_span(),
format!("{null_op:?} MIR operator called for unsized type {ty}"),
"{null_op:?} MIR operator called for unsized type {ty}",
);
throw_inval!(SizeOfUnsizedType(ty));
}
let val = match null_op {
mir::NullOp::SizeOf => layout.size.bytes(),
2 changes: 0 additions & 2 deletions compiler/rustc_middle/src/mir/interpret/error.rs
Original file line number Diff line number Diff line change
@@ -184,8 +184,6 @@ pub enum InvalidProgramInfo<'tcx> {
/// (which unfortunately typeck does not reject).
/// Not using `FnAbiError` as that contains a nested `LayoutError`.
FnAbiAdjustForForeignAbi(call::AdjustForForeignAbiError),
/// SizeOf of unsized type was requested.
SizeOfUnsizedType(Ty<'tcx>),
/// We are runnning into a nonsense situation due to ConstProp violating our invariants.
ConstPropNonsense,
}
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
@@ -1645,7 +1645,7 @@ impl<'test> TestCx<'test> {
if self.props.known_bug {
if !expected_errors.is_empty() {
self.fatal_proc_rec(
"`known_bug` tests should not have an expected errors",
"`known_bug` tests should not have an expected error",
proc_res,
);
}
8 changes: 6 additions & 2 deletions tests/ui/const-generics/generic_const_exprs/issue-80742.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// check-fail
// known-bug: #97477
// failure-status: 101
// normalize-stderr-test "note: .*\n\n" -> ""
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
// rustc-env:RUST_BACKTRACE=0

// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place

@@ -27,6 +32,5 @@ where
}

fn main() {
let dst = Inline::<dyn Debug>::new(0); //~ ERROR
//~^ ERROR
let dst = Inline::<dyn Debug>::new(0);
}
75 changes: 7 additions & 68 deletions tests/ui/const-generics/generic_const_exprs/issue-80742.stderr
Original file line number Diff line number Diff line change
@@ -1,71 +1,10 @@
error[E0080]: evaluation of `Inline::<dyn Debug>::{constant#0}` failed
error: internal compiler error: compiler/rustc_const_eval/src/interpret/step.rs:272:21: SizeOf MIR operator called for unsized type dyn Debug
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
= note: size_of called on unsized type `dyn Debug`
|
note: inside `std::mem::size_of::<dyn Debug>`
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
note: inside `Inline::<dyn Debug>::{constant#0}`
--> $DIR/issue-80742.rs:22:10
|
LL | [u8; size_of::<T>() + 1]: ,
| ^^^^^^^^^^^^^^

error[E0599]: the function or associated item `new` exists for struct `Inline<dyn Debug>`, but its trait bounds were not satisfied
--> $DIR/issue-80742.rs:30:36
|
LL | struct Inline<T>
| ---------------- function or associated item `new` not found for this struct
...
LL | let dst = Inline::<dyn Debug>::new(0);
| ^^^ function or associated item cannot be called on `Inline<dyn Debug>` due to unsatisfied trait bounds
--> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
|
= note: doesn't satisfy `dyn Debug: Sized`
|
note: trait bound `dyn Debug: Sized` was not satisfied
--> $DIR/issue-80742.rs:20:6
|
LL | impl<T> Inline<T>
| ^ ---------
| |
| unsatisfied trait bound introduced here
help: consider relaxing the type parameter's implicit `Sized` bound
|
LL | impl<T: ?Sized> Inline<T>
| ++++++++

error[E0080]: evaluation of `Inline::<dyn Debug>::{constant#0}` failed
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
= note: size_of called on unsized type `dyn Debug`
|
note: inside `std::mem::size_of::<dyn Debug>`
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
note: inside `Inline::<dyn Debug>::{constant#0}`
--> $DIR/issue-80742.rs:14:10
|
LL | [u8; size_of::<T>() + 1]: ,
| ^^^^^^^^^^^^^^

error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time
--> $DIR/issue-80742.rs:30:15
|
LL | let dst = Inline::<dyn Debug>::new(0);
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `dyn Debug`
note: required by a bound in `Inline`
--> $DIR/issue-80742.rs:12:15
|
LL | struct Inline<T>
| ^ required by this bound in `Inline`
help: consider relaxing the implicit `Sized` restriction
|
LL | struct Inline<T: ?Sized>
| ++++++++

error: aborting due to 4 previous errors
Box<dyn Any>
query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `<impl at $DIR/issue-80742.rs:25:1: 25:18>::{constant#0}`
#1 [eval_to_valtree] evaluating type-level constant
end of query stack
error: aborting due to previous error

Some errors have detailed explanations: E0080, E0277, E0599.
For more information about an error, try `rustc --explain E0080`.