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

dyn* to -> impl Trait ICE's #102459

Closed
DutchGhost opened this issue Sep 29, 2022 · 1 comment
Closed

dyn* to -> impl Trait ICE's #102459

DutchGhost opened this issue Sep 29, 2022 · 1 comment
Labels
C-bug Category: This is a bug. 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

@DutchGhost
Copy link
Contributor

DutchGhost commented Sep 29, 2022

Code

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

use std::fmt::Display;

fn bug() -> impl Display {
    // This reference seems to be evil.
    // `1 as dyn* Display` compiles fine!
    &1 as dyn* Display
}

fn main() {
    let x = bug();

    println!("{x}");
}

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (ce7f0f1aa 2022-09-28)

Error output

thread 'rustc' panicked at 'assertion failed: bx.cx().is_backend_immediate(cast)', /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:298:25
Backtrace

   Compiling playground v0.0.1 (/playground)
thread 'rustc' panicked at 'assertion failed: bx.cx().is_backend_immediate(cast)', /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/compiler/rustc_codegen_ssa/src/mir/rvalue.rs:298:25
stack backtrace:
   0:     0x7f382805e170 - std::backtrace_rs::backtrace::libunwind::trace::hac9b0f7f9661e748
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f382805e170 - std::backtrace_rs::backtrace::trace_unsynchronized::hc44795987fc42d34
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f382805e170 - std::sys_common::backtrace::_print_fmt::h11541e17c3fc86a7
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f382805e170 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc17ff1666cc882db
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f38280b8e2e - core::fmt::write::h55fcab10ae826150
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f382804edb5 - std::io::Write::write_fmt::hf963d6d18d14f181
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/io/mod.rs:1679:15
   6:     0x7f3828060ef3 - std::sys_common::backtrace::_print::h994ce2c0e5b405c8
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3828060ef3 - std::sys_common::backtrace::print::hcc56026dcd969e04
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3828060ef3 - std::panicking::default_hook::{{closure}}::h88f2c5d855241086
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/panicking.rs:267:22
   9:     0x7f3828060bdf - std::panicking::default_hook::h8c95d81babfc3452
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/panicking.rs:286:9
  10:     0x7f382a896801 - rustc_driver[b4131074c7377c18]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f382806172b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h67c5cbe4132c274b
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/alloc/src/boxed.rs:1952:9
  12:     0x7f382806172b - std::panicking::rust_panic_with_hook::h60207dae86acc93c
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/panicking.rs:673:13
  13:     0x7f3828061541 - std::panicking::begin_panic_handler::{{closure}}::h417b25e282e7bdd0
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/panicking.rs:558:13
  14:     0x7f382805e61c - std::sys_common::backtrace::__rust_end_short_backtrace::hed3dc7a8acb54b37
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:138:18
  15:     0x7f38280612a2 - rust_begin_unwind
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/panicking.rs:556:5
  16:     0x7f38280b5a03 - core::panicking::panic_fmt::h33353e845faa36b7
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/core/src/panicking.rs:142:14
  17:     0x7f38280b584d - core::panicking::panic::hd7761ecf6f9e50e5
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/core/src/panicking.rs:48:5
  18:     0x7f38297e8754 - <rustc_codegen_ssa[d2b69af56ae265d2]::mir::FunctionCx<rustc_codegen_llvm[d08276be3b0a586e]::builder::Builder>>::codegen_block
  19:     0x7f38297d71a6 - rustc_codegen_ssa[d2b69af56ae265d2]::mir::codegen_mir::<rustc_codegen_llvm[d08276be3b0a586e]::builder::Builder>
  20:     0x7f3829c7d754 - rustc_codegen_llvm[d08276be3b0a586e]::base::compile_codegen_unit::module_codegen
  21:     0x7f382a599c17 - <rustc_query_system[1ae1527ce801643f]::dep_graph::graph::DepGraph<rustc_middle[c8d33145a5f03cc8]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[c8d33145a5f03cc8]::ty::context::TyCtxt, rustc_span[a9093c78adc8a30e]::symbol::Symbol, rustc_codegen_ssa[d2b69af56ae265d2]::ModuleCodegen<rustc_codegen_llvm[d08276be3b0a586e]::ModuleLlvm>>
  22:     0x7f382a599a19 - rustc_codegen_llvm[d08276be3b0a586e]::base::compile_codegen_unit
  23:     0x7f382a37c26d - rustc_codegen_ssa[d2b69af56ae265d2]::base::codegen_crate::<rustc_codegen_llvm[d08276be3b0a586e]::LlvmCodegenBackend>
  24:     0x7f382a37ba6d - <rustc_codegen_llvm[d08276be3b0a586e]::LlvmCodegenBackend as rustc_codegen_ssa[d2b69af56ae265d2]::traits::backend::CodegenBackend>::codegen_crate
  25:     0x7f38296b383c - <rustc_session[d3255eaf8224a584]::session::Session>::time::<alloc[c8bb264001a6b8ff]::boxed::Box<dyn core[de81bf0691074480]::any::Any>, rustc_interface[f0f2c906f605917e]::passes::start_codegen::{closure#0}>
  26:     0x7f38296b321e - <rustc_interface[f0f2c906f605917e]::passes::QueryContext>::enter::<<rustc_interface[f0f2c906f605917e]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[de81bf0691074480]::result::Result<alloc[c8bb264001a6b8ff]::boxed::Box<dyn core[de81bf0691074480]::any::Any>, rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>
  27:     0x7f3829673093 - <rustc_interface[f0f2c906f605917e]::queries::Queries>::ongoing_codegen
  28:     0x7f382967133a - rustc_interface[f0f2c906f605917e]::interface::create_compiler_and_run::<core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>, rustc_driver[b4131074c7377c18]::run_compiler::{closure#1}>
  29:     0x7f382966fc41 - <scoped_tls[77ed516bf348563d]::ScopedKey<rustc_span[a9093c78adc8a30e]::SessionGlobals>>::set::<rustc_interface[f0f2c906f605917e]::interface::run_compiler<core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>, rustc_driver[b4131074c7377c18]::run_compiler::{closure#1}>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>
  30:     0x7f382966f92f - std[1bac5bf8d99344e6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f0f2c906f605917e]::util::run_in_thread_pool_with_globals<rustc_interface[f0f2c906f605917e]::interface::run_compiler<core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>, rustc_driver[b4131074c7377c18]::run_compiler::{closure#1}>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>
  31:     0x7f382a6f8600 - <<std[1bac5bf8d99344e6]::thread::Builder>::spawn_unchecked_<rustc_interface[f0f2c906f605917e]::util::run_in_thread_pool_with_globals<rustc_interface[f0f2c906f605917e]::interface::run_compiler<core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>, rustc_driver[b4131074c7377c18]::run_compiler::{closure#1}>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>::{closure#1} as core[de81bf0691074480]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7f382806b393 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd5e3cab38cec9739
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/alloc/src/boxed.rs:1938:9
  33:     0x7f382806b393 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h970a034a5216df96
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/alloc/src/boxed.rs:1938:9
  34:     0x7f382806b393 - std::sys::unix::thread::Thread::new::thread_start::h19f111f22a37ea01
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys/unix/thread.rs:108:17
  35:     0x7f3827f3e609 - start_thread
  36:     0x7f3827e61133 - clone
  37:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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.66.0-nightly (ce7f0f1aa 2022-09-28) running on x86_64-unknown-linux-gnu

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: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in DefId(0:6 ~ playground[53a0]::bug) (move _2 as dyn* std::fmt::Display (Pointer(ArrayToPointer))): ArrayToPointer cast from unexpected type &i32
 --> src/main.rs:7:5
  |
7 |     &1 as dyn* Display
  |     ^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:2125:29

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1530:13
stack backtrace:
   0:     0x7f382805e170 - std::backtrace_rs::backtrace::libunwind::trace::hac9b0f7f9661e748
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f382805e170 - std::backtrace_rs::backtrace::trace_unsynchronized::hc44795987fc42d34
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f382805e170 - std::sys_common::backtrace::_print_fmt::h11541e17c3fc86a7
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f382805e170 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc17ff1666cc882db
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f38280b8e2e - core::fmt::write::h55fcab10ae826150
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/core/src/fmt/mod.rs:1209:17
   5:     0x7f382804edb5 - std::io::Write::write_fmt::hf963d6d18d14f181
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/io/mod.rs:1679:15
   6:     0x7f3828060ef3 - std::sys_common::backtrace::_print::h994ce2c0e5b405c8
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f3828060ef3 - std::sys_common::backtrace::print::hcc56026dcd969e04
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f3828060ef3 - std::panicking::default_hook::{{closure}}::h88f2c5d855241086
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/panicking.rs:267:22
   9:     0x7f3828060bdf - std::panicking::default_hook::h8c95d81babfc3452
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/panicking.rs:286:9
  10:     0x7f382a896801 - rustc_driver[b4131074c7377c18]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f382806172b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h67c5cbe4132c274b
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/alloc/src/boxed.rs:1952:9
  12:     0x7f382806172b - std::panicking::rust_panic_with_hook::h60207dae86acc93c
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/panicking.rs:673:13
  13:     0x7f382b9af701 - std[1bac5bf8d99344e6]::panicking::begin_panic::<rustc_errors[6dd3b64aee5d90d7]::ExplicitBug>::{closure#0}
  14:     0x7f382b9ae026 - std[1bac5bf8d99344e6]::sys_common::backtrace::__rust_end_short_backtrace::<std[1bac5bf8d99344e6]::panicking::begin_panic<rustc_errors[6dd3b64aee5d90d7]::ExplicitBug>::{closure#0}, !>
  15:     0x7f382b9a7fb6 - std[1bac5bf8d99344e6]::panicking::begin_panic::<rustc_errors[6dd3b64aee5d90d7]::ExplicitBug>
  16:     0x7f382b9aa7d6 - std[1bac5bf8d99344e6]::panic::panic_any::<rustc_errors[6dd3b64aee5d90d7]::ExplicitBug>
  17:     0x7f382a4031c8 - <rustc_errors[6dd3b64aee5d90d7]::HandlerInner as core[de81bf0691074480]::ops::drop::Drop>::drop
  18:     0x7f38296b9468 - core[de81bf0691074480]::ptr::drop_in_place::<rustc_session[d3255eaf8224a584]::parse::ParseSess>
  19:     0x7f38296773b8 - <alloc[c8bb264001a6b8ff]::rc::Rc<rustc_session[d3255eaf8224a584]::session::Session> as core[de81bf0691074480]::ops::drop::Drop>::drop
  20:     0x7f382967408d - core[de81bf0691074480]::ptr::drop_in_place::<rustc_interface[f0f2c906f605917e]::interface::Compiler>
  21:     0x7f3829672144 - rustc_interface[f0f2c906f605917e]::interface::create_compiler_and_run::<core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>, rustc_driver[b4131074c7377c18]::run_compiler::{closure#1}>
  22:     0x7f382966fc41 - <scoped_tls[77ed516bf348563d]::ScopedKey<rustc_span[a9093c78adc8a30e]::SessionGlobals>>::set::<rustc_interface[f0f2c906f605917e]::interface::run_compiler<core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>, rustc_driver[b4131074c7377c18]::run_compiler::{closure#1}>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>
  23:     0x7f382966f92f - std[1bac5bf8d99344e6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f0f2c906f605917e]::util::run_in_thread_pool_with_globals<rustc_interface[f0f2c906f605917e]::interface::run_compiler<core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>, rustc_driver[b4131074c7377c18]::run_compiler::{closure#1}>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>
  24:     0x7f382a6f8600 - <<std[1bac5bf8d99344e6]::thread::Builder>::spawn_unchecked_<rustc_interface[f0f2c906f605917e]::util::run_in_thread_pool_with_globals<rustc_interface[f0f2c906f605917e]::interface::run_compiler<core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>, rustc_driver[b4131074c7377c18]::run_compiler::{closure#1}>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>::{closure#0}, core[de81bf0691074480]::result::Result<(), rustc_errors[6dd3b64aee5d90d7]::ErrorGuaranteed>>::{closure#1} as core[de81bf0691074480]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f382806b393 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd5e3cab38cec9739
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/alloc/src/boxed.rs:1938:9
  26:     0x7f382806b393 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h970a034a5216df96
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/alloc/src/boxed.rs:1938:9
  27:     0x7f382806b393 - std::sys::unix::thread::Thread::new::thread_start::h19f111f22a37ea01
                               at /rustc/ce7f0f1aa0f02c45cad0749e63f3086234b1f422/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f3827f3e609 - start_thread
  29:     0x7f3827e61133 - clone
  30:                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.66.0-nightly (ce7f0f1aa 2022-09-28) running on x86_64-unknown-linux-gnu

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
thread panicked while panicking. aborting.
error: could not compile `playground`

@DutchGhost DutchGhost added C-bug Category: This is a bug. 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. labels Sep 29, 2022
@DutchGhost
Copy link
Contributor Author

Oh, is a dupe of #102430, but with a smaller test case.

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. 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
Development

No branches or pull requests

1 participant