Skip to content

Commit 3e2f4dc

Browse files
committed
Add inner module and const blocks
1 parent ea04862 commit 3e2f4dc

File tree

7 files changed

+280
-211
lines changed

7 files changed

+280
-211
lines changed

tests/ui/attributes/positions/README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ pub mod empty_crate;
5050

5151
#[ATTRIBUTE] //~ WARN
5252
pub mod module {
53-
#![ATTRIBUTE] //~ WARN
54-
//~^ WARN unused attribute
55-
//~^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5653

5754
#[ATTRIBUTE] //~ WARN
5855
pub static GLOBAL: u32 = 42;
@@ -146,8 +143,26 @@ pub mod module {
146143
#[ATTRIBUTE] //~ WARN
147144
fn trait_method() {}
148145
}
146+
147+
fn x() {
148+
#[ATTRIBUTE] //~ WARN
149+
const {
150+
// ..
151+
}
152+
}
149153
}
150154

155+
pub mod inner_module {
156+
#![ATTRIBUTE] //~ WARN
157+
158+
fn x() {
159+
const {
160+
#![ATTRIBUTE] //~ WARN
161+
}
162+
}
163+
}
164+
165+
151166
#[ATTRIBUTE] //~ WARN
152167
fn main() {
153168
let _closure = #[ATTRIBUTE] //~ ERROR attributes on expressions are experimental

tests/ui/attributes/positions/allow.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub mod empty_crate;
1414

1515
#[allow()] // OK
1616
pub mod module {
17-
#![allow()] // OK
1817

1918
#[allow()] // OK
2019
pub static GLOBAL: u32 = 42;
@@ -101,6 +100,23 @@ pub mod module {
101100
#[allow()] // OK
102101
fn trait_method() {}
103102
}
103+
104+
fn x() {
105+
#[allow()] // OK
106+
const {
107+
// ..
108+
}
109+
}
110+
}
111+
112+
pub mod inner_module {
113+
#![allow()] // OK
114+
115+
fn x() {
116+
const {
117+
#![allow()] // OK
118+
}
119+
}
104120
}
105121

106122
#[allow()] // OK

tests/ui/attributes/positions/allow.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: attributes on expressions are experimental
2-
--> $DIR/allow.rs:73:13
2+
--> $DIR/allow.rs:72:13
33
|
44
LL | #[allow()]
55
| ^^^^^^^^^^
@@ -9,7 +9,7 @@ LL | #[allow()]
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: attributes on expressions are experimental
12-
--> $DIR/allow.rs:108:20
12+
--> $DIR/allow.rs:124:20
1313
|
1414
LL | let _closure = #[allow()]
1515
| ^^^^^^^^^^
@@ -19,7 +19,7 @@ LL | let _closure = #[allow()]
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

2121
error[E0658]: attributes on expressions are experimental
22-
--> $DIR/allow.rs:111:25
22+
--> $DIR/allow.rs:127:25
2323
|
2424
LL | let _move_closure = #[allow()]
2525
| ^^^^^^^^^^
@@ -29,7 +29,7 @@ LL | let _move_closure = #[allow()]
2929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030

3131
error[E0658]: attributes on expressions are experimental
32-
--> $DIR/allow.rs:121:22
32+
--> $DIR/allow.rs:137:22
3333
|
3434
LL | let _array = #[allow()]
3535
| ^^^^^^^^^^
@@ -39,7 +39,7 @@ LL | let _array = #[allow()]
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

4141
error[E0658]: attributes on expressions are experimental
42-
--> $DIR/allow.rs:127:22
42+
--> $DIR/allow.rs:143:22
4343
|
4444
LL | let _tuple = #[allow()]
4545
| ^^^^^^^^^^
@@ -49,7 +49,7 @@ LL | let _tuple = #[allow()]
4949
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
5050

5151
error[E0658]: trait aliases are experimental
52-
--> $DIR/allow.rs:32:5
52+
--> $DIR/allow.rs:31:5
5353
|
5454
LL | trait TraitAlias = Debug;
5555
| ^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/attributes/positions/must_use.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ pub mod empty_crate;
1515

1616
#[must_use] //~ WARN
1717
pub mod module {
18-
#![must_use] //~ WARN
19-
//~^ WARN unused attribute
20-
//~^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2118

2219
#[must_use] //~ WARN
2320
pub static GLOBAL: u32 = 42;
@@ -112,6 +109,23 @@ pub mod module {
112109
#[must_use] // OK
113110
fn trait_method() {}
114111
}
112+
113+
fn x() {
114+
#[must_use] //~ WARN
115+
const {
116+
// ..
117+
}
118+
}
119+
}
120+
121+
pub mod inner_module {
122+
#![must_use] //~ WARN
123+
124+
fn x() {
125+
const {
126+
#![must_use] //~ WARN
127+
}
128+
}
115129
}
116130

117131
#[must_use] // OK

0 commit comments

Comments
 (0)