Skip to content

Commit d9892da

Browse files
committed
Split inner impl block and method
1 parent 89c28cd commit d9892da

File tree

7 files changed

+189
-178
lines changed

7 files changed

+189
-178
lines changed

tests/ui/attributes/positions/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Or perhaps you've seen a discussion get derailed by a [comment](https://github.c
2020
> fn main() {
2121
> f(#[cold] || {});
2222
> }
23-
>
23+
>
2424
> fn f(_: impl Fn()) {}
2525
> ```
2626
@@ -105,9 +105,6 @@ pub mod module {
105105
106106
#[ATTRIBUTE] //~ WARN
107107
impl<'lt, T> Struct<'lt, T> {
108-
#![ATTRIBUTE] //~ WARN
109-
//~^ WARN unused attribute
110-
//~^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
111108
112109
#[ATTRIBUTE] //~ WARN
113110
pub fn method(#[ATTRIBUTE] &mut self) { //~ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
@@ -159,6 +156,14 @@ pub mod module {
159156
pub mod inner_module {
160157
#![ATTRIBUTE] //~ WARN
161158
159+
impl<'lt, T> super::module::Struct<'lt, T> {
160+
#![ATTRIBUTE] //~ WARN
161+
162+
pub fn inner_method(&mut self) {
163+
#![ATTRIBUTE] //~ ERROR
164+
}
165+
}
166+
162167
fn x() {
163168
const {
164169
#![ATTRIBUTE] //~ WARN

tests/ui/attributes/positions/allow.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub mod module {
6565

6666
#[allow()] // OK
6767
impl<'lt, T> Struct<'lt, T> {
68-
#![allow()] // OK
68+
6969
#[allow()] // OK
7070
pub fn method(#[allow()] &mut self) { // OK
7171

@@ -112,6 +112,14 @@ pub mod module {
112112
pub mod inner_module {
113113
#![allow()] // OK
114114

115+
impl<'lt, T> super::module::Struct<'lt, T> {
116+
#![allow()] // OK
117+
118+
pub fn inner_method(&mut self) {
119+
#![allow()] // OK
120+
}
121+
}
122+
115123
fn x() {
116124
const {
117125
#![allow()] // OK

tests/ui/attributes/positions/allow.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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:124:20
12+
--> $DIR/allow.rs:132: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:127:25
22+
--> $DIR/allow.rs:135: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:137:22
32+
--> $DIR/allow.rs:145: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:143:22
42+
--> $DIR/allow.rs:151:22
4343
|
4444
LL | let _tuple = #[allow()]
4545
| ^^^^^^^^^^

tests/ui/attributes/positions/must_use.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ pub mod module {
6666

6767
#[must_use] //~ WARN
6868
impl<'lt, T> Struct<'lt, T> {
69-
#![must_use] //~ WARN
70-
//~^ WARN unused attribute
71-
//~^^ WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7269

7370
#[must_use] // OK
7471
pub fn method(#[must_use] &mut self) { //~ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
@@ -121,6 +118,14 @@ pub mod module {
121118
pub mod inner_module {
122119
#![must_use] //~ WARN
123120

121+
impl<'lt, T> super::module::Struct<'lt, T> {
122+
#![must_use] //~ WARN
123+
124+
pub fn inner_method(&mut self) {
125+
#![must_use] // OK
126+
}
127+
}
128+
124129
fn x() {
125130
const {
126131
#![must_use] //~ WARN

0 commit comments

Comments
 (0)