Skip to content

Commit 1443c76

Browse files
committedMay 3, 2021
parser: Remove support for inner attributes on non-block expressions
1 parent e327a82 commit 1443c76

13 files changed

+316
-637
lines changed
 

‎compiler/rustc_ast_pretty/src/pprust/state.rs

+9-26
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,6 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
366366
self.print_either_attributes(attrs, ast::AttrStyle::Inner, false, true)
367367
}
368368

369-
fn print_inner_attributes_no_trailing_hardbreak(&mut self, attrs: &[ast::Attribute]) {
370-
self.print_either_attributes(attrs, ast::AttrStyle::Inner, false, false)
371-
}
372-
373369
fn print_outer_attributes(&mut self, attrs: &[ast::Attribute]) {
374370
self.print_either_attributes(attrs, ast::AttrStyle::Outer, false, true)
375371
}
@@ -1675,32 +1671,24 @@ impl<'a> State<'a> {
16751671
}
16761672
}
16771673

1678-
fn print_expr_vec(&mut self, exprs: &[P<ast::Expr>], attrs: &[ast::Attribute]) {
1674+
fn print_expr_vec(&mut self, exprs: &[P<ast::Expr>]) {
16791675
self.ibox(INDENT_UNIT);
16801676
self.s.word("[");
1681-
self.print_inner_attributes_inline(attrs);
16821677
self.commasep_exprs(Inconsistent, exprs);
16831678
self.s.word("]");
16841679
self.end();
16851680
}
16861681

1687-
fn print_expr_anon_const(&mut self, expr: &ast::AnonConst, attrs: &[ast::Attribute]) {
1682+
fn print_expr_anon_const(&mut self, expr: &ast::AnonConst) {
16881683
self.ibox(INDENT_UNIT);
16891684
self.s.word("const");
1690-
self.print_inner_attributes_inline(attrs);
16911685
self.print_expr(&expr.value);
16921686
self.end();
16931687
}
16941688

1695-
fn print_expr_repeat(
1696-
&mut self,
1697-
element: &ast::Expr,
1698-
count: &ast::AnonConst,
1699-
attrs: &[ast::Attribute],
1700-
) {
1689+
fn print_expr_repeat(&mut self, element: &ast::Expr, count: &ast::AnonConst) {
17011690
self.ibox(INDENT_UNIT);
17021691
self.s.word("[");
1703-
self.print_inner_attributes_inline(attrs);
17041692
self.print_expr(element);
17051693
self.word_space(";");
17061694
self.print_expr(&count.value);
@@ -1713,11 +1701,9 @@ impl<'a> State<'a> {
17131701
path: &ast::Path,
17141702
fields: &[ast::ExprField],
17151703
rest: &ast::StructRest,
1716-
attrs: &[ast::Attribute],
17171704
) {
17181705
self.print_path(path, true, 0);
17191706
self.s.word("{");
1720-
self.print_inner_attributes_inline(attrs);
17211707
self.commasep_cmnt(
17221708
Consistent,
17231709
fields,
@@ -1752,9 +1738,8 @@ impl<'a> State<'a> {
17521738
self.s.word("}");
17531739
}
17541740

1755-
fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>], attrs: &[ast::Attribute]) {
1741+
fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>]) {
17561742
self.popen();
1757-
self.print_inner_attributes_inline(attrs);
17581743
self.commasep_exprs(Inconsistent, exprs);
17591744
if exprs.len() == 1 {
17601745
self.s.word(",");
@@ -1865,19 +1850,19 @@ impl<'a> State<'a> {
18651850
self.print_expr_maybe_paren(expr, parser::PREC_PREFIX);
18661851
}
18671852
ast::ExprKind::Array(ref exprs) => {
1868-
self.print_expr_vec(&exprs[..], attrs);
1853+
self.print_expr_vec(exprs);
18691854
}
18701855
ast::ExprKind::ConstBlock(ref anon_const) => {
1871-
self.print_expr_anon_const(anon_const, attrs);
1856+
self.print_expr_anon_const(anon_const);
18721857
}
18731858
ast::ExprKind::Repeat(ref element, ref count) => {
1874-
self.print_expr_repeat(element, count, attrs);
1859+
self.print_expr_repeat(element, count);
18751860
}
18761861
ast::ExprKind::Struct(ref se) => {
1877-
self.print_expr_struct(&se.path, &se.fields, &se.rest, attrs);
1862+
self.print_expr_struct(&se.path, &se.fields, &se.rest);
18781863
}
18791864
ast::ExprKind::Tup(ref exprs) => {
1880-
self.print_expr_tup(&exprs[..], attrs);
1865+
self.print_expr_tup(exprs);
18811866
}
18821867
ast::ExprKind::Call(ref func, ref args) => {
18831868
self.print_expr_call(func, &args[..]);
@@ -1955,7 +1940,6 @@ impl<'a> State<'a> {
19551940
self.print_expr_as_cond(expr);
19561941
self.s.space();
19571942
self.bopen();
1958-
self.print_inner_attributes_no_trailing_hardbreak(attrs);
19591943
for arm in arms {
19601944
self.print_arm(arm);
19611945
}
@@ -2253,7 +2237,6 @@ impl<'a> State<'a> {
22532237
ast::ExprKind::MacCall(ref m) => self.print_mac(m),
22542238
ast::ExprKind::Paren(ref e) => {
22552239
self.popen();
2256-
self.print_inner_attributes_inline(attrs);
22572240
self.print_expr(e);
22582241
self.pclose();
22592242
}

‎compiler/rustc_parse/src/parser/expr.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -1216,10 +1216,9 @@ impl<'a> Parser<'a> {
12161216
}
12171217
}
12181218

1219-
fn parse_tuple_parens_expr(&mut self, mut attrs: AttrVec) -> PResult<'a, P<Expr>> {
1219+
fn parse_tuple_parens_expr(&mut self, attrs: AttrVec) -> PResult<'a, P<Expr>> {
12201220
let lo = self.token.span;
12211221
self.expect(&token::OpenDelim(token::Paren))?;
1222-
attrs.extend(self.parse_inner_attributes()?); // `(#![foo] a, b, ...)` is OK.
12231222
let (es, trailing_comma) = match self.parse_seq_to_end(
12241223
&token::CloseDelim(token::Paren),
12251224
SeqSep::trailing_allowed(token::Comma),
@@ -1239,12 +1238,10 @@ impl<'a> Parser<'a> {
12391238
self.maybe_recover_from_bad_qpath(expr, true)
12401239
}
12411240

1242-
fn parse_array_or_repeat_expr(&mut self, mut attrs: AttrVec) -> PResult<'a, P<Expr>> {
1241+
fn parse_array_or_repeat_expr(&mut self, attrs: AttrVec) -> PResult<'a, P<Expr>> {
12431242
let lo = self.token.span;
12441243
self.bump(); // `[`
12451244

1246-
attrs.extend(self.parse_inner_attributes()?);
1247-
12481245
let close = &token::CloseDelim(token::Bracket);
12491246
let kind = if self.eat(close) {
12501247
// Empty vector
@@ -1950,7 +1947,7 @@ impl<'a> Parser<'a> {
19501947
}
19511948

19521949
/// Parses a `match ... { ... }` expression (`match` token already eaten).
1953-
fn parse_match_expr(&mut self, mut attrs: AttrVec) -> PResult<'a, P<Expr>> {
1950+
fn parse_match_expr(&mut self, attrs: AttrVec) -> PResult<'a, P<Expr>> {
19541951
let match_span = self.prev_token.span;
19551952
let lo = self.prev_token.span;
19561953
let scrutinee = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?;
@@ -1965,7 +1962,6 @@ impl<'a> Parser<'a> {
19651962
}
19661963
return Err(e);
19671964
}
1968-
attrs.extend(self.parse_inner_attributes()?);
19691965

19701966
let mut arms: Vec<Arm> = Vec::new();
19711967
while self.token != token::CloseDelim(token::Brace) {
@@ -2293,15 +2289,13 @@ impl<'a> Parser<'a> {
22932289
pub(super) fn parse_struct_expr(
22942290
&mut self,
22952291
pth: ast::Path,
2296-
mut attrs: AttrVec,
2292+
attrs: AttrVec,
22972293
recover: bool,
22982294
) -> PResult<'a, P<Expr>> {
22992295
let mut fields = Vec::new();
23002296
let mut base = ast::StructRest::None;
23012297
let mut recover_async = false;
23022298

2303-
attrs.extend(self.parse_inner_attributes()?);
2304-
23052299
let mut async_block_err = |e: &mut DiagnosticBuilder<'_>, span: Span| {
23062300
recover_async = true;
23072301
e.span_label(span, "`async` blocks are only allowed in Rust 2018 or later");

‎src/test/pretty/ast-stmt-expr-attr.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ fn main() { }
55
#[cfg(FALSE)]
66
fn syntax() {
77
let _ = #[attr] box 0;
8-
let _ = #[attr] [#![attr] ];
9-
let _ = #[attr] [#![attr] 0];
10-
let _ = #[attr] [#![attr] 0; 0];
11-
let _ = #[attr] [#![attr] 0, 0, 0];
8+
let _ = #[attr] [];
9+
let _ = #[attr] [0];
10+
let _ = #[attr] [0; 0];
11+
let _ = #[attr] [0, 0, 0];
1212
let _ = #[attr] foo();
1313
let _ = #[attr] x.foo();
14-
let _ = #[attr] (#![attr] );
15-
let _ = #[attr] (#![attr] #[attr] 0,);
16-
let _ = #[attr] (#![attr] #[attr] 0, 0);
14+
let _ = #[attr] ();
15+
let _ = #[attr] (#[attr] 0,);
16+
let _ = #[attr] (#[attr] 0, 0);
1717
let _ = #[attr] 0 + #[attr] 0;
1818
let _ = #[attr] 0 / #[attr] 0;
1919
let _ = #[attr] 0 & #[attr] 0;
@@ -43,10 +43,10 @@ fn syntax() {
4343
#![attr]
4444
};
4545
let _ =
46-
#[attr] match true {
47-
#![attr]
48-
#[attr]
49-
_ => false,
46+
#[attr] match true
47+
{
48+
#[attr]
49+
_ => false,
5050
};
5151
let _ = #[attr] || #[attr] foo;
5252
let _ = #[attr] move || #[attr] foo;
@@ -119,10 +119,10 @@ fn syntax() {
119119
let _ = #[attr] foo![# ! [attr]];
120120
let _ = #[attr] foo! { };
121121
let _ = #[attr] foo! { # ! [attr] };
122-
let _ = #[attr] Foo{#![attr] bar: baz,};
123-
let _ = #[attr] Foo{#![attr] ..foo};
124-
let _ = #[attr] Foo{#![attr] bar: baz, ..foo};
125-
let _ = #[attr] (#![attr] 0);
122+
let _ = #[attr] Foo{bar: baz,};
123+
let _ = #[attr] Foo{..foo};
124+
let _ = #[attr] Foo{bar: baz, ..foo};
125+
let _ = #[attr] (0);
126126

127127
{
128128
#[attr]

‎src/test/pretty/stmt_expr_attributes.rs

+24-35
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,9 @@ fn _3() {
4141
fn _4() {
4242

4343
#[rustc_dummy]
44-
match () {
45-
#![rustc_dummy]
46-
_ => (),
47-
}
44+
match () { _ => (), }
4845

49-
let _ =
50-
#[rustc_dummy] match () {
51-
#![rustc_dummy]
52-
() => (),
53-
};
46+
let _ = #[rustc_dummy] match () { () => (), };
5447
}
5548

5649
fn _5() {
@@ -71,14 +64,14 @@ fn _5() {
7164
fn _6() {
7265

7366
#[rustc_dummy]
74-
[#![rustc_dummy] 1, 2, 3];
67+
[1, 2, 3];
7568

76-
let _ = #[rustc_dummy] [#![rustc_dummy] 1, 2, 3];
69+
let _ = #[rustc_dummy] [1, 2, 3];
7770

7871
#[rustc_dummy]
79-
[#![rustc_dummy] 1; 4];
72+
[1; 4];
8073

81-
let _ = #[rustc_dummy] [#![rustc_dummy] 1; 4];
74+
let _ = #[rustc_dummy] [1; 4];
8275
}
8376

8477
struct Foo {
@@ -90,24 +83,24 @@ struct Bar(());
9083
fn _7() {
9184

9285
#[rustc_dummy]
93-
Foo{#![rustc_dummy] data: (),};
86+
Foo{data: (),};
9487

95-
let _ = #[rustc_dummy] Foo{#![rustc_dummy] data: (),};
88+
let _ = #[rustc_dummy] Foo{data: (),};
9689
}
9790

9891
fn _8() {
9992

10093
#[rustc_dummy]
101-
(#![rustc_dummy] );
94+
();
10295

10396
#[rustc_dummy]
104-
(#![rustc_dummy] 0);
97+
(0);
10598

10699
#[rustc_dummy]
107-
(#![rustc_dummy] 0,);
100+
(0,);
108101

109102
#[rustc_dummy]
110-
(#![rustc_dummy] 0, 1);
103+
(0, 1);
111104
}
112105

113106
fn _9() {
@@ -138,15 +131,15 @@ fn _10() {
138131

139132
fn _11() {
140133
let _ = #[rustc_dummy] box 0;
141-
let _: [(); 0] = #[rustc_dummy] [#![rustc_dummy] ];
142-
let _ = #[rustc_dummy] [#![rustc_dummy] 0, 0];
143-
let _ = #[rustc_dummy] [#![rustc_dummy] 0; 0];
134+
let _: [(); 0] = #[rustc_dummy] [];
135+
let _ = #[rustc_dummy] [0, 0];
136+
let _ = #[rustc_dummy] [0; 0];
144137
let _ = #[rustc_dummy] foo();
145138
let _ = #[rustc_dummy] 1i32.clone();
146-
let _ = #[rustc_dummy] (#![rustc_dummy] );
147-
let _ = #[rustc_dummy] (#![rustc_dummy] 0);
148-
let _ = #[rustc_dummy] (#![rustc_dummy] 0,);
149-
let _ = #[rustc_dummy] (#![rustc_dummy] 0, 0);
139+
let _ = #[rustc_dummy] ();
140+
let _ = #[rustc_dummy] (0);
141+
let _ = #[rustc_dummy] (0,);
142+
let _ = #[rustc_dummy] (0, 0);
150143
let _ = #[rustc_dummy] 0 + #[rustc_dummy] 0;
151144
let _ = #[rustc_dummy] !0;
152145
let _ = #[rustc_dummy] -0i32;
@@ -171,11 +164,7 @@ fn _11() {
171164
#[rustc_dummy] loop {
172165
#![rustc_dummy]
173166
};
174-
let _ =
175-
#[rustc_dummy] match false {
176-
#![rustc_dummy]
177-
_ => (),
178-
};
167+
let _ = #[rustc_dummy] match false { _ => (), };
179168
let _ = #[rustc_dummy] || #[rustc_dummy] ();
180169
let _ = #[rustc_dummy] move || #[rustc_dummy] ();
181170
let _ =
@@ -237,10 +226,10 @@ fn _11() {
237226
let _ = #[rustc_dummy] expr_mac!();
238227
let _ = #[rustc_dummy] expr_mac![];
239228
let _ = #[rustc_dummy] expr_mac! { };
240-
let _ = #[rustc_dummy] Foo{#![rustc_dummy] data: (),};
241-
let _ = #[rustc_dummy] Foo{#![rustc_dummy] ..s};
242-
let _ = #[rustc_dummy] Foo{#![rustc_dummy] data: (), ..s};
243-
let _ = #[rustc_dummy] (#![rustc_dummy] 0);
229+
let _ = #[rustc_dummy] Foo{data: (),};
230+
let _ = #[rustc_dummy] Foo{..s};
231+
let _ = #[rustc_dummy] Foo{data: (), ..s};
232+
let _ = #[rustc_dummy] (0);
244233
}
245234

246235
fn _12() {

‎src/test/ui/lint/expr_attr_paren_order.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ fn main() {
55
// Test that attributes on parens get concatenated
66
// in the expected order in the hir folder.
77

8-
#[deny(non_snake_case)] (
9-
#![allow(non_snake_case)]
8+
#[deny(non_snake_case)] #[allow(non_snake_case)] (
109
{
1110
let X = 0;
1211
let _ = X;
1312
}
1413
);
1514

16-
#[allow(non_snake_case)] (
17-
#![deny(non_snake_case)]
15+
#[allow(non_snake_case)] #[deny(non_snake_case)] (
1816
{
1917
let X = 0; //~ ERROR snake case name
2018
let _ = X;
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error: variable `X` should have a snake case name
2-
--> $DIR/expr_attr_paren_order.rs:19:17
2+
--> $DIR/expr_attr_paren_order.rs:17:17
33
|
44
LL | let X = 0;
55
| ^ help: convert the identifier to snake case (notice the capitalization): `x`
66
|
77
note: the lint level is defined here
8-
--> $DIR/expr_attr_paren_order.rs:17:17
8+
--> $DIR/expr_attr_paren_order.rs:15:37
99
|
10-
LL | #![deny(non_snake_case)]
11-
| ^^^^^^^^^^^^^^
10+
LL | #[allow(non_snake_case)] #[deny(non_snake_case)] (
11+
| ^^^^^^^^^^^^^^
1212

1313
error: aborting due to previous error
1414

‎src/test/ui/parser/stmt_expr_attrs_placement.rs

+16
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,31 @@ fn main() {
88
//~^ ERROR an inner attribute is not permitted in this context
99

1010
let b = (#![allow(warnings)] 1, 2);
11+
//~^ ERROR an inner attribute is not permitted in this context
1112

1213
let c = {
1314
#![allow(warnings)]
1415
(#![allow(warnings)] 1, 2)
16+
//~^ ERROR an inner attribute is not permitted in this context
1517
};
1618

1719
let d = {
1820
#![allow(warnings)]
1921
let e = (#![allow(warnings)] 1, 2);
22+
//~^ ERROR an inner attribute is not permitted in this context
2023
e
2124
};
25+
26+
let e = [#![allow(warnings)] 1, 2];
27+
//~^ ERROR an inner attribute is not permitted in this context
28+
29+
let f = [#![allow(warnings)] 1; 0];
30+
//~^ ERROR an inner attribute is not permitted in this context
31+
32+
let g = match true { #![allow(warnings)] _ => {} };
33+
//~^ ERROR an inner attribute is not permitted in this context
34+
35+
struct MyStruct { field: u8 }
36+
let h = MyStruct { #![allow(warnings)] field: 0 };
37+
//~^ ERROR an inner attribute is not permitted in this context
2238
}

‎src/test/ui/parser/stmt_expr_attrs_placement.stderr

+57-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,61 @@ LL | let a = #![allow(warnings)] (1, 2);
66
|
77
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
88

9-
error: aborting due to previous error
9+
error: an inner attribute is not permitted in this context
10+
--> $DIR/stmt_expr_attrs_placement.rs:10:14
11+
|
12+
LL | let b = (#![allow(warnings)] 1, 2);
13+
| ^^^^^^^^^^^^^^^^^^^
14+
|
15+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
16+
17+
error: an inner attribute is not permitted in this context
18+
--> $DIR/stmt_expr_attrs_placement.rs:15:10
19+
|
20+
LL | (#![allow(warnings)] 1, 2)
21+
| ^^^^^^^^^^^^^^^^^^^
22+
|
23+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
24+
25+
error: an inner attribute is not permitted in this context
26+
--> $DIR/stmt_expr_attrs_placement.rs:21:18
27+
|
28+
LL | let e = (#![allow(warnings)] 1, 2);
29+
| ^^^^^^^^^^^^^^^^^^^
30+
|
31+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
32+
33+
error: an inner attribute is not permitted in this context
34+
--> $DIR/stmt_expr_attrs_placement.rs:26:14
35+
|
36+
LL | let e = [#![allow(warnings)] 1, 2];
37+
| ^^^^^^^^^^^^^^^^^^^
38+
|
39+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
40+
41+
error: an inner attribute is not permitted in this context
42+
--> $DIR/stmt_expr_attrs_placement.rs:29:14
43+
|
44+
LL | let f = [#![allow(warnings)] 1; 0];
45+
| ^^^^^^^^^^^^^^^^^^^
46+
|
47+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
48+
49+
error: an inner attribute is not permitted in this context
50+
--> $DIR/stmt_expr_attrs_placement.rs:32:26
51+
|
52+
LL | let g = match true { #![allow(warnings)] _ => {} };
53+
| ^^^^^^^^^^^^^^^^^^^
54+
|
55+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
56+
57+
error: an inner attribute is not permitted in this context
58+
--> $DIR/stmt_expr_attrs_placement.rs:36:24
59+
|
60+
LL | let h = MyStruct { #![allow(warnings)] field: 0 };
61+
| ^^^^^^^^^^^^^^^^^^^
62+
|
63+
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.
64+
65+
error: aborting due to 8 previous errors
1066

‎src/test/ui/proc-macro/inner-attrs.rs

+1-31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// compile-flags: -Z span-debug --error-format human
22
// aux-build:test-macros.rs
33
// edition:2018
4+
45
#![feature(custom_inner_attributes)]
56
#![feature(proc_macro_hygiene)]
67
#![feature(stmt_expr_attributes)]
@@ -34,8 +35,6 @@ struct MyStruct {
3435
struct MyDerivePrint {
3536
field: [u8; {
3637
match true {
37-
#![cfg_attr(not(FALSE), rustc_dummy(first))]
38-
#![cfg_attr(not(FALSE), rustc_dummy(second))]
3938
_ => {
4039
#![cfg_attr(not(FALSE), rustc_dummy(third))]
4140
true
@@ -46,49 +45,20 @@ struct MyDerivePrint {
4645
}
4746

4847
fn bar() {
49-
(#![print_target_and_args(fifth)] 1, 2);
50-
//~^ ERROR expected non-macro inner attribute, found attribute macro
51-
5248
#[print_target_and_args(tuple_attrs)] (
53-
#![cfg_attr(FALSE, rustc_dummy)]
5449
3, 4, {
5550
#![cfg_attr(not(FALSE), rustc_dummy(innermost))]
5651
5
5752
}
5853
);
5954

60-
#[print_target_and_args(array_attrs)] [
61-
#![rustc_dummy(inner)]
62-
true; 0
63-
];
64-
6555
#[print_target_and_args(tuple_attrs)] (
66-
#![cfg_attr(FALSE, rustc_dummy)]
6756
3, 4, {
6857
#![cfg_attr(not(FALSE), rustc_dummy(innermost))]
6958
5
7059
}
7160
);
7261

73-
#[print_target_and_args(array_attrs)] [
74-
#![rustc_dummy(inner)]
75-
true; 0
76-
];
77-
78-
[#![print_target_and_args(sixth)] 1 , 2];
79-
//~^ ERROR expected non-macro inner attribute, found attribute macro
80-
[#![print_target_and_args(seventh)] true ; 5];
81-
//~^ ERROR expected non-macro inner attribute, found attribute macro
82-
83-
match 0 {
84-
#![print_target_and_args(eighth)]
85-
//~^ ERROR expected non-macro inner attribute, found attribute macro
86-
_ => {}
87-
}
88-
89-
MyStruct { #![print_target_and_args(ninth)] field: true };
90-
//~^ ERROR expected non-macro inner attribute, found attribute macro
91-
9262
for _ in &[true] {
9363
#![print_attr] //~ ERROR expected non-macro inner attribute
9464
}
+5-35
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,26 @@
1-
error: expected non-macro inner attribute, found attribute macro `print_target_and_args`
2-
--> $DIR/inner-attrs.rs:49:9
3-
|
4-
LL | (#![print_target_and_args(fifth)] 1, 2);
5-
| ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute
6-
7-
error: expected non-macro inner attribute, found attribute macro `print_target_and_args`
8-
--> $DIR/inner-attrs.rs:78:9
9-
|
10-
LL | [#![print_target_and_args(sixth)] 1 , 2];
11-
| ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute
12-
13-
error: expected non-macro inner attribute, found attribute macro `print_target_and_args`
14-
--> $DIR/inner-attrs.rs:80:9
15-
|
16-
LL | [#![print_target_and_args(seventh)] true ; 5];
17-
| ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute
18-
19-
error: expected non-macro inner attribute, found attribute macro `print_target_and_args`
20-
--> $DIR/inner-attrs.rs:84:12
21-
|
22-
LL | #![print_target_and_args(eighth)]
23-
| ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute
24-
25-
error: expected non-macro inner attribute, found attribute macro `print_target_and_args`
26-
--> $DIR/inner-attrs.rs:89:19
27-
|
28-
LL | MyStruct { #![print_target_and_args(ninth)] field: true };
29-
| ^^^^^^^^^^^^^^^^^^^^^ not a non-macro inner attribute
30-
311
error: expected non-macro inner attribute, found attribute macro `print_attr`
32-
--> $DIR/inner-attrs.rs:93:12
2+
--> $DIR/inner-attrs.rs:63:12
333
|
344
LL | #![print_attr]
355
| ^^^^^^^^^^ not a non-macro inner attribute
366

377
error: expected non-macro inner attribute, found attribute macro `print_attr`
38-
--> $DIR/inner-attrs.rs:97:12
8+
--> $DIR/inner-attrs.rs:67:12
399
|
4010
LL | #![print_attr]
4111
| ^^^^^^^^^^ not a non-macro inner attribute
4212

4313
error: expected non-macro inner attribute, found attribute macro `print_attr`
44-
--> $DIR/inner-attrs.rs:101:12
14+
--> $DIR/inner-attrs.rs:71:12
4515
|
4616
LL | #![print_attr]
4717
| ^^^^^^^^^^ not a non-macro inner attribute
4818

4919
error: expected non-macro inner attribute, found attribute macro `print_attr`
50-
--> $DIR/inner-attrs.rs:105:12
20+
--> $DIR/inner-attrs.rs:75:12
5121
|
5222
LL | #![print_attr]
5323
| ^^^^^^^^^^ not a non-macro inner attribute
5424

55-
error: aborting due to 9 previous errors
25+
error: aborting due to 4 previous errors
5626

‎src/test/ui/proc-macro/inner-attrs.stdout

+179-378
Large diffs are not rendered by default.

‎src/test/ui/proc-macro/simple-tuple.rs

-19
This file was deleted.

‎src/test/ui/proc-macro/simple-tuple.stdout

-79
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.