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

ICE: broken mir with temporary lifetime extention #123810

Open
matthiaskrgr opened this issue Apr 11, 2024 · 2 comments
Open

ICE: broken mir with temporary lifetime extention #123810

matthiaskrgr opened this issue Apr 11, 2024 · 2 comments
Assignees
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Apr 11, 2024

auto-reduced (treereduce-rust):

fn temp() -> (String, i32) {
    (String::from("Hello"), 1)
}

fn main() {
    let f = if true { &temp() } else { &temp() };
}

original:

//@ check-pass

fn temp() -> (String, i32) {
    (String::from("Hello"), 1)
}

fn main() {
    let a = &temp();
    let b = [(&temp(),)];
    let c = &temp().0;
    let d = &temp().0[..];
    let e = {
        let _ = 123;
        &(*temp().0)[..]
    };
    let f = if true {
        &temp()
    } else {
        &temp()
    };
    let g = match true {
        true => &temp(),
        false => {
            let _ = 123;
            &temp()
        }
    };
    let h = match temp() {
        // The {} moves the value, making a new temporary.
        owned_non_temporary => &{ owned_non_temporary },
    };
    println!("{a:?} {b:?} {c:?} {d:?} {e:?} {f:?} {g:?} {h:?}");
}

Version information

rustc 1.79.0-nightly (72fe8a0f0 2024-04-11)
binary: rustc
commit-hash: 72fe8a0f0049873f4b1d0ab3c482170921819106
commit-date: 2024-04-11
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.3

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zlint-mir

Program output (trimmed)

warning: unused variable: `f`
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:6:9
  |
6 |     let f = if true { &temp() } else { &temp() };
  |         ^ help: if this is intentional, prefix it with an underscore: `_f`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[22c9]::main)) (after pass CheckPackedRef) at bb6[3]:
                                use of local _5, which has no storage here
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:75:22
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String>
         4: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local
         5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place
         6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator
         7: rustc_mir_transform::lint::lint_body
         8: rustc_mir_transform::pass_manager::run_passes_inner
         9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        11: rustc_query_impl::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
        12: rustc_mir_build::check_unsafety::check_unsafety
        13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        15: rustc_query_impl::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
        16: rustc_interface::passes::analysis
        17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        19: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        20: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        21: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        22: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        25: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/std/src/sys/pal/unix/thread.rs:108:17
        26: <unknown>
        27: <unknown>
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[22c9]::main)) (after pass CheckPackedRef) at bb9[0]:
                                use of local _3, which has no storage here
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:75:22
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String>
         4: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local
         5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place
         6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator
         7: rustc_mir_transform::lint::lint_body
         8: rustc_mir_transform::pass_manager::run_passes_inner
         9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        11: rustc_query_impl::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
        12: rustc_mir_build::check_unsafety::check_unsafety
        13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_unsafety::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
        14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        15: rustc_query_impl::query_impl::check_unsafety::get_query_non_incr::__rust_end_short_backtrace
        16: rustc_interface::passes::analysis
        17: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        19: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        20: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        21: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        22: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        24: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        25: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/std/src/sys/pal/unix/thread.rs:108:17
        26: <unknown>
        27: <unknown>
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[22c9]::main)) (after phase change to runtime-post-cleanup) at bb9[0]:
                                use of local _5, which has no storage here
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:75:22
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String>
         4: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local
         5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place
         6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator
         7: rustc_mir_transform::lint::lint_body
         8: rustc_mir_transform::pass_manager::run_passes_inner
         9: rustc_mir_transform::mir_drops_elaborated_and_const_checked
        10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        12: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        13: rustc_interface::passes::analysis
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        16: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        17: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        18: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        19: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        22: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/std/src/sys/pal/unix/thread.rs:108:17
        23: <unknown>
        24: <unknown>
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[22c9]::main)) (after phase change to runtime-post-cleanup) at bb11[0]:
                                use of local _3, which has no storage here
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:75:22
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String>
         4: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local
         5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place
         6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator
         7: rustc_mir_transform::lint::lint_body
         8: rustc_mir_transform::pass_manager::run_passes_inner
         9: rustc_mir_transform::mir_drops_elaborated_and_const_checked
        10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        12: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        13: rustc_interface::passes::analysis
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        16: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        17: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        18: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        19: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        22: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/std/src/sys/pal/unix/thread.rs:108:17
        23: <unknown>
        24: <unknown>
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[22c9]::main)) (after phase change to runtime-post-cleanup) at bb10[0]:
                                use of local _3, which has no storage here
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:75:22
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_mir_transform::lint::Lint>::fail::<alloc::string::String>
         4: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_local
         5: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_place
         6: <rustc_mir_transform::lint::Lint as rustc_middle::mir::visit::Visitor>::visit_terminator
         7: rustc_mir_transform::lint::lint_body
         8: rustc_mir_transform::pass_manager::run_passes_inner
         9: rustc_mir_transform::mir_drops_elaborated_and_const_checked
        10: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        12: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        13: rustc_interface::passes::analysis
        14: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        16: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        17: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        18: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        19: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/alloc/src/boxed.rs:2018:9
        22: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/72fe8a0f0049873f4b1d0ab3c482170921819106/library/std/src/sys/pal/unix/thread.rs:108:17
        23: <unknown>
        24: <unknown>
 --> /tmp/icemaker_global_tempdir.1uGEfYPHYLhA/rustc_testrunner_tmpdir_reporting.t0U8tjAY2duj/mvce.rs:7:1
  |
7 | }
  | ^

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.79.0-nightly (72fe8a0f0 2024-04-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z lint-mir -Z dump-mir-dir=dir

query stack during panic:
end of query stack

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Apr 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 11, 2024
@compiler-errors
Copy link
Member

compiler-errors commented Apr 11, 2024

This is due to #121346

opened a thread: Broken MIR

@dingxiangfei2009
Copy link
Contributor

@rustbot claim

@jieyouxu jieyouxu added A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 15, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants