Skip to content

Commit 66b9f79

Browse files
authored
Rollup merge of rust-lang#122720 - heisen-li:offset_of, r=workingjubilee
[doc]:fix error code example fixs rust-lang#122716
2 parents c695d1b + df61282 commit 66b9f79

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/src/mem/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1337,20 +1337,20 @@ impl<T> SizedTypeProperties for T {}
13371337
/// type B = Wrapper<u8, i8>;
13381338
///
13391339
/// // Not necessarily identical even though `u8` and `i8` have the same layout!
1340-
/// // assert!(mem::offset_of!(A, 1), mem::offset_of!(B, 1));
1340+
/// // assert_eq!(mem::offset_of!(A, 1), mem::offset_of!(B, 1));
13411341
///
13421342
/// #[repr(transparent)]
13431343
/// struct U8(u8);
13441344
///
13451345
/// type C = Wrapper<u8, U8>;
13461346
///
13471347
/// // Not necessarily identical even though `u8` and `U8` have the same layout!
1348-
/// // assert!(mem::offset_of!(A, 1), mem::offset_of!(C, 1));
1348+
/// // assert_eq!(mem::offset_of!(A, 1), mem::offset_of!(C, 1));
13491349
///
13501350
/// struct Empty<T>(core::marker::PhantomData<T>);
13511351
///
13521352
/// // Not necessarily identical even though `PhantomData` always has the same layout!
1353-
/// // assert!(mem::offset_of!(Empty<u8>, 0), mem::offset_of!(Empty<i8>, 0));
1353+
/// // assert_eq!(mem::offset_of!(Empty<u8>, 0), mem::offset_of!(Empty<i8>, 0));
13541354
/// ```
13551355
///
13561356
/// [explicit `repr` attribute]: https://doc.rust-lang.org/reference/type-layout.html#representations

0 commit comments

Comments
 (0)