#![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
}
auto-reduced (treereduce-rust):
original:
Version information
Possibly related line of code: https://github.com/rust-lang/rust/blob/788202a2cef5dde0743490fd51515f373d4207a6/compiler/rustc_hir_typeck/src/cast.rs#L719-L731
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 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
stack backtrace:
0: 0x7394ab49d63a - ::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::>::{closure#0}
7: 0x7394ab4a00a8 - std::panicking::rust_panic_with_hook::h87bc2ca479f0c940
8: 0x7394aa556971 - std[a585c2783b39f442]::panicking::begin_panic::::{closure#0}
9: 0x7394aa549916 - std[a585c2783b39f442]::sys::backtrace::__rust_end_short_backtrace::::{closure#0}, !>
10: 0x7394aa544f19 - std[a585c2783b39f442]::panicking::begin_panic::
11: 0x7394aa5604e1 - ::emit_producing_guarantee
12: 0x7394a91023d0 - ::span_bug::
13: 0x7394aa7d0777 - rustc_middle[5b3bbff2208691d6]::util::bug::opt_span_bug_fmt::::{closure#0}
14: 0x7394aa7d479a - rustc_middle[5b3bbff2208691d6]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0}
15: 0x7394aa77ea4b - rustc_middle[5b3bbff2208691d6]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !>
16: 0x7394a8a1fcc7 - rustc_middle[5b3bbff2208691d6]::util::bug::span_bug_fmt::
17: 0x7394acd504f3 - ::do_check
18: 0x7394abfb2635 - ::check_casts
19: 0x7394abfb3a1f - rustc_hir_typeck[fef8322e73e6f38e]::typeck
20: 0x7394abfb3307 - rustc_query_impl[cf4848b6d652eea9]::plumbing::__rust_begin_short_backtrace::>
21: 0x7394abda3d81 - rustc_query_system[b2d751a8ce89225a]::query::plumbing::try_execute_query::>, 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 - ::par_body_owners::::{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::>
28: 0x7394acb471ee - rustc_query_system[b2d751a8ce89225a]::query::plumbing::try_execute_query::>, 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::, rustc_driver_impl[a403acafb158cb6a]::run_compiler::{closure#0}>::{closure#1}
31: 0x7394aca996d4 - std[a585c2783b39f442]::sys::backtrace::__rust_begin_short_backtrace::, 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 - <::spawn_unchecked_, 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 -
35: 0x7394ae35749c -
36: 0x0 -
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