diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-19 18:03:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-19 18:03:53 +0100 |
| commit | f7731243d908fe6b3cdf1654a3e8266cceafc5b8 (patch) | |
| tree | 0aaaab85dc26d2e7bbb4d148228e5fa3881cd286 | |
| parent | 671a2f7d67d2fcebf129367268fe20f53599008a (diff) | |
| parent | a370ed7644de04a9ed6c642606b22beaa4d299cd (diff) | |
| download | rust-f7731243d908fe6b3cdf1654a3e8266cceafc5b8.tar.gz rust-f7731243d908fe6b3cdf1654a3e8266cceafc5b8.zip | |
Rollup merge of #122720 - heisen-li:offset_of, r=workingjubilee
[doc]:fix error code example fixs #122716
| -rw-r--r-- | library/core/src/mem/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index e247b9ed83d..d1dc6720271 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -1337,7 +1337,7 @@ impl<T> SizedTypeProperties for T {} /// type B = Wrapper<u8, i8>; /// /// // Not necessarily identical even though `u8` and `i8` have the same layout! -/// // assert!(mem::offset_of!(A, 1), mem::offset_of!(B, 1)); +/// // assert_eq!(mem::offset_of!(A, 1), mem::offset_of!(B, 1)); /// /// #[repr(transparent)] /// struct U8(u8); @@ -1345,12 +1345,12 @@ impl<T> SizedTypeProperties for T {} /// type C = Wrapper<u8, U8>; /// /// // Not necessarily identical even though `u8` and `U8` have the same layout! -/// // assert!(mem::offset_of!(A, 1), mem::offset_of!(C, 1)); +/// // assert_eq!(mem::offset_of!(A, 1), mem::offset_of!(C, 1)); /// /// struct Empty<T>(core::marker::PhantomData<T>); /// /// // Not necessarily identical even though `PhantomData` always has the same layout! -/// // assert!(mem::offset_of!(Empty<u8>, 0), mem::offset_of!(Empty<i8>, 0)); +/// // assert_eq!(mem::offset_of!(Empty<u8>, 0), mem::offset_of!(Empty<i8>, 0)); /// ``` /// /// [explicit `repr` attribute]: https://doc.rust-lang.org/reference/type-layout.html#representations |
