diff --git a/tests/ui/dyn-star/issue-104631.rs b/tests/ui/dyn-star/issue-104631.rs new file mode 100644 index 0000000000000..f5a01df0dae4c --- /dev/null +++ b/tests/ui/dyn-star/issue-104631.rs @@ -0,0 +1,12 @@ +#![feature(dyn_star)] +#![allow(incomplete_features)] + +use std::fmt::Debug; + +#[repr(C)] +#[derive(Debug)] +struct AlignedUsize(usize); + +fn main() { + let _x = AlignedUsize(12) as dyn* Debug; //~ ERROR: `AlignedUsize` needs to have the same ABI as a pointer +} diff --git a/tests/ui/dyn-star/issue-104631.stderr b/tests/ui/dyn-star/issue-104631.stderr new file mode 100644 index 0000000000000..89c633d191ea8 --- /dev/null +++ b/tests/ui/dyn-star/issue-104631.stderr @@ -0,0 +1,11 @@ +error[E0277]: `AlignedUsize` needs to have the same ABI as a pointer + --> $DIR/issue-104631.rs:11:14 + | +LL | let _x = AlignedUsize(12) as dyn* Debug; + | ^^^^^^^^^^^^^^^^ `AlignedUsize` needs to be a pointer-like type + | + = help: the trait `PointerLike` is not implemented for `AlignedUsize` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`.