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: {type error} #120253

Closed
matthiaskrgr opened this issue Jan 22, 2024 · 3 comments · Fixed by #120277
Closed

ice: broken mir: {type error} #120253

matthiaskrgr opened this issue Jan 22, 2024 · 3 comments · Fixed by #120277
Assignees
Labels
C-bug Category: This is a bug. F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` I-cycle Issue: A query cycle occurred while none was expected 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.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

struct Bar;

trait Trait: Sized {
    type Assoc;
}

impl Trait for Bar {
    type Assoc = impl std::fmt::Debug;
    fn foo() -> Foo {
        Foo { field: () }
    }
}

struct Foo {
    field: <Bar as Trait>::Assoc,
}

original:

//! This test shows that we can even follow projections
//! into associated types of the same impl if they are
//! indirectly mentioned in a struct field.

#![feature(impl_trait_in_assoc_type)]
// check-pass

struct Bar;

trait Trait: Sized {
    type Assoc;
    fn foo() -> Foo;
}

impl Trait for Bar {
    type Assoc = impl std::fmt::Debug;
    fn foo() -> Foo {
        Foo { field: () }
    }
}

struct Foo {
    field: <Bar as Trait>::Assoc,
}

fn main() {}

Version information

rustc 1.77.0-nightly (d5fd09972 2024-01-22)
binary: rustc
commit-hash: d5fd0997291ca0135401a39dff25c8a9c13b8961
commit-date: 2024-01-22
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

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

Program output

error[E0407]: method `foo` is not a member of trait `Trait`
  --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:9:5
   |
9  | /     fn foo() -> Foo {
10 | |         Foo { field: () }
11 | |     }
   | |_____^ not a member of trait `Trait`

error[E0658]: `impl Trait` in associated types is unstable
 --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:8:18
  |
8 |     type Assoc = impl std::fmt::Debug;
  |                  ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(impl_trait_in_assoc_type)]` to the crate attributes to enable
  = note: this compiler was built on 2024-01-22; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:16:2
   |
