-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #112069 - clubby789:offset-of-sized-fields, r=WaffleL…
…apkin offset_of: don't require type to be `Sized` Fixes #112051 ~~The RFC [explicitly forbids](https://rust-lang.github.io/rfcs/3308-offset_of.html#limitations) non-`Sized` types, but it looks like only the fields being recursed into were checked. The sized check also seemed to have been completely missing for tuples~~
- Loading branch information
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// build-pass | ||
// regression test for #112051 | ||
|
||
#![feature(offset_of)] | ||
|
||
struct S<T: ?Sized> { | ||
a: u64, | ||
b: T, | ||
} | ||
trait Tr {} | ||
|
||
fn main() { | ||
let _a = core::mem::offset_of!(S<dyn Tr>, a); | ||
let _b = core::mem::offset_of!((u64, dyn Tr), 0); | ||
} |