-
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.
New
#[rustc_pub_transparent]
attribute
- Loading branch information
1 parent
f167efa
commit b9033bd
Showing
11 changed files
with
86 additions
and
0 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
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
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
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
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,25 @@ | ||
#![feature(rustc_attrs, transparent_unions)] | ||
|
||
#[rustc_pub_transparent] | ||
#[repr(transparent)] | ||
union E<T: Copy> { | ||
value: T, | ||
uninit: (), | ||
} | ||
|
||
#[repr(transparent)] | ||
#[rustc_pub_transparent] | ||
struct S<T>(T); | ||
|
||
#[rustc_pub_transparent] //~ ERROR attribute should be applied to `#[repr(transparent)]` types | ||
#[repr(C)] | ||
struct S1 { | ||
A: u8, | ||
} | ||
|
||
#[rustc_pub_transparent] //~ ERROR attribute should be applied to `#[repr(transparent)]` types | ||
struct S2<T> { | ||
value: T, | ||
} | ||
|
||
fn main() {} |
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,23 @@ | ||
error: attribute should be applied to `#[repr(transparent)]` types | ||
--> $DIR/rustc_pub_transparent.rs:14:1 | ||
| | ||
LL | #[rustc_pub_transparent] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | #[repr(C)] | ||
LL | / struct S1 { | ||
LL | | A: u8, | ||
LL | | } | ||
| |_- not a `#[repr(transparent)]` type | ||
|
||
error: attribute should be applied to `#[repr(transparent)]` types | ||
--> $DIR/rustc_pub_transparent.rs:20:1 | ||
| | ||
LL | #[rustc_pub_transparent] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | / struct S2<T> { | ||
LL | | value: T, | ||
LL | | } | ||
| |_- not a `#[repr(transparent)]` type | ||
|
||
error: aborting due to 2 previous errors | ||
|