16 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs`

error[E0391]: cycle detected when computing type of `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::Assoc::{opaque#0}`
 --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:8:18
  |
8 |     type Assoc = impl std::fmt::Debug;
  |                  ^^^^^^^^^^^^^^^^^^^^
  |
note: ...which requires computing type of opaque `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::Assoc::{opaque#0}`...
 --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:8:18
  |
8 |     type Assoc = impl std::fmt::Debug;
  |                  ^^^^^^^^^^^^^^^^^^^^
note: ...which requires borrow-checking `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::foo`...
 --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:9:5
  |
9 |     fn foo() -> Foo {
  |     ^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::foo`...
 --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:9:5
  |
9 |     fn foo() -> Foo {
  |     ^^^^^^^^^^^^^^^
note: ...which requires preparing `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::foo` for borrow checking...
 --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:9:5
  |
9 |     fn foo() -> Foo {
  |     ^^^^^^^^^^^^^^^
  = note: ...which again requires computing type of `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::Assoc::{opaque#0}`, completing the cycle
note: cycle used when checking that `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::Assoc::{opaque#0}` is well-formed
 --> /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:8:18
  |
8 |     type Assoc = impl std::fmt::Debug;
  |                  ^^^^^^^^^^^^^^^^^^^^
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: internal compiler error: compiler/rustc_const_eval/src/util/compare_types.rs:68:13: {type error}, ()

thread 'rustc' panicked at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/compiler/rustc_errors/src/lib.rs:850:41:
Box<dyn Any>
stack backtrace:
   0:     0x7ff6ff78be26 - std::backtrace_rs::backtrace::libunwind::trace::h822cf0d3f16ce96e
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7ff6ff78be26 - std::backtrace_rs::backtrace::trace_unsynchronized::hf6dd87288b360a80
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff6ff78be26 - std::sys_common::backtrace::_print_fmt::h1810b63f24a88d31
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7ff6ff78be26 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::had6e9f3a9c114825
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ff6ff7de6e0 - core::fmt::rt::Argument::fmt::hdbfeb42d75829060
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/core/src/fmt/rt.rs:142:9
   5:     0x7ff6ff7de6e0 - core::fmt::write::hafba614fe38d6868
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/core/src/fmt/mod.rs:1120:17
   6:     0x7ff6ff77f7ef - std::io::Write::write_fmt::h2acf34c87607c4f4
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/io/mod.rs:1810:15
   7:     0x7ff6ff78bc04 - std::sys_common::backtrace::_print::hd51dce922976c0f6
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ff6ff78bc04 - std::sys_common::backtrace::print::h696e9e3e79fe7db3
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ff6ff78e997 - std::panicking::default_hook::{{closure}}::h7b2b981bcad73d05
  10:     0x7ff6ff78e6f9 - std::panicking::default_hook::h07680c958c8c973d
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/panicking.rs:292:9
  11:     0x7ff70256fe1c - std[f27892e05d49fc7b]::panicking::update_hook::<alloc[820e4ba2a842b676]::boxed::Box<rustc_driver_impl[e28e9318a6752dc4]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7ff6ff78f0e6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h4f1a7cbbf23939a2
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/alloc/src/boxed.rs:2030:9
  13:     0x7ff6ff78f0e6 - std::panicking::rust_panic_with_hook::h1836ba36a249344b
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/panicking.rs:785:13
  14:     0x7ff7025a20b4 - std[f27892e05d49fc7b]::panicking::begin_panic::<rustc_errors[8272471c56a4b1bd]::ExplicitBug>::{closure#0}
  15:     0x7ff70259eaf6 - std[f27892e05d49fc7b]::sys_common::backtrace::__rust_end_short_backtrace::<std[f27892e05d49fc7b]::panicking::begin_panic<rustc_errors[8272471c56a4b1bd]::ExplicitBug>::{closure#0}, !>
  16:     0x7ff70259e766 - std[f27892e05d49fc7b]::panicking::begin_panic::<rustc_errors[8272471c56a4b1bd]::ExplicitBug>
  17:     0x7ff7025acfe1 - <rustc_errors[8272471c56a4b1bd]::diagnostic_builder::BugAbort as rustc_errors[8272471c56a4b1bd]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7ff7024f95ad - rustc_middle[a22e9aa1cd203080]::util::bug::opt_span_bug_fmt::<rustc_span[4f259522d7751bf2]::span_encoding::Span>::{closure#0}
  19:     0x7ff7024f97ca - rustc_middle[a22e9aa1cd203080]::ty::context::tls::with_opt::<rustc_middle[a22e9aa1cd203080]::util::bug::opt_span_bug_fmt<rustc_span[4f259522d7751bf2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7ff7024f1338 - rustc_middle[a22e9aa1cd203080]::ty::context::tls::with_context_opt::<rustc_middle[a22e9aa1cd203080]::ty::context::tls::with_opt<rustc_middle[a22e9aa1cd203080]::util::bug::opt_span_bug_fmt<rustc_span[4f259522d7751bf2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7ff701a09de4 - rustc_middle[a22e9aa1cd203080]::util::bug::span_bug_fmt::<rustc_span[4f259522d7751bf2]::span_encoding::Span>
  22:     0x7ff703c122ef - rustc_const_eval[b602959bfb513d93]::util::compare_types::relate_types
  23:     0x7ff701072f74 - <rustc_const_eval[b602959bfb513d93]::transform::validate::TypeChecker as rustc_middle[a22e9aa1cd203080]::mir::visit::Visitor>::visit_statement
  24:     0x7ff701068535 - rustc_const_eval[b602959bfb513d93]::transform::validate::validate_types
  25:     0x7ff703f276ff - <rustc_const_eval[b602959bfb513d93]::transform::validate::Validator as rustc_middle[a22e9aa1cd203080]::mir::MirPass>::run_pass
  26:     0x7ff702011840 - rustc_mir_transform[c05555400551e386]::pass_manager::validate_body
  27:     0x7ff703a74f69 - rustc_mir_transform[c05555400551e386]::mir_const
  28:     0x7ff703a748c7 - rustc_query_impl[37e0de7e1f66006]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[37e0de7e1f66006]::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7ff703a72fb9 - rustc_query_system[ab396eb147ea698a]::query::plumbing::try_execute_query::<rustc_query_impl[37e0de7e1f66006]::DynamicConfig<rustc_query_system[ab396eb147ea698a]::query::caches::VecCache<rustc_span[4f259522d7751bf2]::def_id::LocalDefId, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[37e0de7e1f66006]::plumbing::QueryCtxt, false>
  30:     0x7ff703a72ad0 - rustc_query_impl[37e0de7e1f66006]::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7ff701a990f2 - rustc_mir_transform[c05555400551e386]::mir_promoted
  32:     0x7ff703da5252 - rustc_query_impl[37e0de7e1f66006]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[37e0de7e1f66006]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 16usize]>>
  33:     0x7ff703da551c - rustc_query_system[ab396eb147ea698a]::query::plumbing::try_execute_query::<rustc_query_impl[37e0de7e1f66006]::DynamicConfig<rustc_query_system[ab396eb147ea698a]::query::caches::VecCache<rustc_span[4f259522d7751bf2]::def_id::LocalDefId, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[37e0de7e1f66006]::plumbing::QueryCtxt, false>
  34:     0x7ff70462f393 - rustc_query_impl[37e0de7e1f66006]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7ff70462f4ae - rustc_borrowck[4eb6c94253d64476]::mir_borrowck
  36:     0x7ff70462f3d9 - rustc_query_impl[37e0de7e1f66006]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[37e0de7e1f66006]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>
  37:     0x7ff703a72fb9 - rustc_query_system[ab396eb147ea698a]::query::plumbing::try_execute_query::<rustc_query_impl[37e0de7e1f66006]::DynamicConfig<rustc_query_system[ab396eb147ea698a]::query::caches::VecCache<rustc_span[4f259522d7751bf2]::def_id::LocalDefId, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[37e0de7e1f66006]::plumbing::QueryCtxt, false>
  38:     0x7ff703a72a1c - rustc_query_impl[37e0de7e1f66006]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7ff704d795d8 - rustc_middle[a22e9aa1cd203080]::query::plumbing::query_get_at::<rustc_query_system[ab396eb147ea698a]::query::caches::VecCache<rustc_span[4f259522d7751bf2]::def_id::LocalDefId, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>>.llvm.5611863932437213804.cold.0
  40:     0x7ff7026b0500 - <rustc_hir_analysis[2c86a586459b84d2]::collect::type_of::opaque::TaitConstraintLocator>::check
  41:     0x7ff70269eec5 - <rustc_hir_analysis[2c86a586459b84d2]::collect::type_of::opaque::TaitConstraintLocator as rustc_hir[ae9358ce95817dc8]::intravisit::Visitor>::visit_impl_item
  42:     0x7ff70269ee0c - <rustc_hir_analysis[2c86a586459b84d2]::collect::type_of::opaque::TaitConstraintLocator as rustc_hir[ae9358ce95817dc8]::intravisit::Visitor>::visit_item
  43:     0x7ff7047fb1d7 - rustc_hir_analysis[2c86a586459b84d2]::collect::type_of::type_of_opaque
  44:     0x7ff7047fa71b - rustc_query_impl[37e0de7e1f66006]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[37e0de7e1f66006]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>
  45:     0x7ff70385cba1 - rustc_query_system[ab396eb147ea698a]::query::plumbing::try_execute_query::<rustc_query_impl[37e0de7e1f66006]::DynamicConfig<rustc_query_system[ab396eb147ea698a]::query::caches::DefIdCache<rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[37e0de7e1f66006]::plumbing::QueryCtxt, false>
  46:     0x7ff70485aede - rustc_query_impl[37e0de7e1f66006]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7ff703c6e4d1 - rustc_middle[a22e9aa1cd203080]::query::plumbing::query_get_at::<rustc_query_system[ab396eb147ea698a]::query::caches::DefIdCache<rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>>
  48:     0x7ff701ace45c - rustc_hir_analysis[2c86a586459b84d2]::collect::type_of::type_of
  49:     0x7ff70385df2a - rustc_query_impl[37e0de7e1f66006]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[37e0de7e1f66006]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>
  50:     0x7ff70385cba1 - rustc_query_system[ab396eb147ea698a]::query::plumbing::try_execute_query::<rustc_query_impl[37e0de7e1f66006]::DynamicConfig<rustc_query_system[ab396eb147ea698a]::query::caches::DefIdCache<rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[37e0de7e1f66006]::plumbing::QueryCtxt, false>
  51:     0x7ff70385c75d - rustc_query_impl[37e0de7e1f66006]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  52:     0x7ff703c6e4d1 - rustc_middle[a22e9aa1cd203080]::query::plumbing::query_get_at::<rustc_query_system[ab396eb147ea698a]::query::caches::DefIdCache<rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 8usize]>>>
  53:     0x7ff70449eee2 - rustc_hir_analysis[2c86a586459b84d2]::check::check::check_item_type
  54:     0x7ff703da003b - rustc_hir_analysis[2c86a586459b84d2]::check::wfcheck::check_well_formed
  55:     0x7ff703d9eff3 - rustc_query_impl[37e0de7e1f66006]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[37e0de7e1f66006]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 1usize]>>
  56:     0x7ff703d9e6cb - rustc_query_system[ab396eb147ea698a]::query::plumbing::try_execute_query::<rustc_query_impl[37e0de7e1f66006]::DynamicConfig<rustc_query_system[ab396eb147ea698a]::query::caches::VecCache<rustc_hir[ae9358ce95817dc8]::hir_id::OwnerId, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[37e0de7e1f66006]::plumbing::QueryCtxt, false>
  57:     0x7ff703d9e443 - rustc_query_impl[37e0de7e1f66006]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  58:     0x7ff703d9bee2 - rustc_hir_analysis[2c86a586459b84d2]::check::wfcheck::check_mod_type_wf
  59:     0x7ff703d9be13 - rustc_query_impl[37e0de7e1f66006]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[37e0de7e1f66006]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 1usize]>>
  60:     0x7ff7045adefb - rustc_query_system[ab396eb147ea698a]::query::plumbing::try_execute_query::<rustc_query_impl[37e0de7e1f66006]::DynamicConfig<rustc_query_system[ab396eb147ea698a]::query::caches::DefaultCache<rustc_span[4f259522d7751bf2]::def_id::LocalModDefId, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[37e0de7e1f66006]::plumbing::QueryCtxt, false>
  61:     0x7ff7045adc03 - rustc_query_impl[37e0de7e1f66006]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  62:     0x7ff703a70411 - rustc_middle[a22e9aa1cd203080]::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system[ab396eb147ea698a]::query::caches::DefaultCache<rustc_span[4f259522d7751bf2]::def_id::LocalModDefId, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 1usize]>>, ()>
  63:     0x7ff703a70d4d - rustc_hir_analysis[2c86a586459b84d2]::check_crate
  64:     0x7ff70416f6d2 - rustc_interface[f4b5ac45d2bd61f0]::passes::analysis
  65:     0x7ff70416f31f - rustc_query_impl[37e0de7e1f66006]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[37e0de7e1f66006]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 1usize]>>
  66:     0x7ff7042361b2 - rustc_query_system[ab396eb147ea698a]::query::plumbing::try_execute_query::<rustc_query_impl[37e0de7e1f66006]::DynamicConfig<rustc_query_system[ab396eb147ea698a]::query::caches::SingleCache<rustc_middle[a22e9aa1cd203080]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[37e0de7e1f66006]::plumbing::QueryCtxt, false>
  67:     0x7ff704235f15 - rustc_query_impl[37e0de7e1f66006]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  68:     0x7ff70456e0b3 - rustc_interface[f4b5ac45d2bd61f0]::interface::run_compiler::<core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>, rustc_driver_impl[e28e9318a6752dc4]::run_compiler::{closure#0}>::{closure#0}
  69:     0x7ff7047ee586 - std[f27892e05d49fc7b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f4b5ac45d2bd61f0]::util::run_in_thread_with_globals<rustc_interface[f4b5ac45d2bd61f0]::util::run_in_thread_pool_with_globals<rustc_interface[f4b5ac45d2bd61f0]::interface::run_compiler<core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>, rustc_driver_impl[e28e9318a6752dc4]::run_compiler::{closure#0}>::{closure#0}, core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>>::{closure#0}, core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>>
  70:     0x7ff7047ee3b3 - <<std[f27892e05d49fc7b]::thread::Builder>::spawn_unchecked_<rustc_interface[f4b5ac45d2bd61f0]::util::run_in_thread_with_globals<rustc_interface[f4b5ac45d2bd61f0]::util::run_in_thread_pool_with_globals<rustc_interface[f4b5ac45d2bd61f0]::interface::run_compiler<core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>, rustc_driver_impl[e28e9318a6752dc4]::run_compiler::{closure#0}>::{closure#0}, core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>>::{closure#0}, core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ae9770195e47f994]::result::Result<(), rustc_span[4f259522d7751bf2]::ErrorGuaranteed>>::{closure#1} as core[ae9770195e47f994]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  71:     0x7ff6ff7986d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha12de79bc5f3375d
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/alloc/src/boxed.rs:2016:9
  72:     0x7ff6ff7986d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd0caa04c86a11da9
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/alloc/src/boxed.rs:2016:9
  73:     0x7ff6ff7986d5 - std::sys::pal::unix::thread::Thread::new::thread_start::hbc42e638d9ed0ea4
                               at /rustc/d5fd0997291ca0135401a39dff25c8a9c13b8961/library/std/src/sys/pal/unix/thread.rs:108:17
  74:     0x7ff6ff5849eb - <unknown>
  75:     0x7ff6ff6087cc - <unknown>
  76:                0x0 - <unknown>

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

note: rustc 1.77.0-nightly (d5fd09972 2024-01-22) running on x86_64-unknown-linux-gnu

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

query stack during panic:
#0 [mir_const] preparing `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::foo` for borrow checking
#1 [mir_promoted] promoting constants in MIR for `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::foo`
#2 [mir_borrowck] borrow-checking `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::foo`
#3 [type_of_opaque] computing type of opaque `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::Assoc::{opaque#0}`
#4 [type_of] computing type of `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::Assoc::{opaque#0}`
#5 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.ZN6pCIfEc6MH/rustc_testrunner_tmpdir_reporting.xmVAFlgrzBmn/mvce.rs:7:1: 7:19>::Assoc::{opaque#0}` is well-formed
#6 [check_mod_type_wf] checking that types are well-formed in top-level module
#7 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors

Some errors have detailed explanations: E0391, E0407, E0601, E0658.
For more information about an error, try `rustc --explain E0391`.

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jan 22, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 22, 2024
@fmease fmease added F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 23, 2024
@matthiaskrgr
Copy link
Member Author

auto-reduced (treereduce-rust):

type Foo = impl std::fmt::Debug;

struct Bar(Foo);
fn define() -> Bar {
    Bar(42)
}

original:

// check-pass
#![feature(type_alias_impl_trait)]
use std::fmt::Debug;

type Foo = impl std::fmt::Debug;

struct Bar(Foo);
fn define() -> Bar {
    Bar(42)
}

type Foo2 = impl Debug;

fn define2(_: Foo2) {
    let PhantomPinned = || -> Ptr { 42 };
}

type Foo3 = impl Debug;

fn define3(x: Foo3) {
    let y: i32 = x;
}
fn define3_1(_: Foo3) {
    define3(42)
}

type Foo4 = impl Debug;

fn define4(_: Foo4) {
    let y: Foo4 = 42;
}

fn main() {}

Version information

rustc 1.77.0-nightly (0011fac90 2024-01-23)
binary: rustc
commit-hash: 0011fac90d2846ea3c04506238ff6e4ed3ce0efe
commit-date: 2024-01-23
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

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

Program output

error[E0658]: `impl Trait` in type aliases is unstable
 --> /tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs:1:12
  |
1 | type Foo = impl std::fmt::Debug;
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
  = note: this compiler was built on 2024-01-23; consider upgrading it if it is out of date

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs:6:2
  |
6 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs`

error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
 --> /tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs:1:12
  |
1 | type Foo = impl std::fmt::Debug;
  |            ^^^^^^^^^^^^^^^^^^^^
  |
note: ...which requires computing type of opaque `Foo::{opaque#0}`...
 --> /tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs:1:12
  |
1 | type Foo = impl std::fmt::Debug;
  |            ^^^^^^^^^^^^^^^^^^^^
note: ...which requires borrow-checking `define`...
 --> /tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs:4:1
  |
4 | fn define() -> Bar {
  | ^^^^^^^^^^^^^^^^^^
note: ...which requires promoting constants in MIR for `define`...
 --> /tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs:4:1
  |
4 | fn define() -> Bar {
  | ^^^^^^^^^^^^^^^^^^
note: ...which requires preparing `define` for borrow checking...
 --> /tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs:4:1
  |
4 | fn define() -> Bar {
  | ^^^^^^^^^^^^^^^^^^
  = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
note: cycle used when checking that `Foo::{opaque#0}` is well-formed
 --> /tmp/icemaker_global_tempdir.l42pJCCS5NzB/rustc_testrunner_tmpdir_reporting.pSlX73Urky23/mvce.rs:1:12
  |
1 | type Foo = impl std::fmt::Debug;
  |            ^^^^^^^^^^^^^^^^^^^^
  = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: internal compiler error: compiler/rustc_const_eval/src/util/compare_types.rs:68:13: {type error}, i32

thread 'rustc' panicked at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/compiler/rustc_errors/src/lib.rs:850:41:
Box<dyn Any>
stack backtrace:
   0:     0x7fd9dc78be26 - std::backtrace_rs::backtrace::libunwind::trace::h8bd4f8a3c670f831
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fd9dc78be26 - std::backtrace_rs::backtrace::trace_unsynchronized::h247000044feed179
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd9dc78be26 - std::sys_common::backtrace::_print_fmt::h0385ec49e0b8227a
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fd9dc78be26 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hda172d64694d8990
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fd9dc7de6e0 - core::fmt::rt::Argument::fmt::hd9ece61e8942fd51
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/core/src/fmt/rt.rs:142:9
   5:     0x7fd9dc7de6e0 - core::fmt::write::h7c6c8cb233bed89c
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fd9dc77f75f - std::io::Write::write_fmt::h7f0ea61cb504dccb
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/io/mod.rs:1810:15
   7:     0x7fd9dc78bc04 - std::sys_common::backtrace::_print::hfbee3880d126b55f
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fd9dc78bc04 - std::sys_common::backtrace::print::h9ba8e7f8269e947d
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fd9dc78e997 - std::panicking::default_hook::{{closure}}::h14aea7d0b42ff8f7
  10:     0x7fd9dc78e6f9 - std::panicking::default_hook::h56887b93ed4b386a
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/panicking.rs:292:9
  11:     0x7fd9df56e42c - std[12b7809bf981c7b7]::panicking::update_hook::<alloc[cdaf34309c741da0]::boxed::Box<rustc_driver_impl[f11a5711e520ddad]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fd9dc78f0e6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h03a6e7dbd40a310c
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/alloc/src/boxed.rs:2030:9
  13:     0x7fd9dc78f0e6 - std::panicking::rust_panic_with_hook::h77c59266616c47e6
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/panicking.rs:785:13
  14:     0x7fd9df5a07c4 - std[12b7809bf981c7b7]::panicking::begin_panic::<rustc_errors[7063f1953ed52c00]::ExplicitBug>::{closure#0}
  15:     0x7fd9df59cec6 - std[12b7809bf981c7b7]::sys_common::backtrace::__rust_end_short_backtrace::<std[12b7809bf981c7b7]::panicking::begin_panic<rustc_errors[7063f1953ed52c00]::ExplicitBug>::{closure#0}, !>
  16:     0x7fd9df598056 - std[12b7809bf981c7b7]::panicking::begin_panic::<rustc_errors[7063f1953ed52c00]::ExplicitBug>
  17:     0x7fd9df5ab6f1 - <rustc_errors[7063f1953ed52c00]::diagnostic_builder::BugAbort as rustc_errors[7063f1953ed52c00]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7fd9df4f7d1d - rustc_middle[e407b607d7e06baa]::util::bug::opt_span_bug_fmt::<rustc_span[6e42e6692cf6f171]::span_encoding::Span>::{closure#0}
  19:     0x7fd9df4f7d4a - rustc_middle[e407b607d7e06baa]::ty::context::tls::with_opt::<rustc_middle[e407b607d7e06baa]::util::bug::opt_span_bug_fmt<rustc_span[6e42e6692cf6f171]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7fd9df4ef8b8 - rustc_middle[e407b607d7e06baa]::ty::context::tls::with_context_opt::<rustc_middle[e407b607d7e06baa]::ty::context::tls::with_opt<rustc_middle[e407b607d7e06baa]::util::bug::opt_span_bug_fmt<rustc_span[6e42e6692cf6f171]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7fd9dea0ae04 - rustc_middle[e407b607d7e06baa]::util::bug::span_bug_fmt::<rustc_span[6e42e6692cf6f171]::span_encoding::Span>
  22:     0x7fd9e0c283af - rustc_const_eval[4a5850f7e8a36eb9]::util::compare_types::relate_types
  23:     0x7fd9de0791f4 - <rustc_const_eval[4a5850f7e8a36eb9]::transform::validate::TypeChecker as rustc_middle[e407b607d7e06baa]::mir::visit::Visitor>::visit_statement
  24:     0x7fd9de06e745 - rustc_const_eval[4a5850f7e8a36eb9]::transform::validate::validate_types
  25:     0x7fd9e0f75f3f - <rustc_const_eval[4a5850f7e8a36eb9]::transform::validate::Validator as rustc_middle[e407b607d7e06baa]::mir::MirPass>::run_pass
  26:     0x7fd9df010b50 - rustc_mir_transform[d6de9171b468a0f]::pass_manager::validate_body
  27:     0x7fd9e0aa3ee9 - rustc_mir_transform[d6de9171b468a0f]::mir_const
  28:     0x7fd9e0aa3847 - rustc_query_impl[5f11da20c50acb9b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f11da20c50acb9b]::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7fd9e0aa1f39 - rustc_query_system[e80a01a89f971937]::query::plumbing::try_execute_query::<rustc_query_impl[5f11da20c50acb9b]::DynamicConfig<rustc_query_system[e80a01a89f971937]::query::caches::VecCache<rustc_span[6e42e6692cf6f171]::def_id::LocalDefId, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5f11da20c50acb9b]::plumbing::QueryCtxt, false>
  30:     0x7fd9e0aa1a50 - rustc_query_impl[5f11da20c50acb9b]::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7fd9dea96d62 - rustc_mir_transform[d6de9171b468a0f]::mir_promoted
  32:     0x7fd9e0ef6a54 - rustc_query_impl[5f11da20c50acb9b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f11da20c50acb9b]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 16usize]>>
  33:     0x7fd9e0ef6d1e - rustc_query_system[e80a01a89f971937]::query::plumbing::try_execute_query::<rustc_query_impl[5f11da20c50acb9b]::DynamicConfig<rustc_query_system[e80a01a89f971937]::query::caches::VecCache<rustc_span[6e42e6692cf6f171]::def_id::LocalDefId, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[5f11da20c50acb9b]::plumbing::QueryCtxt, false>
  34:     0x7fd9e1618993 - rustc_query_impl[5f11da20c50acb9b]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7fd9e1618aae - rustc_borrowck[eac650968f971438]::mir_borrowck
  36:     0x7fd9e16189d9 - rustc_query_impl[5f11da20c50acb9b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f11da20c50acb9b]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>
  37:     0x7fd9e0aa1f39 - rustc_query_system[e80a01a89f971937]::query::plumbing::try_execute_query::<rustc_query_impl[5f11da20c50acb9b]::DynamicConfig<rustc_query_system[e80a01a89f971937]::query::caches::VecCache<rustc_span[6e42e6692cf6f171]::def_id::LocalDefId, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5f11da20c50acb9b]::plumbing::QueryCtxt, false>
  38:     0x7fd9e0aa199c - rustc_query_impl[5f11da20c50acb9b]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7fd9e1d74fd8 - rustc_middle[e407b607d7e06baa]::query::plumbing::query_get_at::<rustc_query_system[e80a01a89f971937]::query::caches::VecCache<rustc_span[6e42e6692cf6f171]::def_id::LocalDefId, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>>.llvm.17903408917147203805.cold.0
  40:     0x7fd9df6aea50 - <rustc_hir_analysis[d83455a77bcc6c3]::collect::type_of::opaque::TaitConstraintLocator>::check
  41:     0x7fd9df69cf20 - <rustc_hir_analysis[d83455a77bcc6c3]::collect::type_of::opaque::TaitConstraintLocator as rustc_hir[59e64b693e732c0e]::intravisit::Visitor>::visit_item
  42:     0x7fd9e17fa06b - rustc_hir_analysis[d83455a77bcc6c3]::collect::type_of::type_of_opaque
  43:     0x7fd9e17f985b - rustc_query_impl[5f11da20c50acb9b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f11da20c50acb9b]::query_impl::type_of_opaque::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>
  44:     0x7fd9e085c661 - rustc_query_system[e80a01a89f971937]::query::plumbing::try_execute_query::<rustc_query_impl[5f11da20c50acb9b]::DynamicConfig<rustc_query_system[e80a01a89f971937]::query::caches::DefIdCache<rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5f11da20c50acb9b]::plumbing::QueryCtxt, false>
  45:     0x7fd9e185a01e - rustc_query_impl[5f11da20c50acb9b]::query_impl::type_of_opaque::get_query_non_incr::__rust_end_short_backtrace
  46:     0x7fd9e0c5b991 - rustc_middle[e407b607d7e06baa]::query::plumbing::query_get_at::<rustc_query_system[e80a01a89f971937]::query::caches::DefIdCache<rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>>
  47:     0x7fd9deace17c - rustc_hir_analysis[d83455a77bcc6c3]::collect::type_of::type_of
  48:     0x7fd9e085d9ea - rustc_query_impl[5f11da20c50acb9b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f11da20c50acb9b]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>
  49:     0x7fd9e085c661 - rustc_query_system[e80a01a89f971937]::query::plumbing::try_execute_query::<rustc_query_impl[5f11da20c50acb9b]::DynamicConfig<rustc_query_system[e80a01a89f971937]::query::caches::DefIdCache<rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5f11da20c50acb9b]::plumbing::QueryCtxt, false>
  50:     0x7fd9e085c21d - rustc_query_impl[5f11da20c50acb9b]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  51:     0x7fd9e0c5b991 - rustc_middle[e407b607d7e06baa]::query::plumbing::query_get_at::<rustc_query_system[e80a01a89f971937]::query::caches::DefIdCache<rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 8usize]>>>
  52:     0x7fd9e1493c62 - rustc_hir_analysis[d83455a77bcc6c3]::check::check::check_item_type
  53:     0x7fd9e0ef183b - rustc_hir_analysis[d83455a77bcc6c3]::check::wfcheck::check_well_formed
  54:     0x7fd9e0ef07f3 - rustc_query_impl[5f11da20c50acb9b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f11da20c50acb9b]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 1usize]>>
  55:     0x7fd9e0eefecb - rustc_query_system[e80a01a89f971937]::query::plumbing::try_execute_query::<rustc_query_impl[5f11da20c50acb9b]::DynamicConfig<rustc_query_system[e80a01a89f971937]::query::caches::VecCache<rustc_hir[59e64b693e732c0e]::hir_id::OwnerId, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5f11da20c50acb9b]::plumbing::QueryCtxt, false>
  56:     0x7fd9e0eefc43 - rustc_query_impl[5f11da20c50acb9b]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  57:     0x7fd9e0eed6e2 - rustc_hir_analysis[d83455a77bcc6c3]::check::wfcheck::check_mod_type_wf
  58:     0x7fd9e0eed613 - rustc_query_impl[5f11da20c50acb9b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f11da20c50acb9b]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 1usize]>>
  59:     0x7fd9e15b607b - rustc_query_system[e80a01a89f971937]::query::plumbing::try_execute_query::<rustc_query_impl[5f11da20c50acb9b]::DynamicConfig<rustc_query_system[e80a01a89f971937]::query::caches::DefaultCache<rustc_span[6e42e6692cf6f171]::def_id::LocalModDefId, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5f11da20c50acb9b]::plumbing::QueryCtxt, false>
  60:     0x7fd9e15b5d83 - rustc_query_impl[5f11da20c50acb9b]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  61:     0x7fd9e0a9f385 - rustc_middle[e407b607d7e06baa]::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system[e80a01a89f971937]::query::caches::DefaultCache<rustc_span[6e42e6692cf6f171]::def_id::LocalModDefId, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 1usize]>>, ()>
  62:     0x7fd9e0a9fccb - rustc_hir_analysis[d83455a77bcc6c3]::check_crate
  63:     0x7fd9e118cfd2 - rustc_interface[75c391c75cdba214]::passes::analysis
  64:     0x7fd9e118cc1f - rustc_query_impl[5f11da20c50acb9b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5f11da20c50acb9b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 1usize]>>
  65:     0x7fd9e1227b72 - rustc_query_system[e80a01a89f971937]::query::plumbing::try_execute_query::<rustc_query_impl[5f11da20c50acb9b]::DynamicConfig<rustc_query_system[e80a01a89f971937]::query::caches::SingleCache<rustc_middle[e407b607d7e06baa]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5f11da20c50acb9b]::plumbing::QueryCtxt, false>
  66:     0x7fd9e12278d5 - rustc_query_impl[5f11da20c50acb9b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  67:     0x7fd9e158de33 - rustc_interface[75c391c75cdba214]::interface::run_compiler::<core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>, rustc_driver_impl[f11a5711e520ddad]::run_compiler::{closure#0}>::{closure#0}
  68:     0x7fd9e17ed6c6 - std[12b7809bf981c7b7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[75c391c75cdba214]::util::run_in_thread_with_globals<rustc_interface[75c391c75cdba214]::util::run_in_thread_pool_with_globals<rustc_interface[75c391c75cdba214]::interface::run_compiler<core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>, rustc_driver_impl[f11a5711e520ddad]::run_compiler::{closure#0}>::{closure#0}, core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>>::{closure#0}, core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>>
  69:     0x7fd9e17ed4f3 - <<std[12b7809bf981c7b7]::thread::Builder>::spawn_unchecked_<rustc_interface[75c391c75cdba214]::util::run_in_thread_with_globals<rustc_interface[75c391c75cdba214]::util::run_in_thread_pool_with_globals<rustc_interface[75c391c75cdba214]::interface::run_compiler<core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>, rustc_driver_impl[f11a5711e520ddad]::run_compiler::{closure#0}>::{closure#0}, core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>>::{closure#0}, core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1770712344c176a3]::result::Result<(), rustc_span[6e42e6692cf6f171]::ErrorGuaranteed>>::{closure#1} as core[1770712344c176a3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  70:     0x7fd9dc7986d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he1fd00e1e4273235
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/alloc/src/boxed.rs:2016:9
  71:     0x7fd9dc7986d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h17b0e16c29f0177c
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/alloc/src/boxed.rs:2016:9
  72:     0x7fd9dc7986d5 - std::sys::pal::unix::thread::Thread::new::thread_start::haac84641b4148856
                               at /rustc/0011fac90d2846ea3c04506238ff6e4ed3ce0efe/library/std/src/sys/pal/unix/thread.rs:108:17
  73:     0x7fd9dc5499eb - <unknown>
  74:     0x7fd9dc5cd7cc - <unknown>
  75:                0x0 - <unknown>

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

note: rustc 1.77.0-nightly (0011fac90 2024-01-23) running on x86_64-unknown-linux-gnu

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

query stack during panic:
#0 [mir_const] preparing `define` for borrow checking
#1 [mir_promoted] promoting constants in MIR for `define`
#2 [mir_borrowck] borrow-checking `define`
#3 [type_of_opaque] computing type of opaque `Foo::{opaque#0}`
#4 [type_of] computing type of `Foo::{opaque#0}`
#5 [check_well_formed] checking that `Foo::{opaque#0}` is well-formed
#6 [check_mod_type_wf] checking that types are well-formed in top-level module
#7 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0391, E0601, E0658.
For more information about an error, try `rustc --explain E0391`.

@matthiaskrgr
Copy link
Member Author

This ices since #120137 by @compiler-errors but I dont see any of the added error messages which is weird

@compiler-errors
Copy link
Member

ICE happens before any of those error messages would be fired. I'll fix it later.

@compiler-errors compiler-errors self-assigned this Jan 23, 2024
fmease added a commit to fmease/rust that referenced this issue Jan 24, 2024
…alidating, r=oli-obk

Normalize field types before checking validity

I forgot to normalize field types when checking ADT-like aggregates in the MIR validator.

This normalization is needed due to a crude check for opaque types in `mir_assign_valid_types` which prevents opaque type cycles -- if we pass in an unnormalized type, we may not detect that the destination type is an opaque, and therefore will call `type_of(opaque)` later on, which causes a cycle error -> ICE.

Fixes rust-lang#120253
@fmease fmease added the I-cycle Issue: A query cycle occurred while none was expected label Jan 25, 2024
@bors bors closed this as completed in 8ec8838 Jan 27, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 27, 2024
Rollup merge of rust-lang#120277 - compiler-errors:normalize-before-validating, r=oli-obk

Normalize field types before checking validity

I forgot to normalize field types when checking ADT-like aggregates in the MIR validator.

This normalization is needed due to a crude check for opaque types in `mir_assign_valid_types` which prevents opaque type cycles -- if we pass in an unnormalized type, we may not detect that the destination type is an opaque, and therefore will call `type_of(opaque)` later on, which causes a cycle error -> ICE.

Fixes rust-lang#120253
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. F-impl_trait_in_assoc_type `#![feature(impl_trait_in_assoc_type)]` I-cycle Issue: A query cycle occurred while none was expected 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants