Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: resolution failed during building vtable representation trait_alias #109514

Closed
matthiaskrgr opened this issue Mar 23, 2023 · 1 comment · Fixed by #107614
Closed

ICE: resolution failed during building vtable representation trait_alias #109514

matthiaskrgr opened this issue Mar 23, 2023 · 1 comment · Fixed by #107614
Assignees
Labels
C-bug Category: This is a bug. F-trait_alias `#![feature(trait_alias)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 23, 2023

Code

#![feature(trait_alias)]

trait Alias = A where i32: B;

trait A {}

trait B {
    fn test(&self);
}

trait C: Alias {}

impl A for () {}

impl C for () {}

impl B for i32 {
    fn test(&self) {}
}

fn main() {
    let x: &C = &();
}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (1db9c061d 2023-03-21)
binary: rustc
commit-hash: 1db9c061d387a66ab16a90ec5a1b90adf216e2da
commit-date: 2023-03-21
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

<output>
Backtrace

warning: trait objects without an explicit `dyn` are deprecated
  --> melted.rs:22:13
   |
22 |     let x: &C = &();
   |             ^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
   = note: `#[warn(bare_trait_objects)]` on by default
help: use `dyn`
   |
22 |     let x: &dyn C = &();
   |             +++

warning: unused variable: `x`
  --> melted.rs:22:9
   |
22 |     let x: &C = &();
   |         ^ help: if this is intentional, prefix it with an underscore: `_x`
   |
   = note: `#[warn(unused_variables)]` on by default

