-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: broken mir while building rustc #114375
Comments
You can also reproduce this in the rustc repo itself where
will encounter the error with |
Reduced: // crate foo
#![feature(type_alias_impl_trait)]
type Tait = impl Sized;
fn _constrain() -> Tait {}
struct WrapperWithDrop<T>(T);
impl<T> Drop for WrapperWithDrop<T> {
fn drop(&mut self) {}
}
pub struct Foo(WrapperWithDrop<Tait>); // crate bar
pub fn drop_foo(_: foo::Foo) {} cargo rustc -p bar -- -Z validate-mir @rustbot label F-type_alias_impl_trait |
Found another repro I think: use std::backtrace::Backtrace;
const _: fn() = || {
let backtrace: Backtrace = Backtrace::capture();
}; this one bisects to #109075 |
pub fn foo() {
std::backtrace::Backtrace::force_capture();
} |
@rustbot prioritize |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
Ok, after a bit more back ond forth on Zulip, I'm tentatively bumping this issue to P-critical and raise these questions (echoing the comments from the discussion):
Next week Rust 1.72 will be released, artifacts are going to be build real soon, I think. Thanks for additional comments to help improve my understanding of the context here. @rustbot label -P-medium +P-critical |
The underlying issue here is an issue with TAIT. #109075 was an implementation-only change simplifying some backtrace code in I have no compiler experience, but my initial hunch would be that the library change is preferable for now. I'll get a PR ready until tomorrow, unless someone beats me to it. |
#112777 should not be reverted. All it does is cause us to now eagerly reveal opaques that were being skipped over during normalization, which means that we're just not hitting this code anymore: rust/compiler/rustc_const_eval/src/transform/validate.rs Lines 539 to 541 in ee5cb9e
It does not introduce a bug, it just reveals one that already existed. I'm gonna use the minimized example (#114375 (comment)) here. What's happening here is that we're generating a drop shim for
which then tries to validate that Before #112777, we'd emit something that looks like:
which is a field that is incompletely normalized, but does hit the |
#115005 fixes this issue by not considering mir validity on shims until they have been optimized, which uses the reveal-all param-env for that shim. This ICE shouldn't be possible to trigger without rust/compiler/rustc_mir_transform/src/pass_manager.rs Lines 120 to 122 in 6ef7d16
I don't personally think that #114988 needs to be reverted, either. |
Don't do intra-pass validation on MIR shims Fixes rust-lang#114375 In the test that was committed, we end up generating the drop shim for `struct Foo` that looks like: ``` fn std::ptr::drop_in_place(_1: *mut Foo) -> () { let mut _0: (); bb0: { goto -> bb5; } bb1: { return; } bb2 (cleanup): { resume; } bb3: { goto -> bb1; } bb4 (cleanup): { drop(((*_1).0: foo::WrapperWithDrop<()>)) -> [return: bb2, unwind terminate]; } bb5: { drop(((*_1).0: foo::WrapperWithDrop<()>)) -> [return: bb3, unwind: bb2]; } } ``` In `bb4` and `bb5`, we assert that `(*_1).0` has type `WrapperWithDrop<()>`. However, In a user-facing param env, the type is actually `WrapperWithDrop<Tait>`. These types are not equal in a user-facing param-env (and can't be made equal even if we use `DefiningAnchor::Bubble`, since it's a non-local TAIT).
Code
rustc -Zvalidate-mir file.rs
Meta
rustc --version --verbose
:Error output
Not posting the entire 1.7K lines backtrace 🙃
Backtrace
The text was updated successfully, but these errors were encountered: