-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Description
auto-reduced (treereduce-rust):
trait Trait {}
impl std::ops::Deref for dyn Trait + Send + Sync {
type Type;
fn deref(&self) -> &Self::Target {
self
}
}original:
#![allow(deref_into_dyn_supertrait)]
trait Trait {}
impl std::ops::Deref for dyn Trait + Send + Sync {
type Type;
fn deref(&self) -> &Self::Target {
self
}
}
pub fn main() {}Version information
rustc 1.95.0-nightly (7ad4e69ad 2026-02-12)
binary: rustc
commit-hash: 7ad4e69ad585d8ff214f7b42d01f1959eda08f40
commit-date: 2026-02-12
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
Possibly related line of code:
rust/compiler/rustc_ty_utils/src/layout.rs
Lines 774 to 786 in 7ad4e69
| // Due to trivial bounds, this can even be the case if the alias does not reference | |
| // any generic parameters, e.g. a `for<'a> u32: Trait<'a>` where-bound means that | |
| // `<u32 as Trait<'static>>::Assoc` is rigid. | |
| let err = if ty.has_param() || !cx.typing_env.param_env.caller_bounds().is_empty() { | |
| LayoutError::TooGeneric(ty) | |
| } else { | |
| unreachable!("invalid rigid alias in layout_of after normalization: {ty:?}"); | |
| }; | |
| return Err(error(cx, err)); | |
| } | |
| ty::Bound(..) | ty::CoroutineWitness(..) | ty::Infer(_) | ty::Error(_) => { | |
| // `ty::Error` is handled at the top of this function. |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error: associated type in `impl` without body
--> /tmp/icemaker_global_tempdir.p6FkKwOucVkj/rustc_testrunner_tmpdir_reporting.RpyKPFq1QGKL/mvce.rs:3:5
|
3 | type Type;
| ^^^^^^^^^-
| |
| help: provide a definition for the type: `= <type>;`
error[E0437]: type `Type` is not a member of trait `std::ops::Deref`
--> /tmp/icemaker_global_tempdir.p6FkKwOucVkj/rustc_testrunner_tmpdir_reporting.RpyKPFq1QGKL/mvce.rs:3:5
|
3 | type Type;
| ^^^^^^^^^^ not a member of trait `std::ops::Deref`
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.p6FkKwOucVkj/rustc_testrunner_tmpdir_reporting.RpyKPFq1QGKL/mvce.rs:7:2
|
7 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.p6FkKwOucVkj/rustc_testrunner_tmpdir_reporting.RpyKPFq1QGKL/mvce.rs`
error[E0046]: not all trait items implemented, missing: `Target`
--> /tmp/icemaker_global_tempdir.p6FkKwOucVkj/rustc_testrunner_tmpdir_reporting.RpyKPFq1QGKL/mvce.rs:2:1
|
2 | impl std::ops::Deref for dyn Trait + Send + Sync {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Target` in implementation
|
= help: implement the missing item: `type Target = /* Type */;`
warning: function cannot return without recursing
--> /tmp/icemaker_global_tempdir.p6FkKwOucVkj/rustc_testrunner_tmpdir_reporting.RpyKPFq1QGKL/mvce.rs:4:5
|
4 | fn deref(&self) -> &Self::Target {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
5 | self
| ---- recursive call site
|
= help: a `loop` may express intention better if this is on purpose
= note: `#[warn(unconditional_recursion)]` on by default
thread 'rustc' (3157194) panicked at /rustc-dev/7ad4e69ad585d8ff214f7b42d01f1959eda08f40/compiler/rustc_ty_utils/src/layout.rs:780:17:
internal error: entered unreachable code: invalid rigid alias in layout_of after normalization: Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [dyn [Binder { value: Trait(Trait), bound_vars: [] }, Binder { value: AutoTrait(DefId(2:4011 ~ core[6300]::marker::Sync)), bound_vars: [] }, Binder { value: AutoTrait(DefId(2:39263 ~ core[6300]::marker::Send)), bound_vars: [] }] + '{erased}], def_id: DefId(2:4244 ~ core[6300]::ops::deref::Deref::Target), .. })], def_id: DefId(2:2648 ~ core[6300]::ptr::metadata::Pointee::Metadata), .. })
stack backtrace:
0: 0x7f89ab9cfeeb - <<std[f53f3525626d76c6]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[63005b1ff34d880a]::fmt::Display>::fmt
1: 0x7f89ac011008 - core[63005b1ff34d880a]::fmt::write
2: 0x7f89ab9e7166 - <std[f53f3525626d76c6]::sys::stdio::unix::Stderr as std[f53f3525626d76c6]::io::Write>::write_fmt
3: 0x7f89ab9a5f98 - std[f53f3525626d76c6]::panicking::default_hook::{closure#0}
4: 0x7f89ab9c3353 - std[f53f3525626d76c6]::panicking::default_hook
5: 0x7f89aa98917f - std[f53f3525626d76c6]::panicking::update_hook::<alloc[267fda66f9cf6ea3]::boxed::Box<rustc_driver_impl[95021ce78458dcf0]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f89ab9c3632 - std[f53f3525626d76c6]::panicking::panic_with_hook
7: 0x7f89ab9a6058 - std[f53f3525626d76c6]::panicking::panic_handler::{closure#0}
8: 0x7f89ab99cda9 - std[f53f3525626d76c6]::sys::backtrace::__rust_end_short_backtrace::<std[f53f3525626d76c6]::panicking::panic_handler::{closure#0}, !>
9: 0x7f89ab9a7abd - __rustc[614dc4698d2a5437]::rust_begin_unwind
10: 0x7f89a898aa7c - core[63005b1ff34d880a]::panicking::panic_fmt
11: 0x7f89aca68773 - rustc_ty_utils[50613649f966906c]::layout::layout_of_uncached
12: 0x7f89aca5c4c9 - rustc_ty_utils[50613649f966906c]::layout::layout_of
13: 0x7f89aca5c42b - rustc_query_impl[10f7a8a68f92a57d]::query_impl::layout_of::invoke_provider_fn::__rust_begin_short_backtrace
14: 0x7f89aca5b4c7 - rustc_query_impl[10f7a8a68f92a57d]::execution::try_execute_query::<rustc_query_system[17ecf92d254dad0b]::query::caches::DefaultCache<rustc_middle[1a95194a0eea3ecd]::ty::PseudoCanonicalInput<rustc_middle[1a95194a0eea3ecd]::ty::Ty>, rustc_middle[1a95194a0eea3ecd]::query::erase::ErasedData<[u8; 16usize]>>, {rustc_query_impl[10f7a8a68f92a57d]::QueryFlags { is_anon: false, is_depth_limit: true, is_feedable: false }}, false>
15: 0x7f89aca5b120 - rustc_query_impl[10f7a8a68f92a57d]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
16: 0x7f89aca587fd - <rustc_middle[1a95194a0eea3ecd]::ty::layout::LayoutCx as rustc_middle[1a95194a0eea3ecd]::ty::layout::LayoutOf>::spanned_layout_of
17: 0x7f89aca633bb - rustc_ty_utils[50613649f966906c]::layout::layout_of_uncached
18: 0x7f89aca5c4c9 - rustc_ty_utils[50613649f966906c]::layout::layout_of
19: 0x7f89aca5c42b - rustc_query_impl[10f7a8a68f92a57d]::query_impl::layout_of::invoke_provider_fn::__rust_begin_short_backtrace
20: 0x7f89aca5b4c7 - rustc_query_impl[10f7a8a68f92a57d]::execution::try_execute_query::<rustc_query_system[17ecf92d254dad0b]::query::caches::DefaultCache<rustc_middle[1a95194a0eea3ecd]::ty::PseudoCanonicalInput<rustc_middle[1a95194a0eea3ecd]::ty::Ty>, rustc_middle[1a95194a0eea3ecd]::query::erase::ErasedData<[u8; 16usize]>>, {rustc_query_impl[10f7a8a68f92a57d]::QueryFlags { is_anon: false, is_depth_limit: true, is_feedable: false }}, false>
21: 0x7f89aca5b120 - rustc_query_impl[10f7a8a68f92a57d]::query_impl::layout_of::get_query_non_incr::__rust_end_short_backtrace
22: 0x7f89ac8b6c14 - <rustc_mir_transform[5451c692c702c486]::known_panics_lint::KnownPanicsLint as rustc_mir_transform[5451c692c702c486]::pass_manager::MirLint>::run_lint
23: 0x7f89ac00c7de - rustc_mir_transform[5451c692c702c486]::run_analysis_to_runtime_passes
24: 0x7f89acdbe043 - rustc_mir_transform[5451c692c702c486]::mir_drops_elaborated_and_const_checked
25: 0x7f89acdbda61 - rustc_query_impl[10f7a8a68f92a57d]::query_impl::mir_drops_elaborated_and_const_checked::invoke_provider_fn::__rust_begin_short_backtrace
26: 0x7f89ac966fbe - rustc_query_impl[10f7a8a68f92a57d]::execution::try_execute_query::<rustc_data_structures[535dce0c24e19f83]::vec_cache::VecCache<rustc_span[5bf5bc21591a61e7]::def_id::LocalDefId, rustc_middle[1a95194a0eea3ecd]::query::erase::ErasedData<[u8; 8usize]>, rustc_query_system[17ecf92d254dad0b]::dep_graph::graph::DepNodeIndex>, {rustc_query_impl[10f7a8a68f92a57d]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
27: 0x7f89ac966949 - rustc_query_impl[10f7a8a68f92a57d]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
28: 0x7f89ac965e6a - <rustc_middle[1a95194a0eea3ecd]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[ad34f891b4298da9]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
29: 0x7f89ac962b94 - rustc_interface[ad34f891b4298da9]::passes::analysis
30: 0x7f89ad242aa0 - rustc_query_impl[10f7a8a68f92a57d]::execution::try_execute_query::<rustc_query_system[17ecf92d254dad0b]::query::caches::SingleCache<rustc_middle[1a95194a0eea3ecd]::query::erase::ErasedData<[u8; 0usize]>>, {rustc_query_impl[10f7a8a68f92a57d]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
31: 0x7f89ad242876 - rustc_query_impl[10f7a8a68f92a57d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
32: 0x7f89ad40b127 - <rustc_interface[ad34f891b4298da9]::passes::create_and_enter_global_ctxt<core[63005b1ff34d880a]::option::Option<rustc_interface[ad34f891b4298da9]::queries::Linker>, rustc_driver_impl[95021ce78458dcf0]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[63005b1ff34d880a]::ops::function::FnOnce<(&rustc_session[7ece96c854892e00]::session::Session, rustc_middle[1a95194a0eea3ecd]::ty::context::CurrentGcx, alloc[267fda66f9cf6ea3]::sync::Arc<rustc_data_structures[535dce0c24e19f83]::jobserver::Proxy>, &std[f53f3525626d76c6]::sync::once_lock::OnceLock<rustc_middle[1a95194a0eea3ecd]::ty::context::GlobalCtxt>, &rustc_data_structures[535dce0c24e19f83]::sync::worker_local::WorkerLocal<rustc_middle[1a95194a0eea3ecd]::arena::Arena>, &rustc_data_structures[535dce0c24e19f83]::sync::worker_local::WorkerLocal<rustc_hir[2a8a32ee992fbba]::Arena>, rustc_driver_impl[95021ce78458dcf0]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
33: 0x7f89ad1f9bf7 - rustc_interface[ad34f891b4298da9]::interface::run_compiler::<(), rustc_driver_impl[95021ce78458dcf0]::run_compiler::{closure#0}>::{closure#1}
34: 0x7f89ad224cbe - std[f53f3525626d76c6]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ad34f891b4298da9]::util::run_in_thread_with_globals<rustc_interface[ad34f891b4298da9]::util::run_in_thread_pool_with_globals<rustc_interface[ad34f891b4298da9]::interface::run_compiler<(), rustc_driver_impl[95021ce78458dcf0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
35: 0x7f89ad2251e0 - <std[f53f3525626d76c6]::thread::lifecycle::spawn_unchecked<rustc_interface[ad34f891b4298da9]::util::run_in_thread_with_globals<rustc_interface[ad34f891b4298da9]::util::run_in_thread_pool_with_globals<rustc_interface[ad34f891b4298da9]::interface::run_compiler<(), rustc_driver_impl[95021ce78458dcf0]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[63005b1ff34d880a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
36: 0x7f89ad22606c - <std[f53f3525626d76c6]::sys::thread::unix::Thread>::new::thread_start
37: 0x7f89a6a9698b - <unknown>
38: 0x7f89a6b1a9cc - <unknown>
39: 0x0 - <unknown>
error: the compiler unexpectedly panicked. This is a bug
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.95.0-nightly (7ad4e69ad 2026-02-12) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [layout_of] computing layout of `<<dyn Trait + core::marker::Send + core::marker::Sync as core::ops::deref::Deref>::Target as core::ptr::metadata::Pointee>::Metadata`
#1 [layout_of] computing layout of `&<dyn Trait + core::marker::Send + core::marker::Sync as core::ops::deref::Deref>::Target`
#2 [mir_drops_elaborated_and_const_checked] elaborating drops for `<impl at /tmp/icemaker_global_tempdir.p6FkKwOucVkj/rustc_testrunner_tmpdir_reporting.RpyKPFq1QGKL/mvce.rs:2:1: 2:49>::deref`
#3 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0046, E0437, E0601.
For more information about an error, try `rustc --explain E0046`.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.