Skip to content

[ICE]: TyAlias unexpectedly reached by ReachEverythingInTheInterfaceVisitor #156778

@matthiaskrgr

Description

@matthiaskrgr

snippet:

#![feature(lazy_type_alias)]
use src::hidden_core;
mod src {
    mod aliases {
        use hidden_core::InternalStruct;
        pub type ExposedType = InternalStruct<f32>;
    }
    pub mod hidden_core {
        use super::aliases::ExposedType;
        pub struct InternalStruct<T> {
            _x: T,
        }
        pub fn new() -> ExposedType {
            InternalStruct { _x: 1.0 }
        }
    }
}
fn main() {}

Version information

rustc 1.97.0-nightly (9128490ab 2026-05-20)
binary: rustc
commit-hash: 9128490ab32b5ab37a4bb9f6667a9ce5d32924c0
commit-date: 2026-05-20
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4

Possibly related line of code:

| DefKind::Mod
| DefKind::Use
| DefKind::ExternCrate
| DefKind::GlobalAsm
| DefKind::ForeignMod
| DefKind::Const { .. } => {
span_bug!(
self.tcx().def_span(def_id),
"{def_kind:?} unexpectedly reached by `ReachEverythingInTheInterfaceVisitor`"
)
}
}
}

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.GIQ0DIwFMoOW/rustc_testrunner_tmpdir_reporting.V7tHHfICn6H5/mvce.rs: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

error: internal compiler error: /rustc-dev/9128490ab32b5ab37a4bb9f6667a9ce5d32924c0/compiler/rustc_privacy/src/lib.rs:829:17: TyAlias unexpectedly reached by `ReachEverythingInTheInterfaceVisitor`
 --> /tmp/icemaker_global_tempdir.GIQ0DIwFMoOW/rustc_testrunner_tmpdir_reporting.V7tHHfICn6H5/mvce.rs:6:9
  |
6 |         pub type ExposedType = InternalStruct<f32>;
  |         ^^^^^^^^^^^^^^^^^^^^


