-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed as duplicate of#149277
Closed as duplicate of#149277
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-auto_traits`#![feature(auto_traits)]``#![feature(auto_traits)]`F-negative_impls#![feature(negative_impls)]#![feature(negative_impls)]I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
I tried this code:
#![feature(auto_traits, extern_types, negative_impls)]
#![allow(incomplete_features)]
trait PointeeSized {}
auto trait Leak {}
extern "C" {
type atype;
}
impl !Leak for atype {}
fn foo<V>(_: &V)
where
V: PointeeSized,
{
}
fn forward(z: &atype) {
foo(z);
}
fn main() {}I expected to see this happen: The compiler should emit a standard compilation error stating that atype does not satisfy the PointeeSized bound, or compile successfully if appropriate. It should not panic.
Instead, this happened: The compiler panicked with an Internal Compiler Error (ICE).
Meta
rustc --version --verbose:
rustc 1.94.0-nightly (e29fcf45e 2026-01-04)
binary: rustc
commit-hash: e29fcf45e4ae686d77b490bf07320f0d3a2cf35f
commit-date: 2026-01-04
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 19.1.6
Backtrace
thread 'rustc' panicked at /rustc-dev/e29fcf45e4ae686d77b490bf07320f0d3a2cf35f/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs:106:21:
Box<dyn Any>
stack backtrace:
0: 0x7f3aac419c0b - <std[eaa43e369792efb9]::backtrace::Backtrace>::create
1: 0x7f3aac419b55 - <std[eaa43e369792efb9]::backtrace::Backtrace>::force_capture
2: 0x7f3aab4115b7 - std[eaa43e369792efb9]::panicking::update_hook::<alloc[83e7320d2ee5a6b1]::boxed::Box<rustc_driver_impl[5af842e777d449e6]::install_ice_hook::{closure#1}>>::{closure#0}
3: 0x7f3aac42c4b2 - std[eaa43e369792efb9]::panicking::panic_with_hook
4: 0x7f3aab44de81 - std[eaa43e369792efb9]::panicking::begin_panic::<rustc_errors[3cfa44cd230a06eb]::ExplicitBug>::{closure#0}
5: 0x7f3aab43e4e6 - std[eaa43e369792efb9]::sys::backtrace::__rust_end_short_backtrace::<std[eaa43e369792efb9]::panicking::begin_panic<rustc_errors[3cfa44cd230a06eb]::ExplicitBug>::{closure#0}, !>
6: 0x7f3aab43e11c - std[eaa43e369792efb9]::panicking::begin_panic::<rustc_errors[3cfa44cd230a06eb]::ExplicitBug>
7: 0x7f3aab46bd21 - <rustc_errors[3cfa44cd230a06eb]::diagnostic::BugAbort as rustc_errors[3cfa44cd230a06eb]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
8: 0x7f3aaba19ea9 - rustc_middle[829e5443847148d]::util::bug::opt_span_bug_fmt::<rustc_span[14443e5baae9ab13]::span_encoding::Span>::{closure#0}
9: 0x7f3aaba1a032 - rustc_middle[829e5443847148d]::ty::context::tls::with_opt::<rustc_middle[829e5443847148d]::util::bug::opt_span_bug_fmt<rustc_span[14443e5baae9ab13]::span_encoding::Span>::{closure#0}, !>::{closure#0}
10: 0x7f3aaba0b65b - rustc_middle[829e5443847148d]::ty::context::tls::with_context_opt::<rustc_middle[829e5443847148d]::ty::context::tls::with_opt<rustc_middle[829e5443847148d]::util::bug::opt_span_bug_fmt<rustc_span[14443e5baae9ab13]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
11: 0x7f3aa9463aa4 - rustc_middle[829e5443847148d]::util::bug::bug_fmt
12: 0x7f3aad4c065c - <rustc_trait_selection[feb4a4f4d9146cdf]::traits::select::SelectionContext>::assemble_candidates
13: 0x7f3aad4b480b - <rustc_trait_selection[feb4a4f4d9146cdf]::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}
14: 0x7f3aad4a72c4 - <rustc_trait_selection[feb4a4f4d9146cdf]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
15: 0x7f3aacaa0a18 - <rustc_trait_selection[feb4a4f4d9146cdf]::traits::select::SelectionContext>::evaluate_root_obligation
16: 0x7f3aaca9ecac - rustc_traits[534f555eb2fc85c1]::evaluate_obligation::evaluate_obligation
17: 0x7f3aaca9e5e9 - rustc_query_impl[1b717c0605046cd0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1b717c0605046cd0]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[829e5443847148d]::query::erase::Erased<[u8; 2usize]>>
18: 0x7f3aaca9d7a1 - rustc_query_system[5c35911b3dd767e9]::query::plumbing::try_execute_query::<rustc_query_impl[1b717c0605046cd0]::DynamicConfig<rustc_query_system[5c35911b3dd767e9]::query::caches::DefaultCache<rustc_type_ir[241df8ba430ad1e5]::canonical::CanonicalQueryInput<rustc_middle[829e5443847148d]::ty::context::TyCtxt, rustc_middle[829e5443847148d]::ty::ParamEnvAnd<rustc_middle[829e5443847148d]::ty::predicate::Predicate>>, rustc_middle[829e5443847148d]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[1b717c0605046cd0]::plumbing::QueryCtxt, false>
19: 0x7f3aaca9d3f1 - rustc_query_impl[1b717c0605046cd0]::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
20: 0x7f3aad381f5a - <rustc_infer[de7e637fb9d30ade]::infer::InferCtxt as rustc_trait_selection[feb4a4f4d9146cdf]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
21: 0x7f3aac1c5f88 - <core[4141bff0bf9ca9dd]::iter::adapters::flatten::FlattenCompat<_, _> as core[4141bff0bf9ca9dd]::iter::traits::iterator::Iterator>::try_fold::flatten::<core[4141bff0bf9ca9dd]::iter::adapters::copied::Copied<core[4141bff0bf9ca9dd]::slice::iter::Iter<rustc_span[14443e5baae9ab13]::def_id::DefId>>, (), core[4141bff0bf9ca9dd]::ops::control_flow::ControlFlow<rustc_span[14443e5baae9ab13]::def_id::DefId>, core[4141bff0bf9ca9dd]::iter::traits::iterator::Iterator::find::check<rustc_span[14443e5baae9ab13]::def_id::DefId, <rustc_trait_selection[feb4a4f4d9146cdf]::error_reporting::TypeErrCtxt>::check_same_name_different_path::{closure#1}>::{closure#0}>::{closure#0}
22: 0x7f3aac1c4a3c - core[4141bff0bf9ca9dd]::iter::adapters::map::map_try_fold::<rustc_span[14443e5baae9ab13]::def_id::CrateNum, core[4141bff0bf9ca9dd]::iter::adapters::copied::Copied<core[4141bff0bf9ca9dd]::slice::iter::Iter<rustc_span[14443e5baae9ab13]::def_id::DefId>>, (), core[4141bff0bf9ca9dd]::ops::control_flow::ControlFlow<rustc_span[14443e5baae9ab13]::def_id::DefId>, <rustc_middle[829e5443847148d]::ty::context::TyCtxt>::all_traits_including_private::{closure#0}, <core[4141bff0bf9ca9dd]::iter::adapters::flatten::FlattenCompat<_, _>>::iter_try_fold::flatten<core[4141bff0bf9ca9dd]::iter::adapters::copied::Copied<core[4141bff0bf9ca9dd]::slice::iter::Iter<rustc_span[14443e5baae9ab13]::def_id::DefId>>, (), core[4141bff0bf9ca9dd]::ops::control_flow::ControlFlow<rustc_span[14443e5baae9ab13]::def_id::DefId>, <core[4141bff0bf9ca9dd]::iter::adapters::flatten::FlattenCompat<_, _> as core[4141bff0bf9ca9dd]::iter::traits::iterator::Iterator>::try_fold::flatten<core[4141bff0bf9ca9dd]::iter::adapters::copied::Copied<core[4141bff0bf9ca9dd]::slice::iter::Iter<rustc_span[14443e5baae9ab13]::def_id::DefId>>, (), core[4141bff0bf9ca9dd]::ops::control_flow::ControlFlow<rustc_span[14443e5baae9ab13]::def_id::DefId>, core[4141bff0bf9ca9dd]::iter::traits::iterator::Iterator::find::check<rustc_span[14443e5baae9ab13]::def_id::DefId, <rustc_trait_selection[feb4a4f4d9146cdf]::error_reporting::TypeErrCtxt>::check_same_name_different_path::{closure#1}>::{closure#0}>::{closure#0}>::{closure#0}>::{closure#0}
23: 0x7f3aac2259d8 - <rustc_trait_selection[feb4a4f4d9146cdf]::error_reporting::TypeErrCtxt>::note_different_trait_with_same_name
24: 0x7f3aac206f67 - <rustc_trait_selection[feb4a4f4d9146cdf]::error_reporting::TypeErrCtxt>::report_selection_error
25: 0x7f3aaad4711e - <rustc_trait_selection[feb4a4f4d9146cdf]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
26: 0x7f3aace6702d - <rustc_hir_typeck[d22ab1ec3d18caa2]::fn_ctxt::FnCtxt>::check_expr_call
27: 0x7f3aace3cd5a - <rustc_hir_typeck[d22ab1ec3d18caa2]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
28: 0x7f3aace37e42 - <rustc_hir_typeck[d22ab1ec3d18caa2]::fn_ctxt::FnCtxt>::check_expr_block
29: 0x7f3aace3cd01 - <rustc_hir_typeck[d22ab1ec3d18caa2]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
30: 0x7f3aace1d405 - rustc_hir_typeck[d22ab1ec3d18caa2]::check::check_fn
31: 0x7f3aad6f8973 - rustc_hir_typeck[d22ab1ec3d18caa2]::typeck_with_inspect::{closure#0}
32: 0x7f3aad6f72f4 - rustc_query_impl[1b717c0605046cd0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1b717c0605046cd0]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[829e5443847148d]::query::erase::Erased<[u8; 8usize]>>
33: 0x7f3aacc3e337 - rustc_query_system[5c35911b3dd767e9]::query::plumbing::try_execute_query::<rustc_query_impl[1b717c0605046cd0]::DynamicConfig<rustc_data_structures[4e9b1f6e439fd3ef]::vec_cache::VecCache<rustc_span[14443e5baae9ab13]::def_id::LocalDefId, rustc_middle[829e5443847148d]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[5c35911b3dd767e9]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[1b717c0605046cd0]::plumbing::QueryCtxt, false>
34: 0x7f3aacc3dc09 - rustc_query_impl[1b717c0605046cd0]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
35: 0x7f3aad470ead - <rustc_middle[829e5443847148d]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[37999fc34f267976]::check_crate::{closure#2}>::{closure#0}
36: 0x7f3aad4708a1 - rustc_hir_analysis[37999fc34f267976]::check_crate
37: 0x7f3aad94a19b - rustc_interface[eaf9095e0de5b742]::passes::analysis
38: 0x7f3aad949df5 - rustc_query_impl[1b717c0605046cd0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1b717c0605046cd0]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[829e5443847148d]::query::erase::Erased<[u8; 0usize]>>
39: 0x7f3aadbe57a6 - rustc_query_system[5c35911b3dd767e9]::query::plumbing::try_execute_query::<rustc_query_impl[1b717c0605046cd0]::DynamicConfig<rustc_query_system[5c35911b3dd767e9]::query::caches::SingleCache<rustc_middle[829e5443847148d]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[1b717c0605046cd0]::plumbing::QueryCtxt, false>
40: 0x7f3aadbe5376 - rustc_query_impl[1b717c0605046cd0]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
41: 0x7f3aadd95cd1 - <rustc_interface[eaf9095e0de5b742]::passes::create_and_enter_global_ctxt<core[4141bff0bf9ca9dd]::option::Option<rustc_interface[eaf9095e0de5b742]::queries::Linker>, rustc_driver_impl[5af842e777d449e6]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[4141bff0bf9ca9dd]::ops::function::FnOnce<(&rustc_session[ea1eec3ed26e42d5]::session::Session, rustc_middle[829e5443847148d]::ty::context::CurrentGcx, alloc[83e7320d2ee5a6b1]::sync::Arc<rustc_data_structures[4e9b1f6e439fd3ef]::jobserver::Proxy>, &std[eaa43e369792efb9]::sync::once_lock::OnceLock<rustc_middle[829e5443847148d]::ty::context::GlobalCtxt>, &rustc_data_structures[4e9b1f6e439fd3ef]::sync::worker_local::WorkerLocal<rustc_middle[829e5443847148d]::arena::Arena>, &rustc_data_structures[4e9b1f6e439fd3ef]::sync::worker_local::WorkerLocal<rustc_hir[67c6535075053fb5]::Arena>, rustc_driver_impl[5af842e777d449e6]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
42: 0x7f3aadc6e398 - rustc_interface[eaf9095e0de5b742]::interface::run_compiler::<(), rustc_driver_impl[5af842e777d449e6]::run_compiler::{closure#0}>::{closure#1}
43: 0x7f3aadaf7e8e - std[eaa43e369792efb9]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[eaf9095e0de5b742]::util::run_in_thread_with_globals<rustc_interface[eaf9095e0de5b742]::util::run_in_thread_pool_with_globals<rustc_interface[eaf9095e0de5b742]::interface::run_compiler<(), rustc_driver_impl[5af842e777d449e6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
44: 0x7f3aadaf7c60 - <std[eaa43e369792efb9]::thread::lifecycle::spawn_unchecked<rustc_interface[eaf9095e0de5b742]::util::run_in_thread_with_globals<rustc_interface[eaf9095e0de5b742]::util::run_in_thread_pool_with_globals<rustc_interface[eaf9095e0de5b742]::interface::run_compiler<(), rustc_driver_impl[5af842e777d449e6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[4141bff0bf9ca9dd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
45: 0x7f3aadaf6038 - <std[eaa43e369792efb9]::sys::thread::unix::Thread>::new::thread_start
46: 0x7f3aa7494ac3 - start_thread
at ./nptl/pthread_create.c:442:8
47: 0x7f3aa75268c0 - __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0
48: 0x0 - <unknown>
rustc version: 1.94.0-nightly (e29fcf45e 2026-01-04)
platform: x86_64-unknown-linux-gnu
query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `atype: core::marker::PointeeSized`
#1 [typeck] type-checking `forward`
#2 [analysis] running analysis passes on crate `bug2`
end of query stack
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-auto_traits`#![feature(auto_traits)]``#![feature(auto_traits)]`F-negative_impls#![feature(negative_impls)]#![feature(negative_impls)]I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.