Repository: rust
Issue: ICE: broken mir with temporary lifetime extention
Labels: I-ICE,T-compiler,A-MIR,C-bug,S-has-mcve,S-bug-has-test

<!--
[31mICE[0m: Rustc ./temporary-lifetime-extension.rs '-Zlint-mir -ooutputfile -Zdump-mir-dir=dir' 'error: internal compiler error: broken MIR in Item(DefId(0:4 ~ temporary_lifetime_extension[87f2]::main)) (after phase change to analysis-post-cleanup) at bb35[1]:', 'error: internal compiler error: broken MIR in Item(DefId(0:4 ~ temporary_lifetime_extension[87f2]::main)) (after phase change to analysis-post-cleanup) at bb35[1]:'
File: /tmp/im/temporary-lifetime-extension.rs
-->

auto-reduced (treereduce-rust):
````rust
fn temp() -> (String, i32) {
    (String::from("Hello"), 1)
}

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


````

original:
````rust
//@ 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`

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Program output (trimmed)</strong></summary>
<p>

```
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

```

</p>
</details>

<!--
query stack:

-->



<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"dingxiangfei2009"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->