about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-11-12 22:27:18 +0000
committerMichael Goulet <michael@errs.io>2022-11-18 18:23:48 +0000
commitda3c5397a614f790f0daaf61bfdc692b36719e01 (patch)
treec9d5a60b09264d18e19cf9af81f763d44ac431f7 /library/core/src
parentfd3bfb35511cbcff59ce1454d3db627b576d7e92 (diff)
downloadrust-da3c5397a614f790f0daaf61bfdc692b36719e01.tar.gz
rust-da3c5397a614f790f0daaf61bfdc692b36719e01.zip
Enforce that dyn* casts are actually pointer-sized
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/marker.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs
index 3eff6033f8d..42c34280197 100644
--- a/library/core/src/marker.rs
+++ b/library/core/src/marker.rs
@@ -809,6 +809,15 @@ pub trait Destruct {}
 #[cfg_attr(not(bootstrap), rustc_deny_explicit_impl)]
 pub trait Tuple {}
 
+/// A marker for things
+#[unstable(feature = "pointer_sized_trait", issue = "none")]
+#[cfg_attr(not(bootstrap), lang = "pointer_sized")]
+#[rustc_on_unimplemented(
+    message = "`{Self}` needs to be a pointer-sized type",
+    label = "`{Self}` needs to be a pointer-sized type"
+)]
+pub trait PointerSized {}
+
 /// Implementations of `Copy` for primitive types.
 ///
 /// Implementations that cannot be described in Rust