-
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 #74336 - davidtwco:issue-73112-cross-crate-packed-typ…
…e-diagnostic, r=estebank typeck: use `item_name` in cross-crate packed diag Fixes #73112. This PR replaces the use of `expect_local` and `hir().get` to fetch the identifier for a ADT with `item_name` - which works across crates.
- Loading branch information
Showing
4 changed files
with
65 additions
and
25 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,10 @@ | ||
#[repr(transparent)] | ||
pub struct PageTableEntry { | ||
entry: u64, | ||
} | ||
|
||
#[repr(align(4096))] | ||
#[repr(C)] | ||
pub struct PageTable { | ||
entries: [PageTableEntry; 512], | ||
} |
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,13 @@ | ||
// aux-build:issue-73112.rs | ||
|
||
extern crate issue_73112; | ||
|
||
fn main() { | ||
use issue_73112::PageTable; | ||
|
||
#[repr(C, packed)] | ||
struct SomeStruct { | ||
//~^ ERROR packed type cannot transitively contain a `#[repr(align)]` type [E0588] | ||
page_table: PageTable, | ||
} | ||
} |
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,20 @@ | ||
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type | ||
--> $DIR/issue-73112.rs:9:5 | ||
| | ||
LL | / struct SomeStruct { | ||
LL | | | ||
LL | | page_table: PageTable, | ||
LL | | } | ||
| |_____^ | ||
| | ||
note: `PageTable` has a `#[repr(align)]` attribute | ||
--> $DIR/auxiliary/issue-73112.rs:8:1 | ||
| | ||
LL | / pub struct PageTable { | ||
LL | | entries: [PageTableEntry; 512], | ||
LL | | } | ||
| |_^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0588`. |