-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[ICE]: Both stable and nightly crash at compiler/rustc_const_eval/src/interpret/operand.rs:84:42
on the invalid code under opt-level=3
#135128
Comments
compiler/rustc_const_eval/src/interpret/operand.rs:84:42
on the invalid code under opt-level=3
compiler/rustc_const_eval/src/interpret/operand.rs:84:42
on the invalid code under opt-level=3compiler/rustc_const_eval/src/interpret/operand.rs:84:42
on the invalid code under opt-level=3
compiler/rustc_const_eval/src/interpret/operand.rs:84:42
on the invalid code under opt-level=3
compiler/rustc_const_eval/src/interpret/operand.rs:84:42
on the invalid code under opt-level=3
@wangbo15 are these ICEs fuzzer-generated? |
👨 🦋 Is this minimized? |
@jieyouxu Yes, I apologize for trying to minimize it, but it is still oversized. |
Please refer to fuzzing guidelines, in particular please disclose that the ICE is generated through fuzzing. |
Also, |
@jieyouxu Thanks. I would minimize it and commit it later. |
Curious to see if this will turn out to be a duplicate of #121363 |
Bisection script: #!/usr/bin/env bash
RUSTC_ICE=0 rustc -Copt=level=1 issue-135128.rs
test ${PIPESTATUS[0]} -eq 101 bisected with
|
This example has a bunch of unrelated errors that makes it very hard to tell, but maybe #120847 exposes stuff that const-eval doesn't handle? Will need a minimization to have any clear ideas anyway. |
@jieyouxu Here is a shorten version: pub trait Foo { |
MCVE (I confirm this preserves the bisection range locally) async fn return_str() -> str
where
str: Sized,
{
*"Sized".to_string().into_boxed_str()
}
fn main() {} |
The shape looks similar but bisection range does not overlap. |
We have this code to replace all MIR of bodies with unsatisfiable trait clauses (like rust/compiler/rustc_mir_transform/src/lib.rs Lines 503 to 545 in dcfa38f
This is done to avoid ICEs from trying to evaluate the MIR in the of bodies unsatisfiable predicates, but the code currently only checks the own predicates of the MIR body owner itself and not at the predicates of it's parent. So for an fn return_str() -> impl core::future::Future<Output = str>
where
str: Sized,
{ // the body of this function is replaced with `unreachable`
async { // but not the body of this coroutine!
*"Sized".to_string().into_boxed_str()
}
} #121363 does indeed look very similar, there we also have MIR body (the struct TwoStrs(str, str) where str: Sized;
impl ::core::fmt::Debug for TwoStrs where str: Sized {
// ^^^^^^^^^^^^^^^^ unsatisfiable parent predicate
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { // < optimizing this body's MIR ICEs
::core::fmt::Formatter::debug_tuple_field2_finish(f, "TwoStrs",
&self.0, &&self.1)
}
} |
Code
Affected release channels
Rust Version
Current error output
Backtrace
Anything else?
Note that the bug can only be reproduced by
rustc -C opt-level=3 --edition=2021 1.rs
.If we remove
-C opt-level=3
, the ICE disappears.The text was updated successfully, but these errors were encountered: