Skip to content

ice: broken mir with never_patterns #120421

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(never_patterns)]

enum Void {}

fn main() {
    let res_void: Result<bool, Void> = Ok(true);

    for (Ok(mut _x) | Err(!)) in [res_void] {}
}

original:

// revisions: normal exh_pats
//[normal] check-pass
#![feature(never_patterns)]
#![allow(incomplete_features)]
#![cfg_attr(exh_pats, feature(exhaustive_patterns))]
#![allow(dead_code, unreachable_code)]
#![cfg_attr(exh_pats, feature(exhaustive_patterns))]

#[derive(Copy, Clone)]
enum Void {}

fn main() {
    let res_void: Result<bool, Void> = Ok(true);

    match res_void {
        Ok(_x) => {}
        Err(!),
        //[exh_pats]~^ ERROR unreachable
    }
    let (Ok(_x) | Err(!)) = res_void;
    //[exh_pats]~^ ERROR unreachable
    if let Err(!) = res_void {}
    //[exh_pats]~^ ERROR unreachable
    if let (Ok(true) | Err(!)) = res_void {}
    //[exh_pats]~^ ERROR unreachable
    for (Ok(mut _x) | Err(!)) in [res_void] {}
    //[exh_pats]~^ ERROR unreachable
}

fn foo((Ok(_x) | Err(!)): Result<bool, Void>) {}
//[exh_pats]~^ ERROR unreachable

Version information

rustc 1.77.0-nightly (8b6a431b3 2024-01-27)
binary: rustc
commit-hash: 8b6a431b3d3066a54dffc7f16bf658cf5690efc9
commit-date: 2024-01-27
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

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

Program output

warning: the feature `never_patterns` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:1:12
  |
1 | #![feature(never_patterns)]
  |            ^^^^^^^^^^^^^^
  |
  = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: unnecessary parentheses around pattern
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:8:9
  |
8 |     for (Ok(mut _x) | Err(!)) in [res_void] {}
  |         ^                   ^
  |
  = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
  |
8 -     for (Ok(mut _x) | Err(!)) in [res_void] {}
8 +     for Ok(mut _x) | Err(!) in [res_void] {}
  |

note: no errors encountered even though `span_delayed_bug` issued

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

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[fcbc]::main)) (after pass CheckPackedRef) at bb14[0]:
                                StorageLive(_14) which already has storage here
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:8:13
  |
8 |     for (Ok(mut _x) | Err(!)) in [res_void] {}
  |             ^^^^^^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:97:26
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic_builder::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_statement
         5: rustc_mir_transform::lint::lint_body
         6: rustc_mir_transform::mir_const
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         8: 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>
         9: rustc_query_impl::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
        10: rustc_mir_transform::mir_promoted
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
        12: 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; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
        14: rustc_borrowck::mir_borrowck
        15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        16: 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>
        17: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
        18: rustc_interface::passes::analysis
        19: 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]>>
        20: 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>
        21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        22: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        23: 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>>
        24: <<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}
        25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        27: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/std/src/sys/pal/unix/thread.rs:108:17
        28: <unknown>
        29: <unknown>
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:8:13
  |
8 |     for (Ok(mut _x) | Err(!)) in [res_void] {}
  |             ^^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[fcbc]::main)) (after pass CheckPackedRef) at bb19[2]:
                                local _14 still has storage when returning from function
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:9:2
  |
9 | }
  |  ^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:116:34
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic_builder::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_terminator
         5: rustc_mir_transform::lint::lint_body
         6: rustc_mir_transform::mir_const
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         8: 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>
         9: rustc_query_impl::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
        10: rustc_mir_transform::mir_promoted
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
        12: 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; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
        14: rustc_borrowck::mir_borrowck
        15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        16: 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>
        17: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
        18: rustc_interface::passes::analysis
        19: 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]>>
        20: 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>
        21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        22: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        23: 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>>
        24: <<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}
        25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        27: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/std/src/sys/pal/unix/thread.rs:108:17
        28: <unknown>
        29: <unknown>
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:9:2
  |
9 | }
  |  ^

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[fcbc]::main)) (after pass CheckConstItemMutation) at bb14[0]:
                                StorageLive(_14) which already has storage here
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:8:13
  |
8 |     for (Ok(mut _x) | Err(!)) in [res_void] {}
  |             ^^^^^^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:97:26
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic_builder::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_statement
         5: rustc_mir_transform::lint::lint_body
         6: rustc_mir_transform::mir_const
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         8: 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>
         9: rustc_query_impl::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
        10: rustc_mir_transform::mir_promoted
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
        12: 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; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
        14: rustc_borrowck::mir_borrowck
        15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        16: 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>
        17: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
        18: rustc_interface::passes::analysis
        19: 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]>>
        20: 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>
        21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        22: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        23: 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>>
        24: <<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}
        25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        27: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/std/src/sys/pal/unix/thread.rs:108:17
        28: <unknown>
        29: <unknown>
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:8:13
  |
8 |     for (Ok(mut _x) | Err(!)) in [res_void] {}
  |             ^^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[fcbc]::main)) (after pass CheckConstItemMutation) at bb19[2]:
                                local _14 still has storage when returning from function
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:9:2
  |
9 | }
  |  ^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:116:34
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic_builder::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_terminator
         5: rustc_mir_transform::lint::lint_body
         6: rustc_mir_transform::mir_const
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         8: 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>
         9: rustc_query_impl::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
        10: rustc_mir_transform::mir_promoted
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
        12: 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; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
        14: rustc_borrowck::mir_borrowck
        15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        16: 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>
        17: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
        18: rustc_interface::passes::analysis
        19: 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]>>
        20: 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>
        21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        22: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        23: 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>>
        24: <<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}
        25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        27: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/std/src/sys/pal/unix/thread.rs:108:17
        28: <unknown>
        29: <unknown>
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:9:2
  |
9 | }
  |  ^

error: internal compiler error: broken MIR in Item(DefId(0:4 ~ mvce[fcbc]::main)) (after pass FunctionItemReferences) at bb14[0]:
                                StorageLive(_14) which already has storage here
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:8:13
  |
8 |     for (Ok(mut _x) | Err(!)) in [res_void] {}
  |             ^^^^^^
  |
note: delayed at compiler/rustc_mir_transform/src/lint.rs:97:26
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxt>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic_builder::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_statement
         5: rustc_mir_transform::lint::lint_body
         6: rustc_mir_transform::mir_const
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         8: 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>
         9: rustc_query_impl::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
        10: rustc_mir_transform::mir_promoted
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
        12: 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; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
        14: rustc_borrowck::mir_borrowck
        15: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        16: 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>
        17: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
        18: rustc_interface::passes::analysis
        19: 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]>>
        20: 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>
        21: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        22: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}
        23: 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>>
        24: <<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}
        25: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        26: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/alloc/src/boxed.rs:2015:9
        27: std::sys::pal::unix::thread::Thread::new::thread_start
                   at /rustc/8b6a431b3d3066a54dffc7f16bf658cf5690efc9/library/std/src/sys/pal/unix/thread.rs:108:17
        28: <unknown>
        29: <unknown>
 --> /tmp/icemaker_global_tempdir.DcgwEtL6OYqo/rustc_testrunner_tmpdir_reporting.TtsI0a2Vt7Zf/mvce.rs:8:13
  |
8 |     for (Ok(mut _x) | Err(!)) in [res_void] {}
  |             ^^^^^^

<snip>

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: rustc 1.77.0-nightly (8b6a431b3 2024-01-27) 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
error: aborting due to 54 previous errors; 2 warnings emitted


Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-bugCategory: This is a bug.F-never_patterns`#![feature(never_patterns)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions