-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reject invalid #[repr(packed)] attributes
They will be rejected by rustc but, we should not rely on the behavior of rustc that rejects them.
- Loading branch information
Showing
5 changed files
with
89 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,42 @@ | ||
error: #[repr(packed)] attribute should be applied to a struct or union | ||
--> $DIR/packed-enum.rs:13:8 | ||
| | ||
13 | #[repr(packed)] //~ ERROR E0517 | ||
| ^^^^^^ | ||
|
||
error: #[repr(packed)] attribute should be applied to a struct or union | ||
--> $DIR/packed-enum.rs:18:8 | ||
| | ||
18 | #[repr(packed)] //~ ERROR E0517 | ||
| ^^^^^^ | ||
|
||
error[E0517]: attribute should be applied to a struct or union | ||
--> $DIR/packed-enum.rs:3:8 | ||
| | ||
3 | #[repr(packed)] //~ ERROR E0517 | ||
| ^^^^^^ | ||
4 | / enum E1 { | ||
5 | | V(()), | ||
6 | | } | ||
| |_- not a struct or union | ||
--> $DIR/packed-enum.rs:7:8 | ||
| | ||
7 | #[repr(packed)] //~ ERROR E0517 | ||
| ^^^^^^ | ||
8 | / enum E1 { | ||
9 | | V(()), | ||
10 | | } | ||
| |_- not a struct or union | ||
|
||
error[E0517]: attribute should be applied to a struct or union | ||
--> $DIR/packed-enum.rs:9:8 | ||
--> $DIR/packed-enum.rs:13:8 | ||
| | ||
9 | #[repr(packed)] //~ ERROR E0517 | ||
13 | #[repr(packed)] //~ ERROR E0517 | ||
| ^^^^^^ | ||
10 | / enum E2 { | ||
11 | | V(()), | ||
12 | | } | ||
14 | / enum E2 { | ||
15 | | V(()), | ||
16 | | } | ||
| |_- not a struct or union | ||
|
||
error[E0517]: attribute should be applied to a struct or union | ||
--> $DIR/packed-enum.rs:14:8 | ||
--> $DIR/packed-enum.rs:18:8 | ||
| | ||
14 | #[repr(packed)] //~ ERROR E0517 | ||
18 | #[repr(packed)] //~ ERROR E0517 | ||
| ^^^^^^ | ||
15 | #[pin_project] | ||
16 | / enum E3 { | ||
17 | | V(()), | ||
18 | | } | ||
19 | #[pin_project] | ||
20 | / enum E3 { | ||
21 | | V(()), | ||
22 | | } | ||
| |_- not a struct or union |
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 |
---|---|---|
@@ -1,52 +1,11 @@ | ||
error: internal compiler error: unrecognized representation hint | ||
--> $DIR/packed-name-value.rs:3:8 | ||
| | ||
3 | #[repr(packed = "")] //~ ERROR E0552 | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: delayed at compiler/rustc_attr/src/builtin.rs:940:32 | ||
|
||
error: internal compiler error: unrecognized representation hint | ||
--> $DIR/packed-name-value.rs:9:8 | ||
| | ||
9 | #[repr(packed = "")] //~ ERROR E0552 | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: delayed at compiler/rustc_attr/src/builtin.rs:940:32 | ||
|
||
error: internal compiler error: unrecognized representation hint | ||
--> $DIR/packed-name-value.rs:14:8 | ||
error: #[repr(packed)] attribute should not be name-value pair | ||
--> $DIR/packed-name-value.rs:16:8 | ||
| | ||
14 | #[repr(packed = "")] //~ ERROR E0552 | ||
16 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair | ||
| ^^^^^^^^^^^ | ||
| | ||
= note: delayed at compiler/rustc_attr/src/builtin.rs:940:32 | ||
|
||
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1018:13 | ||
stack backtrace: | ||
0: _rust_begin_unwind | ||
1: std::panicking::begin_panic_fmt | ||
2: rustc_errors::HandlerInner::flush_delayed | ||
3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop | ||
4: core::ptr::drop_in_place<rustc_session::parse::ParseSess> | ||
5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop | ||
6: core::ptr::drop_in_place<rustc_interface::interface::Compiler> | ||
7: rustc_span::with_source_map | ||
8: rustc_interface::interface::create_compiler_and_run | ||
9: scoped_tls::ScopedKey<T>::set | ||
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. | ||
|
||
error: internal compiler error: unexpected panic | ||
|
||
note: the compiler unexpectedly panicked. this is a bug. | ||
|
||
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md | ||
|
||
note: rustc 1.53.0-nightly (d0695c908 2021-04-12) running on x86_64-apple-darwin | ||
|
||
note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --crate-type bin | ||
|
||
note: some of the compiler flags provided by cargo are hidden | ||
|
||
query stack during panic: | ||
end of query stack | ||
error: #[repr(packed)] attribute should not be name-value pair | ||
--> $DIR/packed-name-value.rs:21:8 | ||
| | ||
21 | #[repr(packed = "")] //~ ERROR attribute should not be name-value pair | ||
| ^^^^^^^^^^^ |