thread 'rustc' panicked at 'resolution failed during building vtable representation', compiler/rustc_trait_selection/src/traits/vtable.rs:278:22
stack backtrace:
   0:     0x7f770804b65a - std::backtrace_rs::backtrace::libunwind::trace::h6885d9c02b85e679
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f770804b65a - std::backtrace_rs::backtrace::trace_unsynchronized::he3b2669200f72ece
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f770804b65a - std::sys_common::backtrace::_print_fmt::h8e8a9af758807679
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f770804b65a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h38510c1ea4b1ecd1
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f77080aefde - core::fmt::write::hc62f02881e1f07c1
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f770803e2d5 - std::io::Write::write_fmt::hdace46740a33e745
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/io/mod.rs:1698:15
   6:     0x7f770804b425 - std::sys_common::backtrace::_print::hb03a3a0983d6f821
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f770804b425 - std::sys_common::backtrace::print::ha68a6a98b1278679
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f770804e19f - std::panicking::default_hook::{{closure}}::hf02923da46f3a3dc
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/panicking.rs:271:22
   9:     0x7f770804dedb - std::panicking::default_hook::he5a627c7eca3cd2a
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/panicking.rs:290:9
  10:     0x7f7706e36a15 - rustc_driver_impl[c8bf87673e33b5bb]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f770804e9dd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hdb8354f09c16b90c
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/alloc/src/boxed.rs:2002:9
  12:     0x7f770804e9dd - std::panicking::rust_panic_with_hook::ha6218529e5f05d2b
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/panicking.rs:696:13
  13:     0x7f770804e759 - std::panicking::begin_panic_handler::{{closure}}::h7eb84f4007bd2944
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/panicking.rs:583:13
  14:     0x7f770804bac6 - std::sys_common::backtrace::__rust_end_short_backtrace::h48c70ea8e6c4f5c0
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f770804e462 - rust_begin_unwind
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/panicking.rs:579:5
  16:     0x7f77080ab323 - core::panicking::panic_fmt::h0e90db0c940dfbcc
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/core/src/panicking.rs:64:14
  17:     0x7f77080ab491 - core::panicking::panic_display::hc7ffdbd5b14c6adc
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/core/src/panicking.rs:147:5
  18:     0x7f77080ab43b - core::panicking::panic_str::hbbabf43062e5cee3
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/core/src/panicking.rs:131:5
  19:     0x7f77080ab0a6 - core::option::expect_failed::hc65688ea4e841b28
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/core/src/option.rs:2091:5
  20:     0x7f7705d635fd - <core[674372366ba6bd14]::iter::adapters::copied::Copied<core[674372366ba6bd14]::slice::iter::Iter<rustc_span[9ae650a2a6c0da86]::def_id::DefId>> as core[674372366ba6bd14]::iter::traits::iterator::Iterator>::fold::<(), core[674372366ba6bd14]::iter::adapters::map::map_fold<rustc_span[9ae650a2a6c0da86]::def_id::DefId, rustc_middle[f2c5526360e5c8cb]::ty::vtable::VtblEntry, (), rustc_trait_selection[ad86a979c94cdd0e]::traits::vtable::vtable_entries::{closure#0}::{closure#1}, core[674372366ba6bd14]::iter::traits::iterator::Iterator::for_each::call<rustc_middle[f2c5526360e5c8cb]::ty::vtable::VtblEntry, <alloc[575cea9fff30d964]::vec::Vec<rustc_middle[f2c5526360e5c8cb]::ty::vtable::VtblEntry>>::extend_trusted<core[674372366ba6bd14]::iter::adapters::map::Map<core[674372366ba6bd14]::iter::adapters::copied::Copied<core[674372366ba6bd14]::slice::iter::Iter<rustc_span[9ae650a2a6c0da86]::def_id::DefId>>, rustc_trait_selection[ad86a979c94cdd0e]::traits::vtable::vtable_entries::{closure#0}::{closure#1}>>::{closure#0}>::{closure#0}>::{closure#0}>
  21:     0x7f7705d60bda - rustc_trait_selection[ad86a979c94cdd0e]::traits::vtable::vtable_entries::{closure#0}
  22:     0x7f7705d600b6 - rustc_trait_selection[ad86a979c94cdd0e]::traits::vtable::vtable_entries
  23:     0x7f77062f8f0c - rustc_query_system[96d69ef80f10e645]::query::plumbing::try_execute_query::<rustc_query_impl[7b9961ca59d7bba3]::queries::vtable_entries, rustc_query_impl[7b9961ca59d7bba3]::plumbing::QueryCtxt>
  24:     0x7f77062f8b31 - <rustc_query_impl[7b9961ca59d7bba3]::Queries as rustc_middle[f2c5526360e5c8cb]::ty::query::QueryEngine>::vtable_entries
  25:     0x7f770622d6f0 - rustc_middle[f2c5526360e5c8cb]::ty::vtable::vtable_allocation_provider
  26:     0x7f770637d282 - rustc_query_system[96d69ef80f10e645]::query::plumbing::try_execute_query::<rustc_query_impl[7b9961ca59d7bba3]::queries::vtable_allocation, rustc_query_impl[7b9961ca59d7bba3]::plumbing::QueryCtxt>
  27:     0x7f770637ced9 - <rustc_query_impl[7b9961ca59d7bba3]::Queries as rustc_middle[f2c5526360e5c8cb]::ty::query::QueryEngine>::vtable_allocation
  28:     0x7f770622dc71 - rustc_middle[f2c5526360e5c8cb]::ty::vtable::vtable_allocation_provider
  29:     0x7f770637d282 - rustc_query_system[96d69ef80f10e645]::query::plumbing::try_execute_query::<rustc_query_impl[7b9961ca59d7bba3]::queries::vtable_allocation, rustc_query_impl[7b9961ca59d7bba3]::plumbing::QueryCtxt>
  30:     0x7f770637ced9 - <rustc_query_impl[7b9961ca59d7bba3]::Queries as rustc_middle[f2c5526360e5c8cb]::ty::query::QueryEngine>::vtable_allocation
  31:     0x7f7705672570 - rustc_codegen_ssa[1b6c701da86ec12d]::meth::get_vtable::<rustc_codegen_llvm[c341e14ca1f71b5b]::context::CodegenCx>
  32:     0x7f77056699b5 - rustc_codegen_ssa[1b6c701da86ec12d]::base::unsized_info::<rustc_codegen_llvm[c341e14ca1f71b5b]::builder::Builder>
  33:     0x7f77056629a3 - rustc_codegen_ssa[1b6c701da86ec12d]::base::unsize_ptr::<rustc_codegen_llvm[c341e14ca1f71b5b]::builder::Builder>
  34:     0x7f77056404c6 - <rustc_codegen_ssa[1b6c701da86ec12d]::mir::FunctionCx<rustc_codegen_llvm[c341e14ca1f71b5b]::builder::Builder>>::codegen_rvalue_operand
  35:     0x7f770561005c - rustc_codegen_ssa[1b6c701da86ec12d]::mir::codegen_mir::<rustc_codegen_llvm[c341e14ca1f71b5b]::builder::Builder>
  36:     0x7f77063afc53 - rustc_codegen_llvm[c341e14ca1f71b5b]::base::compile_codegen_unit::module_codegen
  37:     0x7f77063ad6cf - <rustc_codegen_llvm[c341e14ca1f71b5b]::LlvmCodegenBackend as rustc_codegen_ssa[1b6c701da86ec12d]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  38:     0x7f77063ab838 - rustc_codegen_ssa[1b6c701da86ec12d]::base::codegen_crate::<rustc_codegen_llvm[c341e14ca1f71b5b]::LlvmCodegenBackend>
  39:     0x7f77063ab14e - <rustc_codegen_llvm[c341e14ca1f71b5b]::LlvmCodegenBackend as rustc_codegen_ssa[1b6c701da86ec12d]::traits::backend::CodegenBackend>::codegen_crate
  40:     0x7f7705fa76b1 - <rustc_session[946294f1a07ac87a]::session::Session>::time::<alloc[575cea9fff30d964]::boxed::Box<dyn core[674372366ba6bd14]::any::Any>, rustc_interface[300e6cb95854dc34]::passes::start_codegen::{closure#0}>
  41:     0x7f7705fa71d9 - rustc_interface[300e6cb95854dc34]::passes::start_codegen
  42:     0x7f7705fa33e8 - <rustc_middle[f2c5526360e5c8cb]::ty::context::GlobalCtxt>::enter::<<rustc_interface[300e6cb95854dc34]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[674372366ba6bd14]::result::Result<alloc[575cea9fff30d964]::boxed::Box<dyn core[674372366ba6bd14]::any::Any>, rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>>
  43:     0x7f7705fa1a14 - <rustc_interface[300e6cb95854dc34]::queries::Queries>::ongoing_codegen
  44:     0x7f7705fa0fe1 - <rustc_interface[300e6cb95854dc34]::interface::Compiler>::enter::<rustc_driver_impl[c8bf87673e33b5bb]::run_compiler::{closure#1}::{closure#2}, core[674372366ba6bd14]::result::Result<core[674372366ba6bd14]::option::Option<rustc_interface[300e6cb95854dc34]::queries::Linker>, rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>>
  45:     0x7f7705f9c180 - rustc_span[9ae650a2a6c0da86]::with_source_map::<core[674372366ba6bd14]::result::Result<(), rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>, rustc_interface[300e6cb95854dc34]::interface::run_compiler<core[674372366ba6bd14]::result::Result<(), rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>, rustc_driver_impl[c8bf87673e33b5bb]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  46:     0x7f7705f9b729 - std[6e758b2c95f8c60a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[300e6cb95854dc34]::util::run_in_thread_pool_with_globals<rustc_interface[300e6cb95854dc34]::interface::run_compiler<core[674372366ba6bd14]::result::Result<(), rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>, rustc_driver_impl[c8bf87673e33b5bb]::run_compiler::{closure#1}>::{closure#0}, core[674372366ba6bd14]::result::Result<(), rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[674372366ba6bd14]::result::Result<(), rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>>
  47:     0x7f77066e2aaa - <<std[6e758b2c95f8c60a]::thread::Builder>::spawn_unchecked_<rustc_interface[300e6cb95854dc34]::util::run_in_thread_pool_with_globals<rustc_interface[300e6cb95854dc34]::interface::run_compiler<core[674372366ba6bd14]::result::Result<(), rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>, rustc_driver_impl[c8bf87673e33b5bb]::run_compiler::{closure#1}>::{closure#0}, core[674372366ba6bd14]::result::Result<(), rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[674372366ba6bd14]::result::Result<(), rustc_span[9ae650a2a6c0da86]::ErrorGuaranteed>>::{closure#1} as core[674372366ba6bd14]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f77080589a3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h862118ca57b80f77
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/alloc/src/boxed.rs:1988:9
  49:     0x7f77080589a3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h98de3b2171a6b9a2
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/alloc/src/boxed.rs:1988:9
  50:     0x7f77080589a3 - std::sys::unix::thread::Thread::new::thread_start::h31cc71e5d7fb3209
                               at /rustc/1db9c061d387a66ab16a90ec5a1b90adf216e2da/library/std/src/sys/unix/thread.rs:108:17
  51:     0x7f7703a67bb5 - <unknown>
  52:     0x7f7703ae9d90 - <unknown>
  53:                0x0 - <unknown>

error: 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.70.0-nightly (1db9c061d 2023-03-21) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [vtable_entries] finding all vtable entries for trait `B`
#1 [vtable_allocation] vtable const allocation for <() as B>
#2 [vtable_allocation] vtable const allocation for <() as C>
end of query stack
warning: 2 warnings emitted

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. F-trait_alias `#![feature(trait_alias)]` labels Mar 23, 2023
@compiler-errors
Copy link
Member

This should be fixed by #107614

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-trait_alias `#![feature(trait_alias)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
2 participants