Closed
Description
I tried this code:
#![feature(const_trait_impl,effects)]
#[const_trait]
pub trait MyTrait {
fn method(&self) -> &&mut &&mut &&'static &&'lower &&
'_ impl 'let;
}
impl const MyTrait for ()
{
fn method(&self)->Option<()> {
Some(()) ? ; None}
}
It mutates from the following code, but the following code will not cause a ICE.
#![feature(const_trait_impl, effects)]
#[const_trait]
pub trait MyTrait {
fn method(&self) -> Option<()>;
}
impl const MyTrait for () {
fn method(&self) -> Option<()> {
Some(())?;
None
}
}
fn main() {}
Meta
rustc 1.85.0-nightly (acabb5248 2024-12-04)
binary: rustc
commit-hash: acabb5248231987ae1f0c215208d1005a5db402d
commit-date: 2024-12-04
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5
Backtrace
error: internal compiler error: compiler/rustc_hir_analysis/src/collect/predicates_of.rs:991:14: const_conditions called on wrong item: DefId(0:12 ~ mutant[8623]::{impl#0}::{synthetic#0})
thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/predicates_of.rs:991:14:
Box<dyn Any>
stack backtrace:
0: 0x72ebf173c5ba - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h0ab6de9a9b46ba40
1: 0x72ebf1e13e66 - core::fmt::write::h786572316278241a
2: 0x72ebf2dd1a51 - std::io::Write::write_fmt::h253c21bff6dc1068
3: 0x72ebf173c412 - std::sys::backtrace::BacktraceLock::print::h72ad191a9e5c3f0c
4: 0x72ebf173e93a - std::panicking::default_hook::{{closure}}::h697ead15ac8858f2
5: 0x72ebf173e783 - std::panicking::default_hook::h36df36946face91c
6: 0x72ebf08b9318 - std[72a4a0de9fece711]::panicking::update_hook::<alloc[272e4c5910fec5b6]::boxed::Box<rustc_driver_impl[e7849dc6dfe13602]::install_ice_hook::{closure#0}>>::{closure#0}
7: 0x72ebf173f0f8 - std::panicking::rust_panic_with_hook::h66ac57f6f29fdfbd
8: 0x72ebf08ee851 - std[72a4a0de9fece711]::panicking::begin_panic::<rustc_errors[798311341c3afec9]::ExplicitBug>::{closure#0}
9: 0x72ebf08e39f6 - std[72a4a0de9fece711]::sys::backtrace::__rust_end_short_backtrace::<std[72a4a0de9fece711]::panicking::begin_panic<rustc_errors[798311341c3afec9]::ExplicitBug>::{closure#0}, !>
10: 0x72ebf08e06fd - std[72a4a0de9fece711]::panicking::begin_panic::<rustc_errors[798311341c3afec9]::ExplicitBug>
11: 0x72ebf08f87f1 - <rustc_errors[798311341c3afec9]::diagnostic::BugAbort as rustc_errors[798311341c3afec9]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x72ebf0edf123 - rustc_middle[b3d98edcda7bf203]::util::bug::opt_span_bug_fmt::<rustc_span[d12ce1794d211847]::span_encoding::Span>::{closure#0}
13: 0x72ebf0ec765a - rustc_middle[b3d98edcda7bf203]::ty::context::tls::with_opt::<rustc_middle[b3d98edcda7bf203]::util::bug::opt_span_bug_fmt<rustc_span[d12ce1794d211847]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x72ebf0ec74eb - rustc_middle[b3d98edcda7bf203]::ty::context::tls::with_context_opt::<rustc_middle[b3d98edcda7bf203]::ty::context::tls::with_opt<rustc_middle[b3d98edcda7bf203]::util::bug::opt_span_bug_fmt<rustc_span[d12ce1794d211847]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x72ebef04ded0 - rustc_middle[b3d98edcda7bf203]::util::bug::bug_fmt
16: 0x72ebf288d420 - rustc_hir_analysis[55059ff4ac40f9b9]::collect::predicates_of::const_conditions
17: 0x72ebf288c234 - rustc_query_impl[e67a967fc473869]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e67a967fc473869]::query_impl::const_conditions::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 24usize]>>
18: 0x72ebf288c1f7 - <rustc_query_impl[e67a967fc473869]::query_impl::const_conditions::dynamic_query::{closure#2} as core[7ca38d3847df487d]::ops::function::FnOnce<(rustc_middle[b3d98edcda7bf203]::ty::context::TyCtxt, rustc_span[d12ce1794d211847]::def_id::DefId)>>::call_once
19: 0x72ebf2032a07 - rustc_query_system[5b88147768c3e99]::query::plumbing::try_execute_query::<rustc_query_impl[e67a967fc473869]::DynamicConfig<rustc_query_system[5b88147768c3e99]::query::caches::DefIdCache<rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[e67a967fc473869]::plumbing::QueryCtxt, false>
20: 0x72ebf22a8446 - rustc_query_impl[e67a967fc473869]::query_impl::const_conditions::get_query_non_incr::__rust_end_short_backtrace
21: 0x72ebf22a86be - rustc_middle[b3d98edcda7bf203]::query::plumbing::query_get_at::<rustc_query_system[5b88147768c3e99]::query::caches::DefIdCache<rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 24usize]>>>
22: 0x72ebf22af6cb - rustc_ty_utils[5fff0bf1c9f138bc]::ty::param_env
23: 0x72ebf22ae01b - rustc_query_impl[e67a967fc473869]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e67a967fc473869]::query_impl::param_env::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 8usize]>>
24: 0x72ebf1e405c8 - rustc_query_system[5b88147768c3e99]::query::plumbing::try_execute_query::<rustc_query_impl[e67a967fc473869]::DynamicConfig<rustc_query_system[5b88147768c3e99]::query::caches::DefIdCache<rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[e67a967fc473869]::plumbing::QueryCtxt, false>
25: 0x72ebf1e400a5 - rustc_query_impl[e67a967fc473869]::query_impl::param_env::get_query_non_incr::__rust_end_short_backtrace
26: 0x72ebf2630d66 - rustc_middle[b3d98edcda7bf203]::query::plumbing::query_get_at::<rustc_query_system[5b88147768c3e99]::query::caches::DefIdCache<rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 8usize]>>>
27: 0x72ebf2631a04 - rustc_hir_analysis[55059ff4ac40f9b9]::check::compare_impl_item::check_type_bounds
28: 0x72ebf288439d - rustc_hir_analysis[55059ff4ac40f9b9]::check::compare_impl_item::compare_impl_item
29: 0x72ebf2881cd1 - rustc_query_impl[e67a967fc473869]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e67a967fc473869]::query_impl::compare_impl_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 1usize]>>
30: 0x72ebf27cb270 - rustc_query_system[5b88147768c3e99]::query::plumbing::try_execute_query::<rustc_query_impl[e67a967fc473869]::DynamicConfig<rustc_data_structures[b7c46475613933cb]::vec_cache::VecCache<rustc_span[d12ce1794d211847]::def_id::LocalDefId, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[5b88147768c3e99]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[e67a967fc473869]::plumbing::QueryCtxt, false>
31: 0x72ebf27cad41 - rustc_query_impl[e67a967fc473869]::query_impl::compare_impl_item::get_query_non_incr::__rust_end_short_backtrace
32: 0x72ebee3b8e46 - rustc_hir_analysis[55059ff4ac40f9b9]::check::check::check_item_type
33: 0x72ebef7f83f4 - rustc_hir_analysis[55059ff4ac40f9b9]::check::wfcheck::check_well_formed
34: 0x72ebf27cafc7 - rustc_query_impl[e67a967fc473869]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e67a967fc473869]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 1usize]>>
35: 0x72ebf27cb288 - rustc_query_system[5b88147768c3e99]::query::plumbing::try_execute_query::<rustc_query_impl[e67a967fc473869]::DynamicConfig<rustc_data_structures[b7c46475613933cb]::vec_cache::VecCache<rustc_span[d12ce1794d211847]::def_id::LocalDefId, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[5b88147768c3e99]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[e67a967fc473869]::plumbing::QueryCtxt, false>
36: 0x72ebf27cafa2 - rustc_query_impl[e67a967fc473869]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
37: 0x72ebf27cbd2c - rustc_hir_analysis[55059ff4ac40f9b9]::check::wfcheck::check_mod_type_wf
38: 0x72ebf27cbb4b - rustc_query_impl[e67a967fc473869]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e67a967fc473869]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 1usize]>>
39: 0x72ebf297d508 - rustc_query_system[5b88147768c3e99]::query::plumbing::try_execute_query::<rustc_query_impl[e67a967fc473869]::DynamicConfig<rustc_query_system[5b88147768c3e99]::query::caches::DefaultCache<rustc_span[d12ce1794d211847]::def_id::LocalModDefId, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e67a967fc473869]::plumbing::QueryCtxt, false>
40: 0x72ebf297d2b0 - rustc_query_impl[e67a967fc473869]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
41: 0x72ebf223c39c - rustc_hir_analysis[55059ff4ac40f9b9]::check_crate
42: 0x72ebf2247284 - rustc_interface[196843e09e80f515]::passes::run_required_analyses
43: 0x72ebf2dc1e9e - rustc_interface[196843e09e80f515]::passes::analysis
44: 0x72ebf2dc1e6f - rustc_query_impl[e67a967fc473869]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e67a967fc473869]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 1usize]>>
45: 0x72ebf2d88efa - rustc_query_system[5b88147768c3e99]::query::plumbing::try_execute_query::<rustc_query_impl[e67a967fc473869]::DynamicConfig<rustc_query_system[5b88147768c3e99]::query::caches::SingleCache<rustc_middle[b3d98edcda7bf203]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e67a967fc473869]::plumbing::QueryCtxt, false>
46: 0x72ebf2d88bce - rustc_query_impl[e67a967fc473869]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
47: 0x72ebf2e70679 - rustc_interface[196843e09e80f515]::interface::run_compiler::<core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>, rustc_driver_impl[e7849dc6dfe13602]::run_compiler::{closure#0}>::{closure#1}
48: 0x72ebf2ca1cc7 - std[72a4a0de9fece711]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[196843e09e80f515]::util::run_in_thread_with_globals<rustc_interface[196843e09e80f515]::util::run_in_thread_pool_with_globals<rustc_interface[196843e09e80f515]::interface::run_compiler<core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>, rustc_driver_impl[e7849dc6dfe13602]::run_compiler::{closure#0}>::{closure#1}, core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>>::{closure#0}, core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>>
49: 0x72ebf2ca1962 - <<std[72a4a0de9fece711]::thread::Builder>::spawn_unchecked_<rustc_interface[196843e09e80f515]::util::run_in_thread_with_globals<rustc_interface[196843e09e80f515]::util::run_in_thread_pool_with_globals<rustc_interface[196843e09e80f515]::interface::run_compiler<core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>, rustc_driver_impl[e7849dc6dfe13602]::run_compiler::{closure#0}>::{closure#1}, core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>>::{closure#0}, core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7ca38d3847df487d]::result::Result<(), rustc_span[d12ce1794d211847]::ErrorGuaranteed>>::{closure#1} as core[7ca38d3847df487d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
50: 0x72ebf2ca10ab - std::sys::pal::unix::thread::Thread::new::thread_start::haeb94917c0a274f1
51: 0x72ebece94ac3 - start_thread
at ./nptl/pthread_create.c:442:8
52: 0x72ebecf26850 - __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
53: 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
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.