Closed
Description
Code
#![feature(pointer_like_trait, dyn_star)]
#![allow(incomplete_features)]
use std::marker::PointerLike;
#[no_mangle]
pub fn lol(x: dyn* PointerLike) {
foo(x);
}
fn foo<T: PointerLike>(x: T) {
let _: dyn* PointerLike = x;
}
fn main() {}
I believe that the root issue here is that dyn* PointerLike
implements PointerLike
, despite not being pointer-like.
Meta
Reproducible on the playground with version 1.85.0-nightly (2024-12-19 9e136a30a965bf4e63f0)
Error output
Backtrace
error: internal compiler error: /rustc/9e136a30a965bf4e63f03095c57df7257bf96fd6/compiler/rustc_codegen_ssa/src/base.rs:280:17: unexpected TypeKind for left-hand side of `dyn*` cast: Struct
thread 'rustc' panicked at /rustc/9e136a30a965bf4e63f03095c57df7257bf96fd6/compiler/rustc_codegen_ssa/src/base.rs:280:17:
Box<dyn Any>
stack backtrace:
0: 0x7ca303d8315a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h6c37de0361fa7462
1: 0x7ca304413cbc - core::fmt::write::hf77fe0583268bf67
2: 0x7ca305342dd1 - std::io::Write::write_fmt::h3b0b8069e2435ed6
3: 0x7ca303d82fb2 - std::sys::backtrace::BacktraceLock::print::hce84519ec0e7588e
4: 0x7ca303d854aa - std::panicking::default_hook::{{closure}}::h6e0433c33d1ed12b
5: 0x7ca303d852f3 - std::panicking::default_hook::h19d4e9e8d7fba9e2
6: 0x7ca302ef7768 - std[19739dcbdd52d894]::panicking::update_hook::<alloc[d24e20bba6540ab9]::boxed::Box<rustc_driver_impl[3177e72804664110]::install_ice_hook::{closure#0}>>::{closure#0}
7: 0x7ca303d85c68 - std::panicking::rust_panic_with_hook::hd21771b96ea64164
8: 0x7ca302f322d1 - std[19739dcbdd52d894]::panicking::begin_panic::<rustc_errors[37abd7aad4ad5df0]::ExplicitBug>::{closure#0}
9: 0x7ca302f274b6 - std[19739dcbdd52d894]::sys::backtrace::__rust_end_short_backtrace::<std[19739dcbdd52d894]::panicking::begin_panic<rustc_errors[37abd7aad4ad5df0]::ExplicitBug>::{closure#0}, !>
10: 0x7ca302f23ec9 - std[19739dcbdd52d894]::panicking::begin_panic::<rustc_errors[37abd7aad4ad5df0]::ExplicitBug>
11: 0x7ca302f3c231 - <rustc_errors[37abd7aad4ad5df0]::diagnostic::BugAbort as rustc_errors[37abd7aad4ad5df0]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7ca303510fd3 - rustc_middle[a45f2c6e02975f4b]::util::bug::opt_span_bug_fmt::<rustc_span[2a960e124d280c12]::span_encoding::Span>::{closure#0}
13: 0x7ca3034f67ba - rustc_middle[a45f2c6e02975f4b]::ty::context::tls::with_opt::<rustc_middle[a45f2c6e02975f4b]::util::bug::opt_span_bug_fmt<rustc_span[2a960e124d280c12]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7ca3034f664b - rustc_middle[a45f2c6e02975f4b]::ty::context::tls::with_context_opt::<rustc_middle[a45f2c6e02975f4b]::ty::context::tls::with_opt<rustc_middle[a45f2c6e02975f4b]::util::bug::opt_span_bug_fmt<rustc_span[2a960e124d280c12]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x7ca301245790 - rustc_middle[a45f2c6e02975f4b]::util::bug::bug_fmt
16: 0x7ca302d3b96e - rustc_codegen_ssa[86572314d330a2c2]::base::cast_to_dyn_star::<rustc_codegen_llvm[de1ddb382a238c68]::builder::Builder>
17: 0x7ca304a53401 - <rustc_codegen_ssa[86572314d330a2c2]::mir::FunctionCx<rustc_codegen_llvm[de1ddb382a238c68]::builder::Builder>>::codegen_rvalue_operand
18: 0x7ca305229954 - rustc_codegen_ssa[86572314d330a2c2]::mir::codegen_mir::<rustc_codegen_llvm[de1ddb382a238c68]::builder::Builder>
19: 0x7ca305204849 - rustc_codegen_llvm[de1ddb382a238c68]::base::compile_codegen_unit::module_codegen
20: 0x7ca3053e4b88 - <rustc_codegen_llvm[de1ddb382a238c68]::LlvmCodegenBackend as rustc_codegen_ssa[86572314d330a2c2]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
21: 0x7ca3053e0ee1 - <rustc_codegen_llvm[de1ddb382a238c68]::LlvmCodegenBackend as rustc_codegen_ssa[86572314d330a2c2]::traits::backend::CodegenBackend>::codegen_crate
22: 0x7ca30547ef64 - <rustc_interface[dfcc7ff3f03a05db]::queries::Linker>::codegen_and_build_linker
23: 0x7ca30539edd2 - rustc_interface[dfcc7ff3f03a05db]::passes::create_and_enter_global_ctxt::<core[57d68807791337c0]::option::Option<rustc_interface[dfcc7ff3f03a05db]::queries::Linker>, rustc_driver_impl[3177e72804664110]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
24: 0x7ca305410c43 - rustc_interface[dfcc7ff3f03a05db]::interface::run_compiler::<(), rustc_driver_impl[3177e72804664110]::run_compiler::{closure#0}>::{closure#1}
25: 0x7ca3053f7711 - std[19739dcbdd52d894]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[dfcc7ff3f03a05db]::util::run_in_thread_with_globals<rustc_interface[dfcc7ff3f03a05db]::util::run_in_thread_pool_with_globals<rustc_interface[dfcc7ff3f03a05db]::interface::run_compiler<(), rustc_driver_impl[3177e72804664110]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
26: 0x7ca3053f7ba6 - <<std[19739dcbdd52d894]::thread::Builder>::spawn_unchecked_<rustc_interface[dfcc7ff3f03a05db]::util::run_in_thread_with_globals<rustc_interface[dfcc7ff3f03a05db]::util::run_in_thread_pool_with_globals<rustc_interface[dfcc7ff3f03a05db]::interface::run_compiler<(), rustc_driver_impl[3177e72804664110]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[57d68807791337c0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
27: 0x7ca3053f916f - std::sys::pal::unix::thread::Thread::new::thread_start::h71fe57097907b3f8
28: 0x7ca3069dea94 - <unknown>
29: 0x7ca306a6ba34 - clone
30: 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: please make sure that you have updated to the latest nightly
note: please attach the file at `/playground/rustc-ice-2024-12-20T04_40_27-201.txt` to your bug report
note: compiler flags: --crate-type bin -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:
end of query stack
error: could not compile `playground` (bin "playground")
Seem related to #134543
@rustbot labels +F-dyn_star +requires-nightly