Skip to content

Commit 6e67eaa

Browse files
committed
ast: Revert a breaking attribute visiting order change
1 parent 3c4066d commit 6e67eaa

7 files changed

+50
-66
lines changed

Diff for: compiler/rustc_ast/src/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -852,10 +852,10 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(
852852
ctxt: AssocCtxt,
853853
) -> V::Result {
854854
let &Item { id: _, span: _, ident, ref vis, ref attrs, ref kind, tokens: _ } = item;
855-
walk_list!(visitor, visit_attribute, attrs);
856855
try_visit!(visitor.visit_vis(vis));
857856
try_visit!(visitor.visit_ident(ident));
858857
try_visit!(kind.walk(item, ctxt, visitor));
858+
walk_list!(visitor, visit_attribute, attrs);
859859
V::Result::output()
860860
}
861861

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
error: using tabs in doc comments is not recommended
2-
--> tests/ui/tabs_in_doc_comments.rs:6:5
2+
--> tests/ui/tabs_in_doc_comments.rs:10:9
33
|
4-
LL | /// - first one
5-
| ^^^^ help: consider using four spaces per tab
4+
LL | /// - First String:
5+
| ^^^^ help: consider using four spaces per tab
66
|
77
= note: `-D clippy::tabs-in-doc-comments` implied by `-D warnings`
88
= help: to override `-D warnings` add `#[allow(clippy::tabs_in_doc_comments)]`
99

1010
error: using tabs in doc comments is not recommended
11-
--> tests/ui/tabs_in_doc_comments.rs:6:13
11+
--> tests/ui/tabs_in_doc_comments.rs:11:9
1212
|
13-
LL | /// - first one
14-
| ^^^^^^^^ help: consider using four spaces per tab
13+
LL | /// - needs to be inside here
14+
| ^^^^^^^^ help: consider using four spaces per tab
1515

1616
error: using tabs in doc comments is not recommended
17-
--> tests/ui/tabs_in_doc_comments.rs:7:5
17+
--> tests/ui/tabs_in_doc_comments.rs:14:9
1818
|
19-
LL | /// - second one
20-
| ^^^^ help: consider using four spaces per tab
19+
LL | /// - Second String:
20+
| ^^^^ help: consider using four spaces per tab
2121

2222
error: using tabs in doc comments is not recommended
23-
--> tests/ui/tabs_in_doc_comments.rs:7:14
23+
--> tests/ui/tabs_in_doc_comments.rs:15:9
2424
|
25-
LL | /// - second one
26-
| ^^^^ help: consider using four spaces per tab
25+
LL | /// - needs to be inside here
26+
| ^^^^^^^^ help: consider using four spaces per tab
2727

2828
error: using tabs in doc comments is not recommended
29-
--> tests/ui/tabs_in_doc_comments.rs:10:9
29+
--> tests/ui/tabs_in_doc_comments.rs:6:5
3030
|
31-
LL | /// - First String:
32-
| ^^^^ help: consider using four spaces per tab
31+
LL | /// - first one
32+
| ^^^^ help: consider using four spaces per tab
3333

3434
error: using tabs in doc comments is not recommended
35-
--> tests/ui/tabs_in_doc_comments.rs:11:9
35+
--> tests/ui/tabs_in_doc_comments.rs:6:13
3636
|
37-
LL | /// - needs to be inside here
38-
| ^^^^^^^^ help: consider using four spaces per tab
37+
LL | /// - first one
38+
| ^^^^^^^^ help: consider using four spaces per tab
3939

4040
error: using tabs in doc comments is not recommended
41-
--> tests/ui/tabs_in_doc_comments.rs:14:9
41+
--> tests/ui/tabs_in_doc_comments.rs:7:5
4242
|
43-
LL | /// - Second String:
44-
| ^^^^ help: consider using four spaces per tab
43+
LL | /// - second one
44+
| ^^^^ help: consider using four spaces per tab
4545

4646
error: using tabs in doc comments is not recommended
47-
--> tests/ui/tabs_in_doc_comments.rs:15:9
47+
--> tests/ui/tabs_in_doc_comments.rs:7:14
4848
|
49-
LL | /// - needs to be inside here
50-
| ^^^^^^^^ help: consider using four spaces per tab
49+
LL | /// - second one
50+
| ^^^^ help: consider using four spaces per tab
5151

5252
error: aborting due to 8 previous errors
5353

Diff for: tests/ui/attributes/key-value-expansion-scope.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn before() {
1717
macro_rules! in_root { () => { "" } }
1818

1919
mod macros_stay {
20-
#![doc = in_mod!()] //~ ERROR cannot find macro `in_mod` in this scope
20+
#![doc = in_mod!()] // FIXME, this is a bug
2121

2222
macro_rules! in_mod { () => { "" } }
2323

@@ -29,7 +29,7 @@ mod macros_stay {
2929

3030
#[macro_use]
3131
mod macros_escape {
32-
#![doc = in_mod_escape!()] //~ ERROR cannot find macro `in_mod_escape` in this scope
32+
#![doc = in_mod_escape!()] // FIXME, this is a bug
3333

3434
macro_rules! in_mod_escape { () => { "" } }
3535

Diff for: tests/ui/attributes/key-value-expansion-scope.stderr

+1-17
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,6 @@ LL | #![doc = in_block!()]
7878
|
7979
= help: have you added the `#[macro_use]` on the module/import?
8080

81-
error: cannot find macro `in_mod` in this scope
82-
--> $DIR/key-value-expansion-scope.rs:20:14
83-
|
84-
LL | #![doc = in_mod!()]
85-
| ^^^^^^
86-
|
87-
= help: have you added the `#[macro_use]` on the module/import?
88-
89-
error: cannot find macro `in_mod_escape` in this scope
90-
--> $DIR/key-value-expansion-scope.rs:32:14
91-
|
92-
LL | #![doc = in_mod_escape!()]
93-
| ^^^^^^^^^^^^^
94-
|
95-
= help: have you added the `#[macro_use]` on the module/import?
96-
9781
error: cannot find macro `in_block` in this scope
9882
--> $DIR/key-value-expansion-scope.rs:43:14
9983
|
@@ -134,5 +118,5 @@ LL | #![doc = in_block!()]
134118
|
135119
= help: have you added the `#[macro_use]` on the module/import?
136120

137-
error: aborting due to 17 previous errors
121+
error: aborting due to 15 previous errors
138122

Diff for: tests/ui/feature-gates/feature-gate-optimize_attribute.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
error[E0658]: the `#[optimize]` attribute is an experimental feature
2-
--> $DIR/feature-gate-optimize_attribute.rs:4:1
3-
|
4-
LL | #[optimize(size)]
5-
| ^^^^^^^^^^^^^^^^^
6-
|
7-
= note: see issue #54882 <https://github.com./rust-lang/rust/issues/54882> for more information
8-
= help: add `#![feature(optimize_attribute)]` to the crate attributes to enable
9-
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10-
111
error[E0658]: the `#[optimize]` attribute is an experimental feature
122
--> $DIR/feature-gate-optimize_attribute.rs:7:1
133
|
@@ -38,6 +28,16 @@ LL | #[optimize(banana)]
3828
= help: add `#![feature(optimize_attribute)]` to the crate attributes to enable
3929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4030

31+
error[E0658]: the `#[optimize]` attribute is an experimental feature
32+
--> $DIR/feature-gate-optimize_attribute.rs:4:1
33+
|
34+
LL | #[optimize(size)]
35+
| ^^^^^^^^^^^^^^^^^
36+
|
37+
= note: see issue #54882 <https://github.com./rust-lang/rust/issues/54882> for more information
38+
= help: add `#![feature(optimize_attribute)]` to the crate attributes to enable
39+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40+
4141
error[E0658]: the `#[optimize]` attribute is an experimental feature
4242
--> $DIR/feature-gate-optimize_attribute.rs:2:1
4343
|

Diff for: tests/ui/feature-gates/issue-43106-gating-of-stable.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
error[E0734]: stability attributes may not be used outside of the standard library
2-
--> $DIR/issue-43106-gating-of-stable.rs:10:1
3-
|
4-
LL | #[stable()]
5-
| ^^^^^^^^^^^
6-
71
error[E0734]: stability attributes may not be used outside of the standard library
82
--> $DIR/issue-43106-gating-of-stable.rs:14:9
93
|
@@ -34,6 +28,12 @@ error[E0734]: stability attributes may not be used outside of the standard libra
3428
LL | #[stable()]
3529
| ^^^^^^^^^^^
3630

31+
error[E0734]: stability attributes may not be used outside of the standard library
32+
--> $DIR/issue-43106-gating-of-stable.rs:10:1
33+
|
34+
LL | #[stable()]
35+
| ^^^^^^^^^^^
36+
3737
error[E0734]: stability attributes may not be used outside of the standard library
3838
--> $DIR/issue-43106-gating-of-stable.rs:7:1
3939
|

Diff for: tests/ui/feature-gates/issue-43106-gating-of-unstable.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
error[E0734]: stability attributes may not be used outside of the standard library
2-
--> $DIR/issue-43106-gating-of-unstable.rs:10:1
3-
|
4-
LL | #[unstable()]
5-
| ^^^^^^^^^^^^^
6-
71
error[E0734]: stability attributes may not be used outside of the standard library
82
--> $DIR/issue-43106-gating-of-unstable.rs:14:9
93
|
@@ -34,6 +28,12 @@ error[E0734]: stability attributes may not be used outside of the standard libra
3428
LL | #[unstable()]
3529
| ^^^^^^^^^^^^^
3630

31+
error[E0734]: stability attributes may not be used outside of the standard library
32+
--> $DIR/issue-43106-gating-of-unstable.rs:10:1
33+
|
34+
LL | #[unstable()]
35+
| ^^^^^^^^^^^^^
36+
3737
error[E0734]: stability attributes may not be used outside of the standard library
3838
--> $DIR/issue-43106-gating-of-unstable.rs:7:1
3939
|

0 commit comments

Comments
 (0)