We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
offset_of!
1 parent 3a3fbae commit 4546c8cCopy full SHA for 4546c8c
core/tests/mem.rs
@@ -394,13 +394,18 @@ fn offset_of() {
394
z: T
395
}
396
397
+ trait Trait {}
398
+
399
// Ensure that this type of generics works
400
fn offs_of_z<T>() -> usize {
401
offset_of!(Generic<T>, z)
402
403
404
assert_eq!(offset_of!(Generic<u8>, z), 8);
405
assert_eq!(offs_of_z::<u8>(), 8);
406
407
+ // Ensure that it works with the implicit lifetime in `Box<dyn Trait + '_>`.
408
+ assert_eq!(offset_of!(Generic<Box<dyn Trait>>, z), 8);
409
410
411
#[test]
0 commit comments