thread 'rustc' (684615) panicked at /rustc-dev/9128490ab32b5ab37a4bb9f6667a9ce5d32924c0/compiler/rustc_privacy/src/lib.rs:829:17:
Box<dyn Any>
stack backtrace:
   0:     0x7f0901893ae9 - <<std[f235ea7d9a5be936]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[41267cda7e919254]::fmt::Display>::fmt
   1:     0x7f090201fc88 - core[41267cda7e919254]::fmt::write
   2:     0x7f09018aa7d6 - <std[f235ea7d9a5be936]::sys::stdio::unix::Stderr as std[f235ea7d9a5be936]::io::Write>::write_fmt
   3:     0x7f0901869d0e - std[f235ea7d9a5be936]::panicking::default_hook::{closure#0}
   4:     0x7f0901887423 - std[f235ea7d9a5be936]::panicking::default_hook
   5:     0x7f0900686da1 - std[f235ea7d9a5be936]::panicking::update_hook::<alloc[8ee9165a774cbce5]::boxed::Box<rustc_driver_impl[1dc038e5eb65c07]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f0901887702 - std[f235ea7d9a5be936]::panicking::panic_with_hook
   7:     0x7f09006b4671 - std[f235ea7d9a5be936]::panicking::begin_panic::<rustc_errors[1e37d4f329e3ae4]::ExplicitBug>::{closure#0}
   8:     0x7f09006ad666 - std[f235ea7d9a5be936]::sys::backtrace::__rust_end_short_backtrace::<std[f235ea7d9a5be936]::panicking::begin_panic<rustc_errors[1e37d4f329e3ae4]::ExplicitBug>::{closure#0}, !>
   9:     0x7f09006ad3cb - std[f235ea7d9a5be936]::panicking::begin_panic::<rustc_errors[1e37d4f329e3ae4]::ExplicitBug>
  10:     0x7f09006bfb51 - <rustc_errors[1e37d4f329e3ae4]::diagnostic::BugAbort as rustc_errors[1e37d4f329e3ae4]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f0900d23f5c - <rustc_errors[1e37d4f329e3ae4]::DiagCtxtHandle>::span_bug::<rustc_span[7a4c7e318ca56c6b]::span_encoding::Span, alloc[8ee9165a774cbce5]::string::String>
  12:     0x7f0900d4f726 - rustc_middle[345334b73668da1f]::util::bug::opt_span_bug_fmt::<rustc_span[7a4c7e318ca56c6b]::span_encoding::Span>::{closure#0}
  13:     0x7f0900d4f8b2 - rustc_middle[345334b73668da1f]::ty::context::tls::with_opt::<rustc_middle[345334b73668da1f]::util::bug::opt_span_bug_fmt<rustc_span[7a4c7e318ca56c6b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f0900d3de3b - rustc_middle[345334b73668da1f]::ty::context::tls::with_context_opt::<rustc_middle[345334b73668da1f]::ty::context::tls::with_opt<rustc_middle[345334b73668da1f]::util::bug::opt_span_bug_fmt<rustc_span[7a4c7e318ca56c6b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f08fe5196d8 - rustc_middle[345334b73668da1f]::util::bug::span_bug_fmt::<rustc_span[7a4c7e318ca56c6b]::span_encoding::Span>
  16:     0x7f090210cc82 - <rustc_privacy[989f5f38d76d9f59]::ReachEverythingInTheInterfaceVisitor as rustc_privacy[989f5f38d76d9f59]::DefIdVisitor>::visit_def_id
  17:     0x7f090210a1fa - <rustc_privacy[989f5f38d76d9f59]::DefIdVisitorSkeleton<rustc_privacy[989f5f38d76d9f59]::ReachEverythingInTheInterfaceVisitor> as rustc_type_ir[c0d67680c17b857c]::visit::TypeVisitor<rustc_middle[345334b73668da1f]::ty::context::TyCtxt>>::visit_ty
  18:     0x7f0902109dc9 - <rustc_privacy[989f5f38d76d9f59]::DefIdVisitorSkeleton<rustc_privacy[989f5f38d76d9f59]::ReachEverythingInTheInterfaceVisitor> as rustc_type_ir[c0d67680c17b857c]::visit::TypeVisitor<rustc_middle[345334b73668da1f]::ty::context::TyCtxt>>::visit_ty
  19:     0x7f0902fec821 - <rustc_privacy[989f5f38d76d9f59]::EmbargoVisitor>::check_def_id
  20:     0x7f0902fe8ec6 - rustc_privacy[989f5f38d76d9f59]::effective_visibilities
  21:     0x7f09031b1a71 - rustc_query_impl[e90c13edde4545d4]::execution::try_execute_query::<rustc_middle[345334b73668da1f]::query::caches::SingleCache<rustc_middle[345334b73668da1f]::query::erase::ErasedData<[u8; 8usize]>>, false>
  22:     0x7f0902f92b8f - rustc_query_impl[e90c13edde4545d4]::query_impl::effective_visibilities::execute_query_non_incr::__rust_end_short_backtrace
  23:     0x7f0902f92bf5 - rustc_interface[cdf3137ac0519eb3]::passes::analysis::{closure#0}::{closure#0}
  24:     0x7f0902f92cda - rustc_data_structures[a14becd702dd8ef0]::sync::parallel::par_fns
  25:     0x7f09022e33a0 - rustc_interface[cdf3137ac0519eb3]::passes::analysis
  26:     0x7f09031b2649 - rustc_query_impl[e90c13edde4545d4]::execution::try_execute_query::<rustc_middle[345334b73668da1f]::query::caches::SingleCache<rustc_middle[345334b73668da1f]::query::erase::ErasedData<[u8; 0usize]>>, false>
  27:     0x7f09031b2329 - rustc_query_impl[e90c13edde4545d4]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  28:     0x7f0903168d1b - rustc_interface[cdf3137ac0519eb3]::interface::run_compiler::<(), rustc_driver_impl[1dc038e5eb65c07]::run_compiler::{closure#0}>::{closure#1}
  29:     0x7f09031a277c - std[f235ea7d9a5be936]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[cdf3137ac0519eb3]::util::run_in_thread_with_globals<rustc_interface[cdf3137ac0519eb3]::util::run_in_thread_pool_with_globals<rustc_interface[cdf3137ac0519eb3]::interface::run_compiler<(), rustc_driver_impl[1dc038e5eb65c07]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  30:     0x7f09031a2e6d - <std[f235ea7d9a5be936]::thread::lifecycle::spawn_unchecked<rustc_interface[cdf3137ac0519eb3]::util::run_in_thread_with_globals<rustc_interface[cdf3137ac0519eb3]::util::run_in_thread_pool_with_globals<rustc_interface[cdf3137ac0519eb3]::interface::run_compiler<(), rustc_driver_impl[1dc038e5eb65c07]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[41267cda7e919254]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7f09031a3c6c - <std[f235ea7d9a5be936]::sys::thread::unix::Thread>::new::thread_start
  32:     0x7f08fc6981b9 - <unknown>
  33:     0x7f08fc71d21c - <unknown>
  34:                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: rustc 1.97.0-nightly (9128490ab 2026-05-20) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [effective_visibilities] checking effective visibilities
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 1 previous error; 1 warning emitted


@rustbot label +F-lazy_type_alias

Metadata

Metadata

Assignees

No one assigned

    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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions