Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6f0825e

Browse files
add thread_local! example to the feature gate test
1 parent 2b480d3 commit 6f0825e

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

‎tests/ui/feature-gates/feature-gate-static_align.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ extern "C" {
99
//~^ ERROR the `#[rustc_align_static]` attribute is an experimental feature
1010
static FOREIGN_STATIC: u32;
1111
}
12+
13+
// NOTE: the error is reported twice because the expansion of `thread_local` contains 2 statics.
14+
thread_local! {
15+
//~^ ERROR the `#[rustc_align_static]` attribute is an experimental feature
16+
//~| ERROR the `#[rustc_align_static]` attribute is an experimental feature
17+
#[rustc_align_static(16)]
18+
static THREAD_LOCAL: u16 = 0;
19+
}

‎tests/ui/feature-gates/feature-gate-static_align.stderr‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,38 @@ LL | #[rustc_align_static(16)]
1818
= help: add `#![feature(static_align)]` to the crate attributes to enable
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

21-
error: aborting due to 2 previous errors
21+
error[E0658]: the `#[rustc_align_static]` attribute is an experimental feature
22+
--> $DIR/feature-gate-static_align.rs:14:1
23+
|
24+
LL | / thread_local! {
25+
LL | |
26+
LL | |
27+
LL | | #[rustc_align_static(16)]
28+
LL | | static THREAD_LOCAL: u16 = 0;
29+
LL | | }
30+
| |_^
31+
|
32+
= note: see issue #146177 <https://github.com/rust-lang/rust/issues/146177> for more information
33+
= help: add `#![feature(static_align)]` to the crate attributes to enable
34+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
35+
= note: this error originates in the macro `$crate::thread::local_impl::thread_local_inner` which comes from the expansion of the macro `thread_local` (in Nightly builds, run with -Z macro-backtrace for more info)
36+
37+
error[E0658]: the `#[rustc_align_static]` attribute is an experimental feature
38+
--> $DIR/feature-gate-static_align.rs:14:1
39+
|
40+
LL | / thread_local! {
41+
LL | |
42+
LL | |
43+
LL | | #[rustc_align_static(16)]
44+
LL | | static THREAD_LOCAL: u16 = 0;
45+
LL | | }
46+
| |_^
47+
|
48+
= note: see issue #146177 <https://github.com/rust-lang/rust/issues/146177> for more information
49+
= help: add `#![feature(static_align)]` to the crate attributes to enable
50+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
51+
= note: this error originates in the macro `$crate::thread::local_impl::thread_local_inner` which comes from the expansion of the macro `thread_local` (in Nightly builds, run with -Z macro-backtrace for more info)
52+
53+
error: aborting due to 4 previous errors
2254

2355
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /