-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed
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-criticalCritical priorityCritical 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-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Description
auto-reduced (treereduce-rust):
type TraitObject = dyn Sync;
struct Wrap(TraitObject);
fn cast(x: *mut TraitObject) {
x as *mut Wrap;
}original:
//@ check-pass
trait Trait {
type Associated;
}
impl Trait for i32 {
type Associated = i64;
}
trait Generic<T> {}
type TraitObject = dyn Sync;
struct Wrap(TraitObject);
fn cast(x: *mut TraitObject) {
x as *mut Wrap;
}
fn main() {}Version information
rustc 1.94.0-nightly (50d59402b 2026-01-03)
binary: rustc
commit-hash: 50d59402bfb82a7fcdf542ed418affe425ff867e
commit-date: 2026-01-03
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8
Possibly related line of code:
rust/compiler/rustc_middle/src/ty/region.rs
Lines 323 to 335 in 50d5940
| matches!(self.kind(), ty::ReVar(_)) | |
| } | |
| pub fn as_var(self) -> RegionVid { | |
| match self.kind() { | |
| ty::ReVar(vid) => vid, | |
| _ => bug!("expected region {:?} to be of kind ReVar", self), | |
| } | |
| } | |
| /// Given some item `binding_item`, check if this region is a generic parameter introduced by it | |
| /// or one of the parent generics. Returns the `DefId` of the parameter definition if so. | |
| pub fn opt_param_def_id(self, tcx: TyCtxt<'tcx>, binding_item: DefId) -> Option<DefId> { |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.oycHALS4IOkc/rustc_testrunner_tmpdir_reporting.ZDChfUVNop4P/mvce.rs:7:2
|
7 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.oycHALS4IOkc/rustc_testrunner_tmpdir_reporting.ZDChfUVNop4P/mvce.rs`
error: internal compiler error: /rustc-dev/50d59402bfb82a7fcdf542ed418affe425ff867e/compiler/rustc_middle/src/ty/region.rs:329:18: expected region 'static to be of kind ReVar
thread 'rustc' (24193) panicked at /rustc-dev/50d59402bfb82a7fcdf542ed418affe425ff867e/compiler/rustc_middle/src/ty/region.rs:329:18:
Box<dyn Any>
stack backtrace:
0: 0x7f891d4328f3 - <<std[730d7555552d47c8]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[877f3b0911fa72ec]::fmt::Display>::fmt
1: 0x7f891da0e348 - core[877f3b0911fa72ec]::fmt::write
2: 0x7f891d449016 - <std[730d7555552d47c8]::sys::stdio::unix::Stderr as std[730d7555552d47c8]::io::Write>::write_fmt
3: 0x7f891d4090e8 - std[730d7555552d47c8]::panicking::default_hook::{closure#0}
4: 0x7f891d426833 - std[730d7555552d47c8]::panicking::default_hook
5: 0x7f891c40ef5a - std[730d7555552d47c8]::panicking::update_hook::<alloc[3a018aa203959276]::boxed::Box<rustc_driver_impl[8eab3669a7d4ca59]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7f891d426b12 - std[730d7555552d47c8]::panicking::panic_with_hook
7: 0x7f891c44bf41 - std[730d7555552d47c8]::panicking::begin_panic::<rustc_errors[320084ff728c29dc]::ExplicitBug>::{closure#0}
8: 0x7f891c43c476 - std[730d7555552d47c8]::sys::backtrace::__rust_end_short_backtrace::<std[730d7555552d47c8]::panicking::begin_panic<rustc_errors[320084ff728c29dc]::ExplicitBug>::{closure#0}, !>
9: 0x7f891c439a0c - std[730d7555552d47c8]::panicking::begin_panic::<rustc_errors[320084ff728c29dc]::ExplicitBug>
10: 0x7f891c469de1 - <rustc_errors[320084ff728c29dc]::diagnostic::BugAbort as rustc_errors[320084ff728c29dc]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7f891ca180e9 - rustc_middle[b7c8bbfe634a1524]::util::bug::opt_span_bug_fmt::<rustc_span[266f76f4beb07170]::span_encoding::Span>::{closure#0}
12: 0x7f891ca18272 - rustc_middle[b7c8bbfe634a1524]::ty::context::tls::with_opt::<rustc_middle[b7c8bbfe634a1524]::util::bug::opt_span_bug_fmt<rustc_span[266f76f4beb07170]::span_encoding::Span>::{closure#0}, !>::{closure#0}
13: 0x7f891ca0989b - rustc_middle[b7c8bbfe634a1524]::ty::context::tls::with_context_opt::<rustc_middle[b7c8bbfe634a1524]::ty::context::tls::with_opt<rustc_middle[b7c8bbfe634a1524]::util::bug::opt_span_bug_fmt<rustc_span[266f76f4beb07170]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
14: 0x7f891a53faf4 - rustc_middle[b7c8bbfe634a1524]::util::bug::bug_fmt
15: 0x7f891f9f88e9 - <rustc_middle[b7c8bbfe634a1524]::ty::region::Region>::as_var.cold
16: 0x7f891e86a51d - <rustc_borrowck[710768fa0e5030b6]::type_check::TypeChecker as rustc_middle[b7c8bbfe634a1524]::mir::visit::Visitor>::visit_body
17: 0x7f891e81d3ac - rustc_borrowck[710768fa0e5030b6]::type_check::type_check
18: 0x7f891e90c68c - <rustc_borrowck[710768fa0e5030b6]::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
19: 0x7f891e905ad0 - rustc_query_impl[4371051198203ad5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4371051198203ad5]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b7c8bbfe634a1524]::query::erase::Erased<[u8; 8usize]>>
20: 0x7f891dc8fa77 - rustc_query_system[64fea02dfcda5c73]::query::plumbing::try_execute_query::<rustc_query_impl[4371051198203ad5]::DynamicConfig<rustc_data_structures[69e288f336e3affd]::vec_cache::VecCache<rustc_span[266f76f4beb07170]::def_id::LocalDefId, rustc_middle[b7c8bbfe634a1524]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[64fea02dfcda5c73]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[4371051198203ad5]::plumbing::QueryCtxt, false>
21: 0x7f891e9009d9 - rustc_query_impl[4371051198203ad5]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
22: 0x7f891e900bf7 - <rustc_middle[b7c8bbfe634a1524]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[fb6a287a72e6bfde]::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
23: 0x7f891e8fe64a - rustc_interface[fb6a287a72e6bfde]::passes::analysis
24: 0x7f891e8fda75 - rustc_query_impl[4371051198203ad5]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4371051198203ad5]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b7c8bbfe634a1524]::query::erase::Erased<[u8; 0usize]>>
25: 0x7f891ec0d166 - rustc_query_system[64fea02dfcda5c73]::query::plumbing::try_execute_query::<rustc_query_impl[4371051198203ad5]::DynamicConfig<rustc_query_system[64fea02dfcda5c73]::query::caches::SingleCache<rustc_middle[b7c8bbfe634a1524]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[4371051198203ad5]::plumbing::QueryCtxt, false>
26: 0x7f891ec0cd36 - rustc_query_impl[4371051198203ad5]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
27: 0x7f891edb0a51 - <rustc_interface[fb6a287a72e6bfde]::passes::create_and_enter_global_ctxt<core[877f3b0911fa72ec]::option::Option<rustc_interface[fb6a287a72e6bfde]::queries::Linker>, rustc_driver_impl[8eab3669a7d4ca59]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[877f3b0911fa72ec]::ops::function::FnOnce<(&rustc_session[2d8187b2cd630bc8]::session::Session, rustc_middle[b7c8bbfe634a1524]::ty::context::CurrentGcx, alloc[3a018aa203959276]::sync::Arc<rustc_data_structures[69e288f336e3affd]::jobserver::Proxy>, &std[730d7555552d47c8]::sync::once_lock::OnceLock<rustc_middle[b7c8bbfe634a1524]::ty::context::GlobalCtxt>, &rustc_data_structures[69e288f336e3affd]::sync::worker_local::WorkerLocal<rustc_middle[b7c8bbfe634a1524]::arena::Arena>, &rustc_data_structures[69e288f336e3affd]::sync::worker_local::WorkerLocal<rustc_hir[351243de8ff3631d]::Arena>, rustc_driver_impl[8eab3669a7d4ca59]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
28: 0x7f891ec7bb18 - rustc_interface[fb6a287a72e6bfde]::interface::run_compiler::<(), rustc_driver_impl[8eab3669a7d4ca59]::run_compiler::{closure#0}>::{closure#1}
29: 0x7f891eb2198e - std[730d7555552d47c8]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[fb6a287a72e6bfde]::util::run_in_thread_with_globals<rustc_interface[fb6a287a72e6bfde]::util::run_in_thread_pool_with_globals<rustc_interface[fb6a287a72e6bfde]::interface::run_compiler<(), rustc_driver_impl[8eab3669a7d4ca59]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
30: 0x7f891eb21760 - <std[730d7555552d47c8]::thread::lifecycle::spawn_unchecked<rustc_interface[fb6a287a72e6bfde]::util::run_in_thread_with_globals<rustc_interface[fb6a287a72e6bfde]::util::run_in_thread_pool_with_globals<rustc_interface[fb6a287a72e6bfde]::interface::run_compiler<(), rustc_driver_impl[8eab3669a7d4ca59]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[877f3b0911fa72ec]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
31: 0x7f891eb1fb38 - <std[730d7555552d47c8]::sys::thread::unix::Thread>::new::thread_start
32: 0x7f891849698b - <unknown>
33: 0x7f891851a9cc - <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.94.0-nightly (50d59402b 2026-01-03) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_borrowck] borrow-checking `cast`
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0601`.
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-criticalCritical priorityCritical 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-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.