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: dyn_star: unexpected TypeKind for left-hand side of dyn* cast: Void #295

Closed
matthiaskrgr opened this issue Jul 1, 2023 · 0 comments · Fixed by #500
Closed

ice: dyn_star: unexpected TypeKind for left-hand side of dyn* cast: Void #295

matthiaskrgr opened this issue Jul 1, 2023 · 0 comments · Fixed by #500

Comments

@matthiaskrgr
Copy link
Member

./tests/ui/dyn-star/dyn-star-to-dyn.rs

// run-pass

#![feature(dyn_star)]
//~^ WARN the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes

use std::fmt::Debug;

fn main() {
    let x: dyn* Debug = &42;
    let x = Box::new(x) as Box<dyn Debug>;
    assert_eq!("42", format!("{x:?}"));

    // Also test opposite direction.
    let x: Box<dyn Debug> = Box::new(42);
    let x = &x as dyn* Debug;
    assert_eq!("42", format!("{x:?}"));
}
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
 --> ./tests/ui/dyn-star/dyn-star-to-dyn.rs:3:12
  |
3 | #![feature(dyn_star)]
  |            ^^^^^^^^
  |
  = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
  = note: `#[warn(incomplete_features)]` on by default

error: internal compiler error: /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/compiler/rustc_codegen_ssa/src/base.rs:279:17: unexpected TypeKind for left-hand side of `dyn*` cast: Void

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
   0:     0x7f9bd3f67e11 - std::backtrace_rs::backtrace::libunwind::trace::h184786643c1f8146
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9bd3f67e11 - std::backtrace_rs::backtrace::trace_unsynchronized::h10cef21dd42edd42
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9bd3f67e11 - std::sys_common::backtrace::_print_fmt::hca8722c6f82eccd9
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9bd3f67e11 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4b170c65cdf95c48
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9bd3fc94bf - core::fmt::rt::Argument::fmt::h7e50834cab28e102
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/core/src/fmt/rt.rs:138:9
   5:     0x7f9bd3fc94bf - core::fmt::write::h8bd64fe81f89dd81
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f9bd3f5a977 - std::io::Write::write_fmt::hc75a842b3ecac8bc
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/io/mod.rs:1714:15
   7:     0x7f9bd3f67c25 - std::sys_common::backtrace::_print::hdb7a31bd8c54eb49
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9bd3f67c25 - std::sys_common::backtrace::print::hbcf968a4222dc0b5
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9bd3f6a9d3 - std::panicking::default_hook::{{closure}}::h02987b13cfa1387d
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/panicking.rs:269:22
  10:     0x7f9bd3f6a764 - std::panicking::default_hook::hcb3fd44404995c49
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/panicking.rs:288:9
  11:     0x7f9bd71abd6b - <rustc_driver_impl[7175fdba515aac6e]::install_ice_hook::{closure#0} as core[baaa20f768102eef]::ops::function::FnOnce<(&core[baaa20f768102eef]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f9bd3f6b1fe - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hec1e31de726d1657
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/alloc/src/boxed.rs:2007:9
  13:     0x7f9bd3f6b1fe - std::panicking::rust_panic_with_hook::h223f39091438ac61
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/panicking.rs:709:13
  14:     0x7f9bd76ae8d1 - std[755122e38bdf80bb]::panicking::begin_panic::<rustc_errors[22c53a0383ffa2c9]::ExplicitBug>::{closure#0}
  15:     0x7f9bd76ad526 - std[755122e38bdf80bb]::sys_common::backtrace::__rust_end_short_backtrace::<std[755122e38bdf80bb]::panicking::begin_panic<rustc_errors[22c53a0383ffa2c9]::ExplicitBug>::{closure#0}, !>
  16:     0x7f9bd7742666 - std[755122e38bdf80bb]::panicking::begin_panic::<rustc_errors[22c53a0383ffa2c9]::ExplicitBug>
  17:     0x7f9bd76aa2e4 - <rustc_errors[22c53a0383ffa2c9]::HandlerInner>::bug::<alloc[d1ea88cdd25af2a4]::string::String>
  18:     0x7f9bd76aa166 - <rustc_errors[22c53a0383ffa2c9]::Handler>::bug::<alloc[d1ea88cdd25af2a4]::string::String>
  19:     0x7f9bd76fd5fc - rustc_middle[56c503886228b671]::util::bug::opt_span_bug_fmt::<rustc_span[1e0547ff349d1bca]::span_encoding::Span>::{closure#0}
  20:     0x7f9bd76fa49a - rustc_middle[56c503886228b671]::ty::context::tls::with_opt::<rustc_middle[56c503886228b671]::util::bug::opt_span_bug_fmt<rustc_span[1e0547ff349d1bca]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f9bd76fa46a - rustc_middle[56c503886228b671]::ty::context::tls::with_context_opt::<rustc_middle[56c503886228b671]::ty::context::tls::with_opt<rustc_middle[56c503886228b671]::util::bug::opt_span_bug_fmt<rustc_span[1e0547ff349d1bca]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9bd54ef2bd - rustc_middle[56c503886228b671]::util::bug::bug_fmt
  23:     0x7f9bc9282ea5 - rustc_codegen_ssa::base::cast_to_dyn_star::hf2bda0974be9b1bf
  24:     0x7f9bc93a9d65 - rustc_codegen_ssa::mir::rvalue::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_rvalue_operand::h1536923317528649
  25:     0x7f9bc939dbc4 - rustc_codegen_ssa::mir::codegen_mir::h3ad98a26028d240e
  26:     0x7f9bc9283015 - rustc_codegen_ssa::base::codegen_instance::h4de2a7fcd42b8fec
  27:     0x7f9bc92b779f - <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define::h3ba430a5d5241f22
  28:     0x7f9bc937aa8a - rustc_codegen_gcc::base::compile_codegen_unit::module_codegen::he6166c6882b2cbb7
  29:     0x7f9bc937999e - rustc_codegen_gcc::base::compile_codegen_unit::hee038d1e76e08ed1
  30:     0x7f9bc92a96fd - <rustc_codegen_gcc::GccCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit::h9454ef5ee5ef580e
  31:     0x7f9bc928276d - rustc_codegen_ssa::base::codegen_crate::h1a4124ddfd8d676d
  32:     0x7f9bc92a932a - <rustc_codegen_gcc::GccCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate::hfb6d3003355e12ad
  33:     0x7f9bd66dcbc2 - <rustc_session[ebb9057f9195e4cc]::session::Session>::time::<alloc[d1ea88cdd25af2a4]::boxed::Box<dyn core[baaa20f768102eef]::any::Any>, rustc_interface[e3841d12b9b221e7]::passes::start_codegen::{closure#0}>
  34:     0x7f9bd66dc73b - rustc_interface[e3841d12b9b221e7]::passes::start_codegen
  35:     0x7f9bd66d749d - <rustc_middle[56c503886228b671]::ty::context::GlobalCtxt>::enter::<<rustc_interface[e3841d12b9b221e7]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[baaa20f768102eef]::result::Result<alloc[d1ea88cdd25af2a4]::boxed::Box<dyn core[baaa20f768102eef]::any::Any>, rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>
  36:     0x7f9bd66d66cd - <rustc_interface[e3841d12b9b221e7]::queries::Queries>::ongoing_codegen
  37:     0x7f9bd66d57f0 - <rustc_interface[e3841d12b9b221e7]::interface::Compiler>::enter::<rustc_driver_impl[7175fdba515aac6e]::run_compiler::{closure#1}::{closure#2}, core[baaa20f768102eef]::result::Result<core[baaa20f768102eef]::option::Option<rustc_interface[e3841d12b9b221e7]::queries::Linker>, rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>
  38:     0x7f9bd66d2e21 - std[755122e38bdf80bb]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e3841d12b9b221e7]::util::run_in_thread_pool_with_globals<rustc_interface[e3841d12b9b221e7]::interface::run_compiler<core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>, rustc_driver_impl[7175fdba515aac6e]::run_compiler::{closure#1}>::{closure#0}, core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>
  39:     0x7f9bd66d25a5 - <<std[755122e38bdf80bb]::thread::Builder>::spawn_unchecked_<rustc_interface[e3841d12b9b221e7]::util::run_in_thread_pool_with_globals<rustc_interface[e3841d12b9b221e7]::interface::run_compiler<core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>, rustc_driver_impl[7175fdba515aac6e]::run_compiler::{closure#1}>::{closure#0}, core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[baaa20f768102eef]::result::Result<(), rustc_span[1e0547ff349d1bca]::ErrorGuaranteed>>::{closure#1} as core[baaa20f768102eef]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7f9bd3f75685 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h59d6baf462325ed4
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/alloc/src/boxed.rs:1993:9
  41:     0x7f9bd3f75685 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4eca0dd82537346f
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/alloc/src/boxed.rs:1993:9
  42:     0x7f9bd3f75685 - std::sys::unix::thread::Thread::new::thread_start::h38e13b8ca4256fdb
                               at /rustc/2d0aa57684e10f7b3d3fe740ee18d431181583ad/library/std/src/sys/unix/thread.rs:108:17
  43:     0x7f9bd3d0d44b - <unknown>
  44:     0x7f9bd3d90e40 - <unknown>
  45:                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

note: rustc 1.72.0-nightly (2d0aa5768 2023-06-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z codegen-backend=/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/target/release/librustc_codegen_gcc.so

query stack during panic:
end of query stack
error: aborting due to previous error; 1 warning emitted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant