Closed as not planned
Closed as not planned
Description
Code
src/test/ui/issues/issue-39292.rs
// run-pass
// Regression test for issue #39292. The object vtable was being
// incorrectly left with a null pointer.
trait Foo<T> {
fn print<'a>(&'a self) where T: 'a { println!("foo"); }
}
impl<'a> Foo<&'a ()> for () { }
trait Bar: for<'a> Foo<&'a ()> { }
impl Bar for () {}
fn main() {
(&() as &dyn Bar).print(); // Segfault
}
Meta
rustc --version --verbose
:
rustc 1.67.0-nightly (32e613bba 2022-12-02)
binary: rustc
commit-hash: 32e613bbaafee1bcabba48a2257b838f8d1c03d3
commit-date: 2022-12-02
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4
Error output
rustc src/test/ui/issues/issue-39292.rs -Zpolymorphize=on
<output>
Backtrace
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:786:54: collection encountered polymorphic constant: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:5 ~ issue_39292[a2ad]::Foo::print), const_param_did: None }, substs: [(), T, ReErased], promoted: Some(promoted[1]) }, &[&str; 1])
--> src/test/ui/issues/issue-39292.rs:6:51
|
6 | fn print<'a>(&'a self) where T: 'a { println!("foo"); }
| ^^^^^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/compiler/rustc_errors/src/lib.rs:972:33
stack backtrace:
0: 0x7ff11c464a5a - std::backtrace_rs::backtrace::libunwind::trace::h445f1a380ebe24fa
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7ff11c464a5a - std::backtrace_rs::backtrace::trace_unsynchronized::h8c542444dc84bbad
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7ff11c464a5a - std::sys_common::backtrace::_print_fmt::hd1e3793b0f95c644
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7ff11c464a5a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h515025d5c2825d78
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7ff11c8efe4e - core::fmt::write::hfd15a46634ae3152
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/core/src/fmt/mod.rs:1208:17
5: 0x7ff11c458cc5 - std::io::Write::write_fmt::h74b2e38eb2a622bf
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/io/mod.rs:1682:15
6: 0x7ff11c464825 - std::sys_common::backtrace::_print::hd2af8aafbe5d4e4d
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/sys_common/backtrace.rs:47:5
7: 0x7ff11c464825 - std::sys_common::backtrace::print::hc83e0ce2c452dd90
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/sys_common/backtrace.rs:34:9
8: 0x7ff11c466baf - std::panicking::default_hook::{{closure}}::h6fa5498814662258
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/panicking.rs:267:22
9: 0x7ff11c4668eb - std::panicking::default_hook::h27c5cc64dbc8482d
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/panicking.rs:286:9
10: 0x7ff11b6bdf24 - rustc_driver[1a6385c1c72d16e7]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7ff11c4673ad - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h555d7d9f22ed347d
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/alloc/src/boxed.rs:2032:9
12: 0x7ff11c4673ad - std::panicking::rust_panic_with_hook::hf0b4a17e8b00f779
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/panicking.rs:692:13
13: 0x7ff11bd9e991 - std[79527836cf90b5dd]::panicking::begin_panic::<rustc_errors[643e9caaba05b420]::ExplicitBug>::{closure#0}
14: 0x7ff11bd9e376 - std[79527836cf90b5dd]::sys_common::backtrace::__rust_end_short_backtrace::<std[79527836cf90b5dd]::panicking::begin_panic<rustc_errors[643e9caaba05b420]::ExplicitBug>::{closure#0}, !>
15: 0x7ff11bd95d56 - std[79527836cf90b5dd]::panicking::begin_panic::<rustc_errors[643e9caaba05b420]::ExplicitBug>
16: 0x7ff11bdaab56 - std[79527836cf90b5dd]::panic::panic_any::<rustc_errors[643e9caaba05b420]::ExplicitBug>
17: 0x7ff11bda9af9 - <rustc_errors[643e9caaba05b420]::HandlerInner>::span_bug::<rustc_span[c03eaf4ea18165a3]::span_encoding::Span, &alloc[976f33e9556b75e2]::string::String>
18: 0x7ff11bda9780 - <rustc_errors[643e9caaba05b420]::Handler>::span_bug::<rustc_span[c03eaf4ea18165a3]::span_encoding::Span, &alloc[976f33e9556b75e2]::string::String>
19: 0x7ff11bda7211 - rustc_middle[19d5e5a4d6179ade]::ty::context::tls::with_context_opt::<rustc_middle[19d5e5a4d6179ade]::ty::context::tls::with_opt<rustc_middle[19d5e5a4d6179ade]::util::bug::opt_span_bug_fmt<rustc_span[c03eaf4ea18165a3]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
20: 0x7ff11bda70c6 - rustc_middle[19d5e5a4d6179ade]::util::bug::opt_span_bug_fmt::<rustc_span[c03eaf4ea18165a3]::span_encoding::Span>
21: 0x7ff11bda7084 - rustc_middle[19d5e5a4d6179ade]::util::bug::span_bug_fmt::<rustc_span[c03eaf4ea18165a3]::span_encoding::Span>
22: 0x7ff1195f9335 - rustc_monomorphize[f852be8325467616]::collector::collect_neighbours
23: 0x7ff1195e92e9 - rustc_monomorphize[f852be8325467616]::collector::collect_items_rec
24: 0x7ff1195e9754 - rustc_monomorphize[f852be8325467616]::collector::collect_items_rec
25: 0x7ff11aa5e7b5 - <rustc_session[2f16cc1ca0f45371]::session::Session>::time::<(), rustc_monomorphize[f852be8325467616]::collector::collect_crate_mono_items::{closure#1}>
26: 0x7ff11aa5e2d4 - rustc_monomorphize[f852be8325467616]::collector::collect_crate_mono_items
27: 0x7ff11aa5d6e3 - rustc_monomorphize[f852be8325467616]::partitioning::collect_and_partition_mono_items
28: 0x7ff11ae33a00 - rustc_query_system[c29954e9c418d3e1]::query::plumbing::try_execute_query::<rustc_query_impl[81623dbe8f24b13f]::plumbing::QueryCtxt, rustc_query_system[c29954e9c418d3e1]::query::caches::DefaultCache<(), (&std[79527836cf90b5dd]::collections::hash::set::HashSet<rustc_span[c03eaf4ea18165a3]::def_id::DefId, core[7075224b64f80aa]::hash::BuildHasherDefault<rustc_hash[7698cfb367caca01]::FxHasher>>, &[rustc_middle[19d5e5a4d6179ade]::mir::mono::CodegenUnit])>>
29: 0x7ff11ae336c4 - rustc_query_system[c29954e9c418d3e1]::query::plumbing::get_query::<rustc_query_impl[81623dbe8f24b13f]::queries::collect_and_partition_mono_items, rustc_query_impl[81623dbe8f24b13f]::plumbing::QueryCtxt>
30: 0x7ff11ae335fe - <rustc_query_impl[81623dbe8f24b13f]::Queries as rustc_middle[19d5e5a4d6179ade]::ty::query::QueryEngine>::collect_and_partition_mono_items
31: 0x7ff11ab215fb - rustc_codegen_ssa[234fb96bead002ba]::base::codegen_crate::<rustc_codegen_llvm[7650bcf584e55ba6]::LlvmCodegenBackend>
32: 0x7ff11ab213a9 - <rustc_codegen_llvm[7650bcf584e55ba6]::LlvmCodegenBackend as rustc_codegen_ssa[234fb96bead002ba]::traits::backend::CodegenBackend>::codegen_crate
33: 0x7ff11a7f4941 - <rustc_session[2f16cc1ca0f45371]::session::Session>::time::<alloc[976f33e9556b75e2]::boxed::Box<dyn core[7075224b64f80aa]::any::Any>, rustc_interface[ee8495dca531fc0c]::passes::start_codegen::{closure#0}>
34: 0x7ff11a7f4435 - rustc_interface[ee8495dca531fc0c]::passes::start_codegen
35: 0x7ff11a7efb1d - <rustc_interface[ee8495dca531fc0c]::passes::QueryContext>::enter::<<rustc_interface[ee8495dca531fc0c]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[7075224b64f80aa]::result::Result<alloc[976f33e9556b75e2]::boxed::Box<dyn core[7075224b64f80aa]::any::Any>, rustc_errors[643e9caaba05b420]::ErrorGuaranteed>>
36: 0x7ff11a7ed334 - <rustc_interface[ee8495dca531fc0c]::queries::Queries>::ongoing_codegen
37: 0x7ff11a7ec501 - <rustc_interface[ee8495dca531fc0c]::interface::Compiler>::enter::<rustc_driver[1a6385c1c72d16e7]::run_compiler::{closure#1}::{closure#2}, core[7075224b64f80aa]::result::Result<core[7075224b64f80aa]::option::Option<rustc_interface[ee8495dca531fc0c]::queries::Linker>, rustc_errors[643e9caaba05b420]::ErrorGuaranteed>>
38: 0x7ff11a7e74e8 - rustc_span[c03eaf4ea18165a3]::with_source_map::<core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>, rustc_interface[ee8495dca531fc0c]::interface::run_compiler<core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>, rustc_driver[1a6385c1c72d16e7]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
39: 0x7ff11a7e6fd5 - <scoped_tls[6605aed902b0fb11]::ScopedKey<rustc_span[c03eaf4ea18165a3]::SessionGlobals>>::set::<rustc_interface[ee8495dca531fc0c]::interface::run_compiler<core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>, rustc_driver[1a6385c1c72d16e7]::run_compiler::{closure#1}>::{closure#0}, core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>>
40: 0x7ff11a7e65c2 - std[79527836cf90b5dd]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ee8495dca531fc0c]::util::run_in_thread_pool_with_globals<rustc_interface[ee8495dca531fc0c]::interface::run_compiler<core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>, rustc_driver[1a6385c1c72d16e7]::run_compiler::{closure#1}>::{closure#0}, core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>>
41: 0x7ff11af6b8e8 - <<std[79527836cf90b5dd]::thread::Builder>::spawn_unchecked_<rustc_interface[ee8495dca531fc0c]::util::run_in_thread_pool_with_globals<rustc_interface[ee8495dca531fc0c]::interface::run_compiler<core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>, rustc_driver[1a6385c1c72d16e7]::run_compiler::{closure#1}>::{closure#0}, core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7075224b64f80aa]::result::Result<(), rustc_errors[643e9caaba05b420]::ErrorGuaranteed>>::{closure#1} as core[7075224b64f80aa]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
42: 0x7ff11c46e5e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb948150b9fd67a86
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/alloc/src/boxed.rs:2000:9
43: 0x7ff11c46e5e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2f842213b427eb19
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/alloc/src/boxed.rs:2000:9
44: 0x7ff11c46e5e3 - std::sys::unix::thread::Thread::new::thread_start::h2adb6f1223042fb8
at /rustc/32e613bbaafee1bcabba48a2257b838f8d1c03d3/library/std/src/sys/unix/thread.rs:108:17
45: 0x7ff1182658fd - <unknown>
46: 0x7ff1182e7a60 - <unknown>
47: 0x0 - <unknown>
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.67.0-nightly (32e613bba 2022-12-02) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z polymorphize=on
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
Unstable option: Polymorphization.Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.