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

Closed
matthiaskrgr opened this issue Jul 3, 2023 · 3 comments
Closed

ICE unexpected TypeKind for left-hand side of dyn* cast: Double #113280

matthiaskrgr opened this issue Jul 3, 2023 · 3 comments
Labels
C-bug Category: This is a bug. F-dyn_star `#![feature(dyn_star)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![feature(dyn_star, pointer_like_trait)]
#![allow(incomplete_features)]

use std::fmt::Debug;
use std::marker::PointerLike;

fn make_dyn_star<'a>(t: impl PointerLike + Debug + 'a) -> dyn* Debug + 'a {
    f32::from_bits(0x1) as f64
}

fn main() {
    println!("{:?}", make_dyn_star(Box::new(1i32)));
}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (5bd28f5ea 2023-06-28)
binary: rustc
commit-hash: 5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0
commit-date: 2023-06-28
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

<output>
Backtrace

warning: unused variable: `t`
  --> /home/matthias/vcs/github/rust/tests/ui/icemaker/1B6F4BE7A19A78BF67365C0E743A9D8944440CAE9F9A87C6D5AAC0E868B26F86.rs:15:22
   |
15 | fn make_dyn_star<'a>(t: impl PointerLike + Debug + 'a) -> dyn* Debug + 'a {
   |                      ^ help: if this is intentional, prefix it with an underscore: `_t`
   |
   = note: `#[warn(unused_variables)]` on by default

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

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
   0:     0x7f1bb3b67e31 - std::backtrace_rs::backtrace::libunwind::trace::h8bc3e596fd6e6181
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f1bb3b67e31 - std::backtrace_rs::backtrace::trace_unsynchronized::h9a0656fedca2f962
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1bb3b67e31 - std::sys_common::backtrace::_print_fmt::h11ca79bc953fda0e
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f1bb3b67e31 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h23585af82c540d61
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1bb3bc95df - core::fmt::rt::Argument::fmt::h1e7f4bcecbee3fbb
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/core/src/fmt/rt.rs:138:9
   5:     0x7f1bb3bc95df - core::fmt::write::h41633f265152b738
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f1bb3b5a967 - std::io::Write::write_fmt::hdf9fdeebf4391d4c
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/io/mod.rs:1714:15
   7:     0x7f1bb3b67c45 - std::sys_common::backtrace::_print::h0761f433dadea582
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1bb3b67c45 - std::sys_common::backtrace::print::hffcd468cc9baf957
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1bb3b6a9f3 - std::panicking::default_hook::{{closure}}::h70eb212f41458c90
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/panicking.rs:269:22
  10:     0x7f1bb3b6a784 - std::panicking::default_hook::hf217f8886a1385fc
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/panicking.rs:288:9
  11:     0x7f1bb6e2217b - <rustc_driver_impl[ea51492c730803db]::install_ice_hook::{closure#0} as core[6e72eb595340d7ba]::ops::function::FnOnce<(&core[6e72eb595340d7ba]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f1bb3b6b21e - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hdf84d12f536c7065
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/alloc/src/boxed.rs:2024:9
  13:     0x7f1bb3b6b21e - std::panicking::rust_panic_with_hook::h7901b0073bb3ed74
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/panicking.rs:709:13
  14:     0x7f1bb72f6d91 - std[4a840e81aae3439]::panicking::begin_panic::<rustc_errors[74566eb9727f9d9c]::ExplicitBug>::{closure#0}
  15:     0x7f1bb72f5106 - std[4a840e81aae3439]::sys_common::backtrace::__rust_end_short_backtrace::<std[4a840e81aae3439]::panicking::begin_panic<rustc_errors[74566eb9727f9d9c]::ExplicitBug>::{closure#0}, !>
  16:     0x7f1bb72f4626 - std[4a840e81aae3439]::panicking::begin_panic::<rustc_errors[74566eb9727f9d9c]::ExplicitBug>
  17:     0x7f1bb736ae94 - <rustc_errors[74566eb9727f9d9c]::HandlerInner>::bug::<alloc[6fd48550c51b5745]::string::String>
  18:     0x7f1bb736ad16 - <rustc_errors[74566eb9727f9d9c]::Handler>::bug::<alloc[6fd48550c51b5745]::string::String>
  19:     0x7f1bb72f204c - rustc_middle[9f74ec5cb00a905a]::util::bug::opt_span_bug_fmt::<rustc_span[624dabdd61f2978b]::span_encoding::Span>::{closure#0}
  20:     0x7f1bb72f1f8a - rustc_middle[9f74ec5cb00a905a]::ty::context::tls::with_opt::<rustc_middle[9f74ec5cb00a905a]::util::bug::opt_span_bug_fmt<rustc_span[624dabdd61f2978b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f1bb72f1f5a - rustc_middle[9f74ec5cb00a905a]::ty::context::tls::with_context_opt::<rustc_middle[9f74ec5cb00a905a]::ty::context::tls::with_opt<rustc_middle[9f74ec5cb00a905a]::util::bug::opt_span_bug_fmt<rustc_span[624dabdd61f2978b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f1bb528cc4d - rustc_middle[9f74ec5cb00a905a]::util::bug::bug_fmt
  23:     0x7f1bb6c877a8 - rustc_codegen_ssa[452061f54d1b0567]::base::cast_to_dyn_star::<rustc_codegen_llvm[b63e3bb365d5076c]::builder::Builder>
  24:     0x7f1bb561c164 - <rustc_codegen_ssa[452061f54d1b0567]::mir::FunctionCx<rustc_codegen_llvm[b63e3bb365d5076c]::builder::Builder>>::codegen_rvalue_operand
  25:     0x7f1bb55e6a34 - rustc_codegen_ssa[452061f54d1b0567]::mir::codegen_mir::<rustc_codegen_llvm[b63e3bb365d5076c]::builder::Builder>
  26:     0x7f1bb625ca2a - rustc_codegen_llvm[b63e3bb365d5076c]::base::compile_codegen_unit::module_codegen
  27:     0x7f1bb625aaa9 - rustc_codegen_llvm[b63e3bb365d5076c]::base::compile_codegen_unit
  28:     0x7f1bb630c77d - rustc_codegen_ssa[452061f54d1b0567]::base::codegen_crate::<rustc_codegen_llvm[b63e3bb365d5076c]::LlvmCodegenBackend>
  29:     0x7f1bb630c066 - <rustc_codegen_llvm[b63e3bb365d5076c]::LlvmCodegenBackend as rustc_codegen_ssa[452061f54d1b0567]::traits::backend::CodegenBackend>::codegen_crate
  30:     0x7f1bb60c0282 - <rustc_session[a15a65f093e103e1]::session::Session>::time::<alloc[6fd48550c51b5745]::boxed::Box<dyn core[6e72eb595340d7ba]::any::Any>, rustc_interface[b943f00ad50b5541]::passes::start_codegen::{closure#0}>
  31:     0x7f1bb60bfdcb - rustc_interface[b943f00ad50b5541]::passes::start_codegen
  32:     0x7f1bb60b9f2a - <rustc_middle[9f74ec5cb00a905a]::ty::context::GlobalCtxt>::enter::<<rustc_interface[b943f00ad50b5541]::queries::Queries>::ongoing_codegen::{closure#0}, core[6e72eb595340d7ba]::result::Result<alloc[6fd48550c51b5745]::boxed::Box<dyn core[6e72eb595340d7ba]::any::Any>, rustc_span[624dabdd61f2978b]::ErrorGuaranteed>>
  33:     0x7f1bb60b93a2 - <rustc_interface[b943f00ad50b5541]::interface::Compiler>::enter::<rustc_driver_impl[ea51492c730803db]::run_compiler::{closure#1}::{closure#2}, core[6e72eb595340d7ba]::result::Result<core[6e72eb595340d7ba]::option::Option<rustc_interface[b943f00ad50b5541]::queries::Linker>, rustc_span[624dabdd61f2978b]::ErrorGuaranteed>>
  34:     0x7f1bb60b4575 - rustc_span[624dabdd61f2978b]::set_source_map::<core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>, rustc_interface[b943f00ad50b5541]::interface::run_compiler<core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>, rustc_driver_impl[ea51492c730803db]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  35:     0x7f1bb60b3996 - <scoped_tls[8088cff701f74b4a]::ScopedKey<rustc_span[624dabdd61f2978b]::SessionGlobals>>::set::<rustc_interface[b943f00ad50b5541]::interface::run_compiler<core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>, rustc_driver_impl[ea51492c730803db]::run_compiler::{closure#1}>::{closure#0}, core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>>
  36:     0x7f1bb60b2f46 - std[4a840e81aae3439]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b943f00ad50b5541]::util::run_in_thread_pool_with_globals<rustc_interface[b943f00ad50b5541]::interface::run_compiler<core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>, rustc_driver_impl[ea51492c730803db]::run_compiler::{closure#1}>::{closure#0}, core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>>
  37:     0x7f1bb60b2cee - <<std[4a840e81aae3439]::thread::Builder>::spawn_unchecked_<rustc_interface[b943f00ad50b5541]::util::run_in_thread_pool_with_globals<rustc_interface[b943f00ad50b5541]::interface::run_compiler<core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>, rustc_driver_impl[ea51492c730803db]::run_compiler::{closure#1}>::{closure#0}, core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6e72eb595340d7ba]::result::Result<(), rustc_span[624dabdd61f2978b]::ErrorGuaranteed>>::{closure#1} as core[6e72eb595340d7ba]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7f1bb3b75695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h61eb867555625a06
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/alloc/src/boxed.rs:2010:9
  39:     0x7f1bb3b75695 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb80c29f89b136b72
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/alloc/src/boxed.rs:2010:9
  40:     0x7f1bb3b75695 - std::sys::unix::thread::Thread::new::thread_start::hf4205715d65b27a6
                               at /rustc/5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0/library/std/src/sys/unix/thread.rs:108:17
  41:     0x7f1bb390d44b - <unknown>
  42:     0x7f1bb3990e40 - <unknown>
  43:                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 (5bd28f5ea 2023-06-28) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error; 1 warning 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-dyn_star `#![feature(dyn_star)]` labels Jul 3, 2023
@workingjubilee workingjubilee changed the title ICE unexpected TypeKind for left-hand side of dyn* cast: Double ICE unexpected TypeKind for left-hand side of dyn* cast: Double Jul 3, 2023
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-02-20
#107772

@compiler-errors
Copy link
Member

not sure if we should support this or explicitly deny floating point types in the built-in PointerLike impl. kinda leaning towards the latter, but i guess there's no reason (at least in theory) why this shouldn't work and emit a bitcast or sth in llvm.

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 14, 2023
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@matthiaskrgr
Copy link
Member Author

fixed in #133226 from what I can see

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-dyn_star `#![feature(dyn_star)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants