Skip to content

ICE: should be handled by try_coerce #103679

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

// run-pass
// ignore-test
#![feature(async_fn_in_traits)]

use std::fmt::Debug;

fn make_dyn_star() {
    let i = 42usize;
    let dyn_i: dyn* Debug = i as dyn* Debug;
}

fn main() {
    make_dyn_star();
}

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (cdd7afeaa 2022-10-28)
binary: rustc
commit-hash: cdd7afeaadf1c48eafb4dff4452439fa5d13a775
commit-date: 2022-10-28
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2

Error output

error[E0658]: dyn* trait objects are unstable
 --> c4/c4861de3606c72581367a7bc13935149e898b1bf.rs:9:16
  |
9 |     let dyn_i: dyn* Debug = i as dyn* Debug;
  |                ^^^^^^^^^^
  |
  = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
  = help: add `#![feature(dyn_star)]` to the crate attributes to enable

error[E0658]: dyn* trait objects are unstable
 --> c4/c4861de3606c72581367a7bc13935149e898b1bf.rs:9:34
  |
9 |     let dyn_i: dyn* Debug = i as dyn* Debug;
  |                                  ^^^^^^^^^^
  |
  = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
  = help: add `#![feature(dyn_star)]` to the crate attributes to enable

error[E0635]: unknown feature `async_fn_in_traits`
 --> c4/c4861de3606c72581367a7bc13935149e898b1bf.rs:3:12
  |
3 | #![feature(async_fn_in_traits)]
Backtrace


error: internal compiler error: compiler/rustc_hir_typeck/src/cast.rs:869:44: should be handled by `try_coerce`

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/compiler/rustc_errors/src/lib.rs:1519:9
stack backtrace:
   0:     0x7fe8b30d03b0 - std::backtrace_rs::backtrace::libunwind::trace::hb4ef3406e7eb47ce
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fe8b30d03b0 - std::backtrace_rs::backtrace::trace_unsynchronized::h25f6e1d95cb319c1
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe8b30d03b0 - std::sys_common::backtrace::_print_fmt::hb8be2cdd244e6902
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fe8b30d03b0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hda00a3f2e54587f1
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fe8af2597ae - core::fmt::write::h53a53791453047cc
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/core/src/fmt/mod.rs:1209:17
   5:     0x7fe8b30c4105 - std::io::Write::write_fmt::h7b6d7a2aeb8adb88
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/io/mod.rs:1682:15
   6:     0x7fe8b30d0175 - std::sys_common::backtrace::_print::ha43aeb07ddc601da
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fe8b30d0175 - std::sys_common::backtrace::print::ha6c89b98495635e0
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fe8b30d24cf - std::panicking::default_hook::{{closure}}::hd2eb369ad351a35a
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/panicking.rs:267:22
   9:     0x7fe8b30d220a - std::panicking::default_hook::hd70a25c3efe76217
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/panicking.rs:286:9
  10:     0x7fe8b2390494 - rustc_driver[ab73b9e58d2e1dba]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fe8b30d2cb9 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h3fe2edd895a103fd
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/alloc/src/boxed.rs:2001:9
  12:     0x7fe8b30d2cb9 - std::panicking::rust_panic_with_hook::h07c07cfa0cdbee6c
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/panicking.rs:692:13
  13:     0x7fe8b27ba8e1 - std[8453137eb5554c7d]::panicking::begin_panic::<rustc_errors[3b1d7ceca71c8e60]::ExplicitBug>::{closure#0}
  14:     0x7fe8b27ba456 - std[8453137eb5554c7d]::sys_common::backtrace::__rust_end_short_backtrace::<std[8453137eb5554c7d]::panicking::begin_panic<rustc_errors[3b1d7ceca71c8e60]::ExplicitBug>::{closure#0}, !>
  15:     0x7fe8b28244e6 - std[8453137eb5554c7d]::panicking::begin_panic::<rustc_errors[3b1d7ceca71c8e60]::ExplicitBug>
  16:     0x7fe8b27ba446 - std[8453137eb5554c7d]::panic::panic_any::<rustc_errors[3b1d7ceca71c8e60]::ExplicitBug>
  17:     0x7fe8b27b933d - <rustc_errors[3b1d7ceca71c8e60]::HandlerInner>::bug::<&alloc[b7bbd2d610a595b4]::string::String>
  18:     0x7fe8b27b8db0 - <rustc_errors[3b1d7ceca71c8e60]::Handler>::bug::<&alloc[b7bbd2d610a595b4]::string::String>
  19:     0x7fe8b286c7c5 - rustc_middle[36935efcc9ff0447]::ty::context::tls::with_context_opt::<rustc_middle[36935efcc9ff0447]::ty::context::tls::with_opt<rustc_middle[36935efcc9ff0447]::util::bug::opt_span_bug_fmt<rustc_span[1d42e43634dce869]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7fe8b286cb06 - rustc_middle[36935efcc9ff0447]::util::bug::opt_span_bug_fmt::<rustc_span[1d42e43634dce869]::span_encoding::Span>
  21:     0x7fe8b0600313 - rustc_middle[36935efcc9ff0447]::util::bug::bug_fmt
  22:     0x7fe8b18a0036 - <rustc_hir_typeck[d6b0a1987134370a]::cast::CastCheck>::do_check
  23:     0x7fe8b189ee7f - <rustc_hir_typeck[d6b0a1987134370a]::cast::CastCheck>::check
  24:     0x7fe8b10ec2dd - rustc_hir_typeck[d6b0a1987134370a]::typeck
  25:     0x7fe8b089f74d - rustc_query_system[ab472faff9e9f141]::query::plumbing::try_execute_query::<rustc_query_impl[552fc18a28594de3]::plumbing::QueryCtxt, rustc_query_system[ab472faff9e9f141]::query::caches::DefaultCache<rustc_span[1d42e43634dce869]::def_id::LocalDefId, &rustc_middle[36935efcc9ff0447]::ty::context::TypeckResults>>
  26:     0x7fe8b1b7c618 - rustc_data_structures[901ee3928bd5aeb7]::sync::par_for_each_in::<&[rustc_span[1d42e43634dce869]::def_id::LocalDefId], <rustc_middle[36935efcc9ff0447]::hir::map::Map>::par_body_owners<rustc_hir_typeck[d6b0a1987134370a]::typeck_item_bodies::{closure#0}>::{closure#0}>
  27:     0x7fe8b1b7c2f3 - rustc_hir_typeck[d6b0a1987134370a]::typeck_item_bodies
  28:     0x7fe8b1a6e01a - rustc_query_system[ab472faff9e9f141]::query::plumbing::try_execute_query::<rustc_query_impl[552fc18a28594de3]::plumbing::QueryCtxt, rustc_query_system[ab472faff9e9f141]::query::caches::DefaultCache<(), ()>>
  29:     0x7fe8b1a6dd17 - rustc_query_system[ab472faff9e9f141]::query::plumbing::get_query::<rustc_query_impl[552fc18a28594de3]::queries::typeck_item_bodies, rustc_query_impl[552fc18a28594de3]::plumbing::QueryCtxt>
  30:     0x7fe8b07a949a - <rustc_session[1c2c2477ca700f6c]::session::Session>::time::<(), rustc_hir_analysis[867fc50c26c8f856]::check_crate::{closure#7}>
  31:     0x7fe8b07a865b - rustc_hir_analysis[867fc50c26c8f856]::check_crate
  32:     0x7fe8b07a828b - rustc_interface[8a575e07fa7b7164]::passes::analysis
  33:     0x7fe8b1bd8da4 - rustc_query_system[ab472faff9e9f141]::query::plumbing::try_execute_query::<rustc_query_impl[552fc18a28594de3]::plumbing::QueryCtxt, rustc_query_system[ab472faff9e9f141]::query::caches::DefaultCache<(), core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>>>
  34:     0x7fe8b1bd8aa7 - rustc_query_system[ab472faff9e9f141]::query::plumbing::get_query::<rustc_query_impl[552fc18a28594de3]::queries::analysis, rustc_query_impl[552fc18a28594de3]::plumbing::QueryCtxt>
  35:     0x7fe8b1704ccd - <rustc_interface[8a575e07fa7b7164]::passes::QueryContext>::enter::<rustc_driver[ab73b9e58d2e1dba]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>>
  36:     0x7fe8b170117f - <rustc_interface[8a575e07fa7b7164]::interface::Compiler>::enter::<rustc_driver[ab73b9e58d2e1dba]::run_compiler::{closure#1}::{closure#2}, core[23ab2a889e379d11]::result::Result<core[23ab2a889e379d11]::option::Option<rustc_interface[8a575e07fa7b7164]::queries::Linker>, rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>>
  37:     0x7fe8b16f8cc2 - rustc_span[1d42e43634dce869]::with_source_map::<core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>, rustc_interface[8a575e07fa7b7164]::interface::run_compiler<core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>, rustc_driver[ab73b9e58d2e1dba]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  38:     0x7fe8b16f87b9 - <scoped_tls[5bf8574dfc593ff5]::ScopedKey<rustc_span[1d42e43634dce869]::SessionGlobals>>::set::<rustc_interface[8a575e07fa7b7164]::interface::run_compiler<core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>, rustc_driver[ab73b9e58d2e1dba]::run_compiler::{closure#1}>::{closure#0}, core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>>
  39:     0x7fe8b16f7dc8 - std[8453137eb5554c7d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8a575e07fa7b7164]::util::run_in_thread_pool_with_globals<rustc_interface[8a575e07fa7b7164]::interface::run_compiler<core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>, rustc_driver[ab73b9e58d2e1dba]::run_compiler::{closure#1}>::{closure#0}, core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>>
  40:     0x7fe8b16f7aec - <<std[8453137eb5554c7d]::thread::Builder>::spawn_unchecked_<rustc_interface[8a575e07fa7b7164]::util::run_in_thread_pool_with_globals<rustc_interface[8a575e07fa7b7164]::interface::run_compiler<core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>, rustc_driver[ab73b9e58d2e1dba]::run_compiler::{closure#1}>::{closure#0}, core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[23ab2a889e379d11]::result::Result<(), rustc_errors[3b1d7ceca71c8e60]::ErrorGuaranteed>>::{closure#1} as core[23ab2a889e379d11]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7fe8b30d9c23 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h56eec3ce25537508
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/alloc/src/boxed.rs:1987:9
  42:     0x7fe8b30d9c23 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1612601d3b38f53a
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/alloc/src/boxed.rs:1987:9
  43:     0x7fe8b30d9c23 - std::sys::unix::thread::Thread::new::thread_start::h1e373bfde99d27ee
                               at /rustc/0da281b6068a7d889ae89a9bd8991284cc9b7535/library/std/src/sys/unix/thread.rs:108:17
  44:     0x7fe8aef608fd - <unknown>
  45:     0x7fe8aefe2a60 - <unknown>
  46:                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 (0da281b60 2022-10-27) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `make_dyn_star`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0635, E0658.
For more information about an error, try `rustc --explain E0635`.

Metadata

Metadata

Labels

C-bugCategory: This is a bug.F-dyn_star`#![feature(dyn_star)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions