Skip to content

ICE: next solver: Failed to normalize Alias(Projection, AliasTy #139408

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

This goes from compile-pass -> ice with then next solver.
Bisects to #136863

trait B {
    type C;
}
struct D(<() as B>::C)
where
    for<'a> (): B;

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (17ffbc81a 2025-04-04)
binary: rustc
commit-hash: 17ffbc81a30c094193836a5d7f90dff273b5df93
commit-date: 2025-04-04
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

Error output

rustc -Znext-solver=globally

warning: trait `B` is never used
 --> code.rs:1:7
  |
1 | trait B {
  |       ^
  |
  = note: `#[warn(dead_code)]` on by default

warning: struct `D` is never constructed
 --> code.rs:4:8
  |
4 | struct D(<() as B>::C)
  |        ^

error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:171:13: Failed to normalize Alias(Projection, AliasTy { args: [()], def_id: DefId(0:4 ~ code[0eaf]::B::C), .. }) in typing_env=TypingEnv { typing_mode: PostAnalysis, param_env: ParamEnv { caller_bounds: [Binder { value: TraitPredicate(<() as B>, polarity:Positive), bound_vars: [Region(BrNamed(DefId(0:7 ~ code[0eaf]::D::'a), 'a))] }] } }, maybe try to call `try_normalize_erasing_regions` instead


thread 'rustc' panicked at compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:171:13:
Box<dyn Any>
stack backtrace:
   0:     0x736c954a0683 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h03493273b68c541f
   1:     0x736c95c06111 - core::fmt::write::h0ad6302f6d4dd435
   2:     0x736c9709b091 - std::io::Write::write_fmt::h02d833d801fd417d
   3:     0x736c954a04e2 - std::sys::backtrace::BacktraceLock::print::hf4c70899989a4c05
   4:     0x736c954a3fca - std::panicking::default_hook::{{closure}}::hb583b4cee228551d
   5:     0x736c954a3b4f - std::panicking::default_hook::h5dea409290788d81
   6:     0x736c944f87d3 - std[d7951eb46dce9c71]::panicking::update_hook::<alloc[84b1d9031b351e4c]::boxed::Box<rustc_driver_impl[80e692ad0c3ebd26]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x736c954a4843 - std::panicking::rust_panic_with_hook::hf643fb839cbcc568
   8:     0x736c94536ea1 - std[d7951eb46dce9c71]::panicking::begin_panic::<rustc_errors[4648bd1f37634169]::ExplicitBug>::{closure#0}
   9:     0x736c9452af16 - std[d7951eb46dce9c71]::sys::backtrace::__rust_end_short_backtrace::<std[d7951eb46dce9c71]::panicking::begin_panic<rustc_errors[4648bd1f37634169]::ExplicitBug>::{closure#0}, !>
  10:     0x736c945278fb - std[d7951eb46dce9c71]::panicking::begin_panic::<rustc_errors[4648bd1f37634169]::ExplicitBug>
  11:     0x736c945405d1 - <rustc_errors[4648bd1f37634169]::diagnostic::BugAbort as rustc_errors[4648bd1f37634169]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x736c94b967ba - rustc_middle[f8d4bc0d668b2de9]::util::bug::opt_span_bug_fmt::<rustc_span[5afc8ac4065fb37f]::span_encoding::Span>::{closure#0}
  13:     0x736c94b705fa - rustc_middle[f8d4bc0d668b2de9]::ty::context::tls::with_opt::<rustc_middle[f8d4bc0d668b2de9]::util::bug::opt_span_bug_fmt<rustc_span[5afc8ac4065fb37f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x736c94b7046b - rustc_middle[f8d4bc0d668b2de9]::ty::context::tls::with_context_opt::<rustc_middle[f8d4bc0d668b2de9]::ty::context::tls::with_opt<rustc_middle[f8d4bc0d668b2de9]::util::bug::opt_span_bug_fmt<rustc_span[5afc8ac4065fb37f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x736c92bccae0 - rustc_middle[f8d4bc0d668b2de9]::util::bug::bug_fmt
  16:     0x736c96479902 - <rustc_middle[f8d4bc0d668b2de9]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[880a0ecdf3a28a2e]::fold::TypeFolder<rustc_middle[f8d4bc0d668b2de9]::ty::context::TyCtxt>>::fold_ty
  17:     0x736c968ad22a - rustc_mir_transform[6c5b67ff048338a7]::shim::build_adt_ctor
  18:     0x736c9680ce79 - rustc_mir_transform[6c5b67ff048338a7]::optimized_mir
  19:     0x736c9680c3cb - rustc_query_impl[a7acd53263c3b2c8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a7acd53263c3b2c8]::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f8d4bc0d668b2de9]::query::erase::Erased<[u8; 8usize]>>
  20:     0x736c95c2fb6f - rustc_query_system[391e964f9e4dd334]::query::plumbing::try_execute_query::<rustc_query_impl[a7acd53263c3b2c8]::DynamicConfig<rustc_query_system[391e964f9e4dd334]::query::caches::DefIdCache<rustc_middle[f8d4bc0d668b2de9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a7acd53263c3b2c8]::plumbing::QueryCtxt, false>
  21:     0x736c95c2ef9d - rustc_query_impl[a7acd53263c3b2c8]::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
  22:     0x736c95fe997b - <rustc_metadata[a1d86e8afca336f5]::rmeta::encoder::EncodeContext>::encode_crate_root
  23:     0x736c96efb696 - rustc_metadata[a1d86e8afca336f5]::rmeta::encoder::encode_metadata
  24:     0x736c96a8fe83 - rustc_metadata[a1d86e8afca336f5]::fs::encode_and_write_metadata
  25:     0x736c96ef49c9 - <rustc_interface[b2b32e241a86d2e4]::queries::Linker>::codegen_and_build_linker
  26:     0x736c96ef252e - rustc_interface[b2b32e241a86d2e4]::passes::create_and_enter_global_ctxt::<core[fe0f6d3de0370503]::option::Option<rustc_interface[b2b32e241a86d2e4]::queries::Linker>, rustc_driver_impl[80e692ad0c3ebd26]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  27:     0x736c96d8a8b9 - rustc_interface[b2b32e241a86d2e4]::interface::run_compiler::<(), rustc_driver_impl[80e692ad0c3ebd26]::run_compiler::{closure#0}>::{closure#1}
  28:     0x736c96d1c6cf - std[d7951eb46dce9c71]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b2b32e241a86d2e4]::util::run_in_thread_with_globals<rustc_interface[b2b32e241a86d2e4]::util::run_in_thread_pool_with_globals<rustc_interface[b2b32e241a86d2e4]::interface::run_compiler<(), rustc_driver_impl[80e692ad0c3ebd26]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  29:     0x736c96d1cfab - <<std[d7951eb46dce9c71]::thread::Builder>::spawn_unchecked_<rustc_interface[b2b32e241a86d2e4]::util::run_in_thread_with_globals<rustc_interface[b2b32e241a86d2e4]::util::run_in_thread_pool_with_globals<rustc_interface[b2b32e241a86d2e4]::interface::run_compiler<(), rustc_driver_impl[80e692ad0c3ebd26]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[fe0f6d3de0370503]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x736c96d1e3ab - std::sys::pal::unix::thread::Thread::new::thread_start::h22b6fd7f8634625c
  31:     0x736c90a5d70a - <unknown>
  32:     0x736c90ae1aac - <unknown>
  33:                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: please make sure that you have updated to the latest nightly

note: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2025-04-05T11_26_57-3685347.txt` to your bug report

note: compiler flags: --crate-type lib -Z next-solver=globally

query stack during panic:
#0 [optimized_mir] optimizing MIR for `D`
end of query stack
error: aborting due to 1 previous error; 2 warnings emitted
Backtrace

<backtrace>

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions