Skip to content

ICE: 'no entry found for key' when using for<T> T: Copy in current nightly and beta #97836

@jonabit

Description

@jonabit

This little snippet results in an ICE on current nightly and beta in the playground today. On stable there's no such error.

fn a() where for<T> T: Copy { }

Meta

rustc --version --verbose:

rustc 1.63.0-nightly (50b00252a 2022-06-06) running on x86_64-unknown-linux-gnu 

Error output

thread 'rustc' panicked at 'no entry found for key', compiler/rustc_typeck/src/astconv/mod.rs:2411:29 
Backtrace

 Compiling playground v0.0.1 (/playground) error: only lifetime parameters can be used in this context --> src/lib.rs:1:18 | 1 | fn a() where for<T> T: Copy { } | ^ thread 'rustc' panicked at 'no entry found for key', compiler/rustc_typeck/src/astconv/mod.rs:2411:29 stack backtrace: 0: 0x7f9d0406109d - std::backtrace_rs::backtrace::libunwind::trace::h2a8892c156585d66 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f9d0406109d - std::backtrace_rs::backtrace::trace_unsynchronized::h918c401bc86eed40 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f9d0406109d - std::sys_common::backtrace::_print_fmt::h2a52b4cb52dc84fb at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:66:5 3: 0x7f9d0406109d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2f5ce3ea50e5b1d6 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:45:22 4: 0x7f9d040bce2c - core::fmt::write::h48a5b18f44037270 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/core/src/fmt/mod.rs:1196:17 5: 0x7f9d04052791 - std::io::Write::write_fmt::h1d1b08935a2fcf4b at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/io/mod.rs:1654:15 6: 0x7f9d04063d75 - std::sys_common::backtrace::_print::h46d4f4f2d0dbcce0 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:48:5 7: 0x7f9d04063d75 - std::sys_common::backtrace::print::h8334e6fa27a1dde4 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:35:9 8: 0x7f9d04063d75 - std::panicking::default_hook::{{closure}}::hc13c7ff820b0fe22 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/panicking.rs:295:22 9: 0x7f9d04063a96 - std::panicking::default_hook::h100ba67c99329739 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/panicking.rs:314:9 10: 0x7f9d048396c1 - rustc_driver[30390a19e428bc19]::DEFAULT_HOOK::{closure#0}::{closure#0} 11: 0x7f9d0406444a - std::panicking::rust_panic_with_hook::h0a6a04da5fd1d45f at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/panicking.rs:702:17 12: 0x7f9d04064287 - std::panicking::begin_panic_handler::{{closure}}::h55242fd43a581580 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/panicking.rs:588:13 13: 0x7f9d04061554 - std::sys_common::backtrace::__rust_end_short_backtrace::h53771d999c075964 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys_common/backtrace.rs:138:18 14: 0x7f9d04063fb9 - rust_begin_unwind at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/panicking.rs:584:5 15: 0x7f9d04029293 - core::panicking::panic_fmt::h1a17f733294f4ffb at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/core/src/panicking.rs:142:14 16: 0x7f9d040b9a91 - core::panicking::panic_display::h3127402e36de6bfc at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/core/src/panicking.rs:72:5 17: 0x7f9d040b9a3b - core::panicking::panic_str::h4fb624d4350e816b at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/core/src/panicking.rs:56:5 18: 0x7f9d04029106 - core::option::expect_failed::hd19284a870be6eb5 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/core/src/option.rs:1874:5 19: 0x7f9d05daabd6 - <dyn rustc_typeck[a3bfe43d381eec93]::astconv::AstConv>::res_to_ty 20: 0x7f9d05dba54d - <dyn rustc_typeck[a3bfe43d381eec93]::astconv::AstConv>::ast_ty_to_ty_inner 21: 0x7f9d05dd8858 - rustc_typeck[a3bfe43d381eec93]::collect::gather_explicit_predicates_of 22: 0x7f9d05dda2a2 - rustc_typeck[a3bfe43d381eec93]::collect::explicit_predicates_of 23: 0x7f9d063f7bc8 - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::get_query::<rustc_query_impl[51e1f4158b96ee22]::queries::explicit_predicates_of, rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt> 24: 0x7f9d062de1be - <rustc_query_impl[51e1f4158b96ee22]::Queries as rustc_middle[70296c36ca3d2602]::ty::query::QueryEngine>::explicit_predicates_of 25: 0x7f9d05dd715a - rustc_typeck[a3bfe43d381eec93]::collect::predicates_defined_on 26: 0x7f9d063f51be - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::get_query::<rustc_query_impl[51e1f4158b96ee22]::queries::predicates_defined_on, rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt> 27: 0x7f9d062de18e - <rustc_query_impl[51e1f4158b96ee22]::Queries as rustc_middle[70296c36ca3d2602]::ty::query::QueryEngine>::predicates_defined_on 28: 0x7f9d05dd779f - rustc_typeck[a3bfe43d381eec93]::collect::predicates_of 29: 0x7f9d063e1493 - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::get_query::<rustc_query_impl[51e1f4158b96ee22]::queries::predicates_of, rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt> 30: 0x7f9d062dd26e - <rustc_query_impl[51e1f4158b96ee22]::Queries as rustc_middle[70296c36ca3d2602]::ty::query::QueryEngine>::predicates_of 31: 0x7f9d05dce5be - rustc_typeck[a3bfe43d381eec93]::collect::convert_item 32: 0x7f9d05e4c31d - <rustc_middle[70296c36ca3d2602]::hir::map::Map>::deep_visit_item_likes_in_module::<rustc_typeck[a3bfe43d381eec93]::collect::CollectItemTypesVisitor> 33: 0x7f9d06c65a3c - rustc_typeck[a3bfe43d381eec93]::collect::collect_mod_item_types 34: 0x7f9d063b5706 - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::try_execute_query::<rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt, rustc_query_system[c8ac68b744dd57fa]::query::caches::DefaultCache<rustc_span[db009ef5852f774a]::def_id::LocalDefId, ()>> 35: 0x7f9d06f8ddb3 - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::get_query::<rustc_query_impl[51e1f4158b96ee22]::queries::collect_mod_item_types, rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt> 36: 0x7f9d06cae19d - <rustc_middle[70296c36ca3d2602]::hir::map::Map>::for_each_module::<rustc_typeck[a3bfe43d381eec93]::check_crate::{closure#0}::{closure#0}::{closure#0}> 37: 0x7f9d06c88875 - <rustc_session[f622d47d49ca7e5c]::session::Session>::track_errors::<rustc_typeck[a3bfe43d381eec93]::check_crate::{closure#0}, ()> 38: 0x7f9d06c74c80 - rustc_typeck[a3bfe43d381eec93]::check_crate 39: 0x7f9d06a321c7 - rustc_interface[30bf44ec34e2f97]::passes::analysis 40: 0x7f9d06f524ef - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::try_execute_query::<rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt, rustc_query_system[c8ac68b744dd57fa]::query::caches::DefaultCache<(), core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>> 41: 0x7f9d06f99dfe - rustc_query_system[c8ac68b744dd57fa]::query::plumbing::get_query::<rustc_query_impl[51e1f4158b96ee22]::queries::analysis, rustc_query_impl[51e1f4158b96ee22]::plumbing::QueryCtxt> 42: 0x7f9d069ef547 - <rustc_interface[30bf44ec34e2f97]::passes::QueryContext>::enter::<rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>> 43: 0x7f9d069d970f - <rustc_interface[30bf44ec34e2f97]::interface::Compiler>::enter::<rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}::{closure#2}, core[42e67a1b4ba6212c]::result::Result<core[42e67a1b4ba6212c]::option::Option<rustc_interface[30bf44ec34e2f97]::queries::Linker>, rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>> 44: 0x7f9d06a02d5f - rustc_span[db009ef5852f774a]::with_source_map::<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_interface[30bf44ec34e2f97]::interface::create_compiler_and_run<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}>::{closure#1}> 45: 0x7f9d069da5a2 - <scoped_tls[2965e6335b4e6f3e]::ScopedKey<rustc_span[db009ef5852f774a]::SessionGlobals>>::set::<rustc_interface[30bf44ec34e2f97]::interface::run_compiler<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>> 46: 0x7f9d069efbcf - std[41be3fa6aba1786e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[30bf44ec34e2f97]::util::run_in_thread_pool_with_globals<rustc_interface[30bf44ec34e2f97]::interface::run_compiler<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>> 47: 0x7f9d069efd39 - <<std[41be3fa6aba1786e]::thread::Builder>::spawn_unchecked_<rustc_interface[30bf44ec34e2f97]::util::run_in_thread_pool_with_globals<rustc_interface[30bf44ec34e2f97]::interface::run_compiler<core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>, rustc_driver[30390a19e428bc19]::run_compiler::{closure#1}>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>::{closure#0}, core[42e67a1b4ba6212c]::result::Result<(), rustc_errors[e8101b8b045aac39]::ErrorGuaranteed>>::{closure#1} as core[42e67a1b4ba6212c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 48: 0x7f9d0406e373 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha070fd431c3387e9 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/alloc/src/boxed.rs:1951:9 49: 0x7f9d0406e373 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd87ab2d0201316b5 at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/alloc/src/boxed.rs:1951:9 50: 0x7f9d0406e373 - std::sys::unix::thread::Thread::new::thread_start::ha32118aaa6c8a9be at /rustc/50b00252aeb77b10db04d65dc9e12ce758def4b5/library/std/src/sys/unix/thread.rs:108:17 51: 0x7f9d03f94609 - start_thread 52: 0x7f9d03eb7133 - clone 53: 0x0 - <unknown> error: internal compiler error: unexpected panic 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.63.0-nightly (50b00252a 2022-06-06) running on x86_64-unknown-linux-gnu note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [explicit_predicates_of] computing explicit predicates of `a` #1 [predicates_defined_on] computing predicates of `a` #2 [predicates_of] computing predicates of `a` #3 [collect_mod_item_types] collecting item types in top-level module #4 [analysis] running analysis passes on this crate end of query stack error: could not compile `playground` due to previous error 

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions