Closed
Description
auto-reduced (treereduce-rust):
#![feature(dyn_star)]
trait Trait {}
fn main() {
let x: dyn* Trait + Send = 1usize;
x as dyn* Trait;
}
original:
#![allow(incomplete_features)]
#![feature(dyn_star)]
trait Trait {}
impl Trait for usize {}
fn main() {
// We allow &dyn Trait + Send -> &dyn Send (i.e. dropping principal),
// but we don't (currently?) allow the same for dyn*
let x: dyn* Trait + Send = 1usize;
x as dyn* Trait; //~ error: `dyn* Trait + Send` needs to have the same ABI as a pointer
}
Version information
rustc 1.84.0-nightly (788202a2c 2024-10-25)
binary: rustc
commit-hash: 788202a2cef5dde0743490fd51515f373d4207a6
commit-date: 2024-10-25
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1
Possibly related line of code:
rust/compiler/rustc_hir_typeck/src/cast.rs
Lines 719 to 731 in 788202a
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
--> /tmp/icemaker_global_tempdir.CwzM23YOfQY1/rustc_testrunner_tmpdir_reporting.Lix3JMAxVVt9/mvce.rs:1:12
|
1 | #![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[E0277]: the trait bound `usize: Trait` is not satisfied
--> /tmp/icemaker_global_tempdir.CwzM23YOfQY1/rustc_testrunner_tmpdir_reporting.Lix3JMAxVVt9/mvce.rs:6:32
|
6 | let x: dyn* Trait + Send = 1usize;
| ^^^^^^ the trait `Trait` is not implemented for `usize`
|
help: this trait has no implementations, consider adding one
--> /tmp/icemaker_global_tempdir.CwzM23YOfQY1/rustc_testrunner_tmpdir_reporting.Lix3JMAxVVt9/mvce.rs:3:1
|
3 | trait Trait {}
| ^^^^^^^^^^^
error: internal compiler error: compiler/rustc_hir_typeck/src/cast.rs:725:17: should be handled by `coerce`
--> /tmp/icemaker_global_tempdir.CwzM23YOfQY1/rustc_testrunner_tmpdir_reporting.Lix3JMAxVVt9/mvce.rs:7:5
|
7 | x as dyn* Trait;
| ^^^^^^^^^^^^^^^
thread 'rustc' panicked at compiler/rustc_hir_typeck/src/cast.rs:725:17:
Box<dyn Any>
stack backtrace:
0: 0x7394ab49d63a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h5e8099de960d4cc6
1: 0x7394abc041ca - core::fmt::write::hf87b533eacaf516a
2: 0x7394acea72d1 - std::io::Write::write_fmt::hb58c604a9dfe85f1
3: 0x7394ab49d492 - std::sys::backtrace::BacktraceLock::print::h922a09e37c27473c
4: 0x7394ab49f996 - std::panicking::default_hook::{{closure}}::ha4ce1ceabb39d9dc
5: 0x7394ab49f7e0 - std::panicking::default_hook::hdbfa0836e0b339ee
6: 0x7394aa51d2ef - std[a585c2783b39f442]::panicking::update_hook::<alloc[4209cb77a293fca]::boxed::Box<rustc_driver_impl[a403acafb158cb6a]::install_ice_hook::{closure#0}>>::{closure#0}
7: 0x7394ab4a00a8 - std::panicking::rust_panic_with_hook::h87bc2ca479f0c940
8: 0x7394aa556971 - std[a585c2783b39f442]::panicking::begin_panic::<rustc_errors[5a9eb276510fb09c]::ExplicitBug>::{closure#0}
9: 0x7394aa549916 - std[a585c2783b39f442]::sys::backtrace::__rust_end_short_backtrace::<std[a585c2783b39f442]::panicking::begin_panic<rustc_errors[5a9eb276510fb09c]::ExplicitBug>::{closure#0}, !>
10: 0x7394aa544f19 - std[a585c2783b39f442]::panicking::begin_panic::<rustc_errors[5a9eb276510fb09c]::ExplicitBug>
11: 0x7394aa5604e1 - <rustc_errors[5a9eb276510fb09c]::diagnostic::BugAbort as rustc_errors[5a9eb276510fb09c]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
12: 0x7394a91023d0 - <rustc_errors[5a9eb276510fb09c]::DiagCtxtHandle>::span_bug::<rustc_span[babd1ca03564a0eb]::span_encoding::Span, alloc[4209cb77a293fca]::string::String>
13: 0x7394aa7d0777 - rustc_middle[5b3bbff2208691d6]::util::bug::opt_span_bug_fmt::<rustc_span[babd1ca03564a0eb]::span_encoding::Span>::{closure#0}
14: 0x7394aa7d479a - rustc_middle[5b3bbff2208691d6]::ty::context::tls::with_opt::<rustc_middle[5b3bbff2208691d6]::util::bug::opt_span_bug_fmt<rustc_span[babd1ca03564a0eb]::span_encoding::Span>::{closure#0}, !>::{closure#0}
15: 0x7394aa77ea4b - rustc_middle[5b3bbff2208691d6]::ty::context::tls::with_context_opt::<rustc_middle[5b3bbff2208691d6]::ty::context::tls::with_opt<rustc_middle[5b3bbff2208691d6]::util::bug::opt_span_bug_fmt<rustc_span[babd1ca03564a0eb]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
16: 0x7394a8a1fcc7 - rustc_middle[5b3bbff2208691d6]::util::bug::span_bug_fmt::<rustc_span[babd1ca03564a0eb]::span_encoding::Span>
17: 0x7394acd504f3 - <rustc_hir_typeck[fef8322e73e6f38e]::cast::CastCheck>::do_check
18: 0x7394abfb2635 - <rustc_hir_typeck[fef8322e73e6f38e]::fn_ctxt::FnCtxt>::check_casts
19: 0x7394abfb3a1f - rustc_hir_typeck[fef8322e73e6f38e]::typeck
20: 0x7394abfb3307 - rustc_query_impl[cf4848b6d652eea9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cf4848b6d652eea9]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5b3bbff2208691d6]::query::erase::Erased<[u8; 8usize]>>
21: 0x7394abda3d81 - rustc_query_system[b2d751a8ce89225a]::query::plumbing::try_execute_query::<rustc_query_impl[cf4848b6d652eea9]::DynamicConfig<rustc_query_system[b2d751a8ce89225a]::query::caches::VecCache<rustc_span[babd1ca03564a0eb]::def_id::LocalDefId, rustc_middle[5b3bbff2208691d6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[cf4848b6d652eea9]::plumbing::QueryCtxt, false>
22: 0x7394abda23cd - rustc_query_impl[cf4848b6d652eea9]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
23: 0x7394abda2047 - <rustc_middle[5b3bbff2208691d6]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[e81663bf6ec75b26]::check_crate::{closure#4}>::{closure#0}
24: 0x7394abd9ff1c - rustc_hir_analysis[e81663bf6ec75b26]::check_crate
25: 0x7394ac49e117 - rustc_interface[14453d2331067b08]::passes::run_required_analyses
26: 0x7394ac985a1e - rustc_interface[14453d2331067b08]::passes::analysis
27: 0x7394ac9859f1 - rustc_query_impl[cf4848b6d652eea9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[cf4848b6d652eea9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5b3bbff2208691d6]::query::erase::Erased<[u8; 1usize]>>
28: 0x7394acb471ee - rustc_query_system[b2d751a8ce89225a]::query::plumbing::try_execute_query::<rustc_query_impl[cf4848b6d652eea9]::DynamicConfig<rustc_query_system[b2d751a8ce89225a]::query::caches::SingleCache<rustc_middle[5b3bbff2208691d6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[cf4848b6d652eea9]::plumbing::QueryCtxt, false>
29: 0x7394acb46ecf - rustc_query_impl[cf4848b6d652eea9]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
30: 0x7394aca265b1 - rustc_interface[14453d2331067b08]::interface::run_compiler::<core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>, rustc_driver_impl[a403acafb158cb6a]::run_compiler::{closure#0}>::{closure#1}
31: 0x7394aca996d4 - std[a585c2783b39f442]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[14453d2331067b08]::util::run_in_thread_with_globals<rustc_interface[14453d2331067b08]::util::run_in_thread_pool_with_globals<rustc_interface[14453d2331067b08]::interface::run_compiler<core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>, rustc_driver_impl[a403acafb158cb6a]::run_compiler::{closure#0}>::{closure#1}, core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>>::{closure#0}, core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>>
32: 0x7394aca99b0d - <<std[a585c2783b39f442]::thread::Builder>::spawn_unchecked_<rustc_interface[14453d2331067b08]::util::run_in_thread_with_globals<rustc_interface[14453d2331067b08]::util::run_in_thread_pool_with_globals<rustc_interface[14453d2331067b08]::interface::run_compiler<core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>, rustc_driver_impl[a403acafb158cb6a]::run_compiler::{closure#0}>::{closure#1}, core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>>::{closure#0}, core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c9fb322ef39a2568]::result::Result<(), rustc_span[babd1ca03564a0eb]::ErrorGuaranteed>>::{closure#1} as core[c9fb322ef39a2568]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
33: 0x7394aca9a5ab - std::sys::pal::unix::thread::Thread::new::thread_start::h197af60b272f0d26
34: 0x7394ae2d239d - <unknown>
35: 0x7394ae35749c - <unknown>
36: 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: rustc 1.84.0-nightly (788202a2c 2024-10-25) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.
@rustbot label +F-dyn_star
Metadata
Metadata
Assignees
Labels
Category: This is a bug.`#![feature(dyn_star)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: This bug is tracked inside the repo by a `known-bug` test.Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires the use of incomplete features.