File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -613,12 +613,14 @@ impl dyn Any + Send + Sync {
613613///
614614/// # Layout
615615///
616- /// Like other [`Rust`-representation][repr-rust] types, `TypeId`'s size and layout are unstable.
617- /// In particular, this means that you cannot rely on the size and layout of `TypeId` remaining the
618- /// same between Rust releases; they are subject to change without prior notice between Rust
619- /// releases.
616+ /// The size of `TypeId` is guaranteed not to exceed 16 bytes.
620617///
621- /// [repr-rust]: https://doc.rust-lang.org/reference/type-layout.html#r-layout.repr.rust.unspecified
618+ /// This is the only guarantee given; any other layout or implementation details
619+ /// are unstable and prone to change between Rust releases without prior notice.
620+ ///
621+ /// ```
622+ /// assert!(size_of::<std::any::TypeId>() <= 16);
623+ /// ```
622624///
623625/// # Danger of Improper Variance
624626///
@@ -714,6 +716,7 @@ impl dyn Any + Send + Sync {
714716/// std::mem::forget(fake_one_ring);
715717/// }
716718/// ```
719+ #[ repr( C ) ]
717720#[ derive( Copy , PartialOrd , Ord ) ]
718721#[ derive_const( Clone , Eq ) ]
719722#[ stable( feature = "rust1" , since = "1.0.0" ) ]
You can’t perform that action at this time.
0 commit comments