Skip to content

ICE: overflow expanding free alias type #142419

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(lazy_type_alias)] type A = (i32, i32, i32, i32); type B = (A, A, A, A); type C = (B, B, B, (B, B, B, B)); type D = (C, C, C, C); fn foo(x: D) {} fn main() {}

original:

type A = (i32, i32, i32, i32); type B = (A, A, A, A); type C = (B, B, B, (B, B, B, B)); type D = (C, C, C, C); fn foo(x: D) { //~ NOTE `x` has type `(... Some(Some(Some(Some(Some(Some(Some(Some("")))))))); //~ ERROR expected function, found `(... } fn main() {}

Version information

rustc 1.89.0-nightly (6c8138de8 2025-06-12) binary: rustc commit-hash: 6c8138de8f1c96b2f66adbbc0e37c73525444750 commit-date: 2025-06-12 host: x86_64-unknown-linux-gnu release: 1.89.0-nightly LLVM version: 20.1.5 

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(lazy_type_alias)

Program output

warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes --> <crate attribute>:1:12 | 1 | #![feature(lazy_type_alias)] | ^^^^^^^^^^^^^^^ | = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information = note: `#[warn(incomplete_features)]` on by default warning: unused variable: `x` --> /tmp/icemaker_global_tempdir.KwqqEbbkwvG6/rustc_testrunner_tmpdir_reporting.KLV1phiERj3d/mvce.rs:6:8 | 6 | fn foo(x: D) {} | ^ help: if this is intentional, prefix it with an underscore: `_x` | = note: `#[warn(unused_variables)]` on by default warning: type alias `A` is never used --> /tmp/icemaker_global_tempdir.KwqqEbbkwvG6/rustc_testrunner_tmpdir_reporting.KLV1phiERj3d/mvce.rs:1:6 | 1 | type A = (i32, i32, i32, i32); | ^ | = note: `#[warn(dead_code)]` on by default warning: type alias `B` is never used --> /tmp/icemaker_global_tempdir.KwqqEbbkwvG6/rustc_testrunner_tmpdir_reporting.KLV1phiERj3d/mvce.rs:2:6 | 2 | type B = (A, A, A, A); | ^ warning: type alias `C` is never used --> /tmp/icemaker_global_tempdir.KwqqEbbkwvG6/rustc_testrunner_tmpdir_reporting.KLV1phiERj3d/mvce.rs:3:6 | 3 | type C = (B, B, B, (B, B, B, B)); | ^ warning: type alias `D` is never used --> /tmp/icemaker_global_tempdir.KwqqEbbkwvG6/rustc_testrunner_tmpdir_reporting.KLV1phiERj3d/mvce.rs:4:6 | 4 | type D = (C, C, C, C); | ^ warning: function `foo` is never used --> /tmp/icemaker_global_tempdir.KwqqEbbkwvG6/rustc_testrunner_tmpdir_reporting.KLV1phiERj3d/mvce.rs:6:4 | 6 | fn foo(x: D) {} | ^^^ warning: 7 warnings emitted note: no errors encountered even though delayed bugs were created note: those delayed bugs will now be shown as internal compiler errors error: internal compiler error: overflow expanding free alias type | = note: delayed at compiler/rustc_middle/src/ty/util.rs:1048:39 0: <rustc_errors::DiagCtxtInner>::emit_diagnostic 1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic 2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee 3: <rustc_errors::DiagCtxtHandle>::delayed_bug::<&str> 4: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 5: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::Ty> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_middle::ty::util::FreeAliasTypeExpander> 6: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 7: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty::{closure#0} 8: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::Ty> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_middle::ty::util::FreeAliasTypeExpander> 9: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 10: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::Ty> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_middle::ty::util::FreeAliasTypeExpander> 11: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 12: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty::{closure#0} 13: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::Ty> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_middle::ty::util::FreeAliasTypeExpander> 14: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 15: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty::{closure#0} 16: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty 17: rustc_hir_analysis::collect::lower_fn_sig_recovering_infer_ret_ty 18: rustc_hir_analysis::collect::fn_sig 19: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::fn_sig::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>> 20: <rustc_query_impl::query_impl::fn_sig::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once 21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 22: rustc_query_impl::query_impl::fn_sig::get_query_non_incr::__rust_end_short_backtrace 23: rustc_hir_analysis::check::wfcheck::check_item 24: rustc_hir_analysis::check::wfcheck::check_well_formed 25: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>> 26: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 27: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace 28: rustc_hir_analysis::check::wfcheck::check_type_wf 29: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>> 30: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 31: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace 32: rustc_hir_analysis::check_crate 33: rustc_interface::passes::analysis 34: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>> 35: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 36: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 37: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0} 38: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1} 39: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 40: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 41: std::sys::pal::unix::thread::Thread::new::thread_start 42: <unknown> 43: <unknown> error: internal compiler error: overflow expanding free alias type | = note: delayed at compiler/rustc_middle/src/ty/util.rs:1048:39 0: <rustc_errors::DiagCtxtInner>::emit_diagnostic 1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic 2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee 3: <rustc_errors::DiagCtxtHandle>::delayed_bug::<&str> 4: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 5: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::Ty> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_middle::ty::util::FreeAliasTypeExpander> 6: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 7: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::Ty> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_middle::ty::util::FreeAliasTypeExpander> 8: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 9: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty::{closure#0} 10: <&rustc_middle::ty::list::RawList<(), rustc_middle::ty::Ty> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_middle::ty::util::FreeAliasTypeExpander> 11: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty.cold 12: <rustc_middle::ty::util::FreeAliasTypeExpander as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty::{closure#0} 13: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_fn_ty 14: rustc_hir_analysis::collect::lower_fn_sig_recovering_infer_ret_ty 15: rustc_hir_analysis::collect::fn_sig 16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::fn_sig::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>> 17: <rustc_query_impl::query_impl::fn_sig::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once 18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 19: rustc_query_impl::query_impl::fn_sig::get_query_non_incr::__rust_end_short_backtrace 20: rustc_hir_analysis::check::wfcheck::check_item 21: rustc_hir_analysis::check::wfcheck::check_well_formed 22: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>> 23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 24: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace 25: rustc_hir_analysis::check::wfcheck::check_type_wf 26: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>> 27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 28: rustc_query_impl::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace 29: rustc_hir_analysis::check_crate 30: rustc_interface::passes::analysis 31: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>> 32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false> 33: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 34: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0} 35: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1} 36: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 37: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 38: std::sys::pal::unix::thread::Thread::new::thread_start 39: <unknown> 40: <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: rustc 1.89.0-nightly (6c8138de8 2025-06-12) running on x86_64-unknown-linux-gnu note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z dump-mir-dir=dir query stack during panic: end of query stack 

@rustbot label +F-lazy_type_alias

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-lazy_type_alias`#![feature(lazy_type_alias)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions