Skip to content

Commit 3a3fbae

Browse files
committed
Auto merge of #111778 - Dylan-DPC:rollup-107ig9h, r=Dylan-DPC
Rollup of 10 pull requests Successful merges: - #111491 (Dont check `must_use` on nested `impl Future` from fn) - #111606 (very minor cleanups) - #111619 (Add timings for MIR passes to profiling report) - #111652 (Better diagnostic for `use Self::..`) - #111665 (Add more tests for the offset_of macro) - #111708 (Give a more useful location for where a span_bug was delayed) - #111715 (Fix doc comment for `ConstParamTy` derive) - #111723 (style: do not overwrite obligations) - #111743 (Improve cgu merging debug output) - #111762 (fix: emit error when fragment is `MethodReceiverExpr` and items is empty) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f94cec7 + 82a452b commit 3a3fbae

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

core/src/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ pub trait PointerLike {}
986986
#[rustc_on_unimplemented(message = "`{Self}` can't be used as a const parameter type")]
987987
pub trait ConstParamTy: StructuralEq {}
988988

989-
/// Derive macro generating an impl of the trait `Copy`.
989+
/// Derive macro generating an impl of the trait `ConstParamTy`.
990990
#[rustc_builtin_macro]
991991
#[unstable(feature = "adt_const_params", issue = "95174")]
992992
#[cfg(not(bootstrap))]

core/tests/mem.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,21 @@ fn offset_of() {
386386
// Layout of tuples is unstable
387387
assert!(offset_of!((u8, u16), 0) <= size_of::<(u8, u16)>() - 1);
388388
assert!(offset_of!((u8, u16), 1) <= size_of::<(u8, u16)>() - 2);
389+
390+
#[repr(C)]
391+
struct Generic<T> {
392+
x: u8,
393+
y: u32,
394+
z: T
395+
}
396+
397+
// Ensure that this type of generics works
398+
fn offs_of_z<T>() -> usize {
399+
offset_of!(Generic<T>, z)
400+
}
401+
402+
assert_eq!(offset_of!(Generic<u8>, z), 8);
403+
assert_eq!(offs_of_z::<u8>(), 8);
389404
}
390405

391406
#[test]

0 commit comments

Comments
 (0)