Skip to content

ICE: nested return types  #116383

Closed
Closed
@matthiaskrgr

Description

Code

-Zvalidate-mir
reduced from #107346

trait Duh {}

impl Duh for i32 {}

trait Trait {
    type Assoc: Duh;
}

impl<R: Duh, F: FnMut() -> R> Trait for F {
    type Assoc = R;
}

fn foo() -> impl Trait<Assoc = impl Send> {
    || 42
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.75.0-nightly (eb0f3ed59 2023-10-03)
binary: rustc
commit-hash: eb0f3ed59c6508a37c6598bc9762987f053993a7
commit-date: 2023-10-03
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.2

Error output

<output>
Backtrace

warning: function `foo` is never used
  --> 107346.rs:18:4
   |
18 | fn foo() -> impl Trait<Assoc = impl Send> {
   |    ^^^
   |
   = note: `#[warn(dead_code)]` on by default

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (after pass Subtyper) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (before pass CleanupPostBorrowck) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (after pass CleanupPostBorrowck) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (before pass RemoveNoopLandingPads) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (after pass RemoveNoopLandingPads) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (before pass SimplifyCfg-early-opt) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (after pass SimplifyCfg-early-opt) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (before pass Derefer) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (after pass Derefer) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes_inner
         6: rustc_mir_transform::run_analysis_to_runtime_passes
         7: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         8: 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]>>
         9: 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>
        10: rustc_query_impl::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::analysis
        12: 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]>>
        13: 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>
        14: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        15: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        16: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        19: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        20: <unknown>
        21: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

error: internal compiler error: broken MIR in Item(DefId(0:11 ~ 107346[3e7c]::foo)) (after phase change to analysis-post-cleanup) at bb0[1]:
                                Failed subtyping Alias(
                                    Opaque,
                                    AliasTy {
                                        args: [
                                        ],
                                        def_id: DefId(0:14 ~ 107346[3e7c]::foo::{opaque#0}),
                                    },
                                ) and Closure(
                                    DefId(0:12 ~ 107346[3e7c]::foo::{closure#0}),
                                    [
                                    i8,
                                    Binder(extern "RustCall" fn(()) -> i32, []),
                                    (),
                                    ],
                                )
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^
   |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:96:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::run_passes_inner
         5: rustc_mir_transform::run_analysis_to_runtime_passes
         6: rustc_mir_transform::mir_drops_elaborated_and_const_checked
         7: 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]>>
         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_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
        10: rustc_interface::passes::analysis
        11: 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]>>
        12: 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>
        13: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        14: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        15: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{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}
        16: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        17: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/alloc/src/boxed.rs:2007:9
        18: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/eb0f3ed59c6508a37c6598bc9762987f053993a7/library/std/src/sys/unix/thread.rs:108:17
        19: <unknown>
        20: <unknown>
  --> 107346.rs:19:5
   |
19 |     || 42
   |     ^^^^^

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 attach the file at `/tmp/im/rustc-ice-2023-10-03T13:49:46.115359487Z-2977928.txt` to your bug report

note: compiler flags: -Z validate-mir

query stack during panic:
end of query stack
error: aborting due to 11 previous errors; 1 warning emitted

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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