Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ICE]: broken mir, -Zvalidate-mir #107346

Closed
4 tasks
matthiaskrgr opened this issue Jan 27, 2023 · 8 comments · Fixed by #107888
Closed
4 tasks

[ICE]: broken mir, -Zvalidate-mir #107346

matthiaskrgr opened this issue Jan 27, 2023 · 8 comments · Fixed by #107888
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

// ./tests/ui/impl-trait/nested-return-type2.rs

// check-pass

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() {
}

Affected release channels

  • Previous Stable
  • Current Stable
  • Current Beta
  • Current Nightly

Rust Version

rustc 1.69.0-nightly (d7948c843 2023-01-26)
binary: rustc
commit-hash: d7948c843de94245c794e8c63dd4301a78bb5ba3
commit-date: 2023-01-26
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Current error output

--> ./tests/ui/impl-trait/nested-return-type2.rs:16:4
   |
16 | fn foo() -> impl Trait<Assoc = impl Send> {
   |    ^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: opaque type `impl Trait<Assoc = impl Send>` does not satisfy its associated type bounds
  --> ./tests/ui/impl-trait/nested-return-type2.rs:16:24
   |
8  |     type Assoc: Duh;
   |                 --- this associated type bound is unsatisfied for `impl Send`
...
16 | fn foo() -> impl Trait<Assoc = impl Send> {
   |                        ^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(opaque_hidden_inferred_bound)]` on by default
help: add this bound
   |
16 | fn foo() -> impl Trait<Assoc = impl Send + Duh> {
   |                                          +++++

Backtrace

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

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (before pass CheckPackedRef) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (after pass CheckPackedRef) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (before pass CheckConstItemMutation) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (after pass CheckConstItemMutation) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (before pass FunctionItemReferences) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (after pass FunctionItemReferences) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (before pass SimplifyCfg-initial) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (after pass SimplifyCfg-initial) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (before pass SanityCheck) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (after pass SanityCheck) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
  --> ./tests/ui/impl-trait/nested-return-type2.rs:17:5
   |
17 |     || 42
   |     ^^^^^
   |
   = note: delayed at    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::TypeChecker>::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::mir_const
              6: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
              7: rustc_mir_transform::mir_promoted
              8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
              9: rustc_borrowck::mir_borrowck
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             11: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
             12: rustc_hir_analysis::collect::type_of::type_of
             13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
             14: rustc_hir_analysis::check::check::check_mod_item_types
             15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_item_types
             17: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             18: rustc_hir_analysis::check_crate
             19: rustc_interface::passes::analysis
             20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
             22: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             23: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
             24: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             25: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
             26: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
             27: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             28: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/alloc/src/boxed.rs:1988:9
             29: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/d7948c843de94245c794e8c63dd4301a78bb5ba3/library/std/src/sys/unix/thread.rs:108:17
             30: <unknown>
             31: <unknown>


error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:11 ~ nested_return_type2[d0e8]::foo), const_param_did: None }) (before pass PromoteTemps) at bb0[0]:
                                encountered `Assign((_0, [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]))` with incompatible types:
                                left-hand side has type: impl Trait<Assoc = impl Send>
                                right-hand side has type: [closure@./tests/ui/impl-trait/nested-return-type2.rs:17:5: 17:7]
 <snip>
note: the compiler unexpectedly panicked. this is a bug.

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

note: rustc 1.69.0-nightly (d7948c843 2023-01-26) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z validate-mir

query stack during panic:
end of query stack
error: aborting due to 16 previous errors; 2 warnings emitted

Anything else?

No response

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue labels Jan 27, 2023
@matthiaskrgr
Copy link
Member Author

searched toolchains 95b61d1 through a2d002a


Regression in 40fda7b


@matthiaskrgr
Copy link
Member Author

I wonder if this is #107074 cc @lcnr ?

@lcnr lcnr added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Jan 27, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jan 27, 2023
@lcnr
Copy link
Contributor

lcnr commented Jan 27, 2023

very likely 🤔 will revert #107074 if we don't figure out how to fix this in the near future

@trinity-1686a
Copy link
Contributor

trinity-1686a commented Feb 8, 2023

I'm hitting a very similar issue, but without -Z validate-mir (only --crate-type rlib -C embed-bitcode=no -C debuginfo=2 which is provided by cargo)

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

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:2812 ~ combine[2263]::stream::{impl#47}::reset), const_param_did: None }) (after phase change to runtime-optimized) at bb0[3]:
                                encountered `Assign((_0, const Result::<(), StringStreamError>::Ok(())))` with incompatible types:
                                left-hand side has type: Result<(), <&str as StreamOnce>::Error>
                                right-hand side has type: Result<(), StringStreamError>
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/combine-4.6.6/src/stream/mod.rs:44:17
    |
44  |                 Ok(())
    |                 ^^^^^^
...
153 | clone_resetable! {('a) &'a str}
    | ------------------------------- in this macro invocation
    |
    = note: delayed at    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::TypeChecker>::fail::<alloc::string::String>
               3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
               4: rustc_mir_transform::optimized_mir
               5: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::optimized_mir, rustc_query_impl::plumbing::QueryCtxt>
               6: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
               7: rustc_metadata::rmeta::encoder::encode_metadata_impl
               8: rustc_data_structures::sync::join::<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
               9: rustc_metadata::rmeta::encoder::encode_metadata
              10: rustc_metadata::fs::encode_and_write_metadata
              11: rustc_interface::passes::start_codegen
              12: <rustc_interface::passes::QueryContext>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_errors::ErrorGuaranteed>>
              13: <rustc_interface::queries::Queries>::ongoing_codegen
              14: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
              15: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
              16: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
              17: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
              18: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
              19: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/bd39bbb4bb92df439bf6d85470e296cc6a47ffbd/library/alloc/src/boxed.rs:1988:9
              20: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                         at /rustc/bd39bbb4bb92df439bf6d85470e296cc6a47ffbd/library/alloc/src/boxed.rs:1988:9
              21: std::sys::unix::thread::Thread::new::thread_start
                         at /rustc/bd39bbb4bb92df439bf6d85470e296cc6a47ffbd/library/std/src/sys/unix/thread.rs:108:17
              22: <unknown>
              23: <unknown>
            
    = note: this error: internal compiler error originates in the macro `clone_resetable` (in Nightly builds, run with -Z macro-backtrace for more info)

note: the compiler unexpectedly panicked. this is a bug.

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

note: rustc 1.69.0-nightly (bd39bbb4b 2023-02-07) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C instrument-coverage

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

However I don't get the issue when building with --release

edit: my bad I'm experiencing #107678

@apiraino
Copy link
Contributor

apiraino commented Feb 9, 2023

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Feb 9, 2023
@apiraino
Copy link
Contributor

apiraino commented Feb 9, 2023

bisection tested with rustc +nightly "-Zvalidate-mir" repro.rs, seems to point to commit 40fda7b

searched nightlies: from nightly-2023-01-15 to nightly-2023-02-09
regressed nightly: nightly-2023-01-27
searched commit range: c18a5e8...d7948c8
regressed commit: 40fda7b

bisected with cargo-bisect-rustc v0.6.5

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2023-01-15 --script script2.sh --regress ice 

it's a rollup of:

- https:/rust-lang/rust/pull/97373 (impl DispatchFromDyn for Cell and UnsafeCell)
- https:/rust-lang/rust/pull/106625 (Remove backwards compat for LLVM 12 coverage format)
- https:/rust-lang/rust/pull/106779 (Avoid __cxa_thread_atexit_impl on Emscripten)
- https:/rust-lang/rust/pull/106811 (Append .dwp to the binary filename instead of replacing the existing extension.)
- https:/rust-lang/rust/pull/106836 (Remove optimistic spinning from `mpsc::SyncSender`)
- https:/rust-lang/rust/pull/106946 (implement Hash for proc_macro::LineColumn)
- https:/rust-lang/rust/pull/107074 (remove unnecessary check for opaque types)
- https:/rust-lang/rust/pull/107287 (Improve fn pointer notes)
- https:/rust-lang/rust/pull/107304 (Use `can_eq` to compare types for default assoc type error)

@matthiaskrgr
Copy link
Member Author

@apiraino I already bisected this one (see second comment :D)
@lcnr any should we revert now? it's still ICEing

@lcnr
Copy link
Contributor

lcnr commented Feb 10, 2023

yeah, wanted to revert this since looking at this a few days ago 😅 but for that I want to update the comment for why we're avoiding opaque types which is effort, so I've put it off for a while. Should get to it over the next few days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants