- Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)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) ❄️T-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.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
https://github.com/rust-lang/rust/pull/81172/files
was reading this and trying to test how unions work with generics, and got an ICE
removing the union causes the ICE to NOT trigger
Code
#[repr(C)] union PtrRepr<T: ?Sized> { const_ptr: *const T, mut_ptr: *mut T, components: PtrComponents<T>, } #[repr(C)] struct PtrComponents<T: Pointee + ?Sized> { data_address: *const (), metadata: <T as Pointee>::Metadata, } pub trait Pointee { type Metadata; }Meta
rustc --version --verbose:
1.49 (playground Error output
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: 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: rustc 1.49.0 (e1884a8e3 2020-12-29) running on x86_64-unknown-linux-gnu note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [normalize_generic_arg_after_erasing_regions] normalizing `<T as Pointee>::Metadata` #1 [needs_drop_raw] computing whether `PtrComponents<T>` needs drop end of query stack error: aborting due to previous error error: could not compile `playground` To learn more, run the command again with --verbose. Backtrace
thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9 stack backtrace: 0: std::panicking::begin_panic 1: rustc_errors::HandlerInner::bug 2: rustc_errors::Handler::bug 3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}} 4: rustc_middle::ty::context::tls::with_opt::{{closure}} 5: rustc_middle::ty::context::tls::with_opt 6: rustc_middle::util::bug::opt_span_bug_fmt 7: rustc_middle::util::bug::bug_fmt 8: rustc_infer::infer::InferCtxtBuilder::enter 9: rustc_traits::normalize_erasing_regions::normalize_generic_arg_after_erasing_regions 10: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 11: rustc_data_structures::stack::ensure_sufficient_stack 12: rustc_query_system::query::plumbing::get_query_impl 13: <rustc_middle::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle::ty::fold::TypeFolder>::fold_ty 14: rustc_ty::needs_drop::needs_drop_raw 15: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::needs_drop_raw>::compute 16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 17: rustc_data_structures::stack::ensure_sufficient_stack 18: rustc_query_system::query::plumbing::get_query_impl 19: <rustc_passes::stability::Checker as rustc_hir::intravisit::Visitor>::visit_item 20: rustc_middle::hir::map::Map::visit_item_likes_in_module 21: rustc_passes::stability::check_mod_unstable_api_usage 22: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_unstable_api_usage>::compute 23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 24: rustc_data_structures::stack::ensure_sufficient_stack 25: rustc_query_system::query::plumbing::get_query_impl 26: rustc_query_system::query::plumbing::ensure_query_impl 27: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once 28: rustc_session::utils::<impl rustc_session::session::Session>::time 29: rustc_interface::passes::analysis 30: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute 31: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl 32: rustc_data_structures::stack::ensure_sufficient_stack 33: rustc_query_system::query::plumbing::get_query_impl 34: rustc_interface::passes::QueryContext::enter 35: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter 36: rustc_span::with_source_map 37: rustc_interface::interface::create_compiler_and_run 38: rustc_span::with_session_globals Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)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) ❄️T-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.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.