Skip to content

Commit 6c314a2

Browse files
authored
Rollup merge of #104338 - compiler-errors:pointer-sized, r=eholk
Enforce that `dyn*` coercions are actually pointer-sized Implement a perma-unstable, rudimentary `PointerSized` trait to enforce `dyn*` casts are `usize`-sized for now, at least to prevent ICEs and weird codegen issues from cropping up after monomorphization since currently we enforce *nothing*. This probably can/should be removed in favor of a more sophisticated trait for handling `dyn*` conversions when we decide on one, but I just want to get something up for discussion and experimentation for now. r? ```@eholk``` cc ```@tmandry``` (though feel free to claim/reassign) Fixes #102141 Fixes #102173
2 parents 5805e2a + bbf8ee1 commit 6c314a2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

core/src/marker.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,15 @@ pub trait Destruct {}
809809
#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl)]
810810
pub trait Tuple {}
811811

812+
/// A marker for things
813+
#[unstable(feature = "pointer_sized_trait", issue = "none")]
814+
#[cfg_attr(not(bootstrap), lang = "pointer_sized")]
815+
#[rustc_on_unimplemented(
816+
message = "`{Self}` needs to be a pointer-sized type",
817+
label = "`{Self}` needs to be a pointer-sized type"
818+
)]
819+
pub trait PointerSized {}
820+
812821
/// Implementations of `Copy` for primitive types.
813822
///
814823
/// Implementations that cannot be described in Rust

0 commit comments

Comments
 (0)