Skip to content

Commit 244cefa

Browse files
Updated uitests for new parser
1 parent 21bbb8b commit 244cefa

20 files changed

+102
-118
lines changed

tests/ui/attributes/key-value-expansion.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
error: attribute value must be a literal
2-
--> $DIR/key-value-expansion.rs:21:6
3-
|
4-
LL | bug!((column!()));
5-
| ^^^^^^^^^^^
6-
71
error: attribute value must be a literal
82
--> $DIR/key-value-expansion.rs:27:14
93
|
@@ -26,5 +20,11 @@ LL | some_macro!(u8);
2620
|
2721
= note: this error originates in the macro `some_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
2822

23+
error: attribute value must be a literal
24+
--> $DIR/key-value-expansion.rs:21:6
25+
|
26+
LL | bug!((column!()));
27+
| ^^^^^^^^^^^
28+
2929
error: aborting due to 3 previous errors
3030

tests/ui/attributes/malformed-fn-align.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn f3() {}
2626
#[repr(align(16))] //~ ERROR `#[repr(align(...))]` is not supported on function items
2727
fn f4() {}
2828

29-
#[rustc_align(-1)] //~ ERROR expected unsuffixed literal, found `-`
29+
#[rustc_align(-1)] //~ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `-`
3030
fn f5() {}
3131

3232
#[rustc_align(3)] //~ ERROR invalid alignment value: not a power of two

tests/ui/attributes/malformed-fn-align.stderr

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
error: expected unsuffixed literal, found `-`
2-
--> $DIR/malformed-fn-align.rs:29:15
3-
|
4-
LL | #[rustc_align(-1)]
5-
| ^
6-
7-
error: suffixed literals are not allowed in attributes
8-
--> $DIR/malformed-fn-align.rs:35:15
9-
|
10-
LL | #[rustc_align(4usize)]
11-
| ^^^^^^
12-
|
13-
= help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
14-
151
error[E0539]: malformed `rustc_align` attribute input
162
--> $DIR/malformed-fn-align.rs:10:5
173
|
@@ -51,12 +37,32 @@ error[E0589]: invalid alignment value: not a power of two
5137
LL | #[rustc_align(0)]
5238
| ^
5339

40+
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `-`
41+
--> $DIR/malformed-fn-align.rs:29:15
42+
|
43+
LL | #[rustc_align(-1)]
44+
| ^
45+
|
46+
help: negative numbers are not literals, try removing the `-` sign
47+
|
48+
LL - #[rustc_align(-1)]
49+
LL + #[rustc_align(1)]
50+
|
51+
5452
error[E0589]: invalid alignment value: not a power of two
5553
--> $DIR/malformed-fn-align.rs:32:15
5654
|
5755
LL | #[rustc_align(3)]
5856
| ^
5957

58+
error: suffixed literals are not allowed in attributes
59+
--> $DIR/malformed-fn-align.rs:35:15
60+
|
61+
LL | #[rustc_align(4usize)]
62+
| ^^^^^^
63+
|
64+
= help: instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
65+
6066
error[E0589]: invalid alignment value: not an unsuffixed integer
6167
--> $DIR/malformed-fn-align.rs:35:15
6268
|

tests/ui/attributes/nonterminal-expansion.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
macro_rules! pass_nonterminal {
66
($n:expr) => {
77
#[repr(align($n))]
8-
//~^ ERROR expected unsuffixed literal, found `expr` metavariable
8+
//~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable
99
struct S;
1010
};
1111
}
@@ -15,6 +15,5 @@ macro_rules! n {
1515
}
1616

1717
pass_nonterminal!(n!());
18-
//~^ ERROR incorrect `repr(align)` attribute format: `align` expects a literal integer as argument [E0693]
1918

2019
fn main() {}
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: expected unsuffixed literal, found `expr` metavariable
1+
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable
22
--> $DIR/nonterminal-expansion.rs:7:22
33
|
44
LL | #[repr(align($n))]
@@ -9,12 +9,5 @@ LL | pass_nonterminal!(n!());
99
|
1010
= note: this error originates in the macro `pass_nonterminal` (in Nightly builds, run with -Z macro-backtrace for more info)
1111

12-
error[E0693]: incorrect `repr(align)` attribute format: `align` expects a literal integer as argument
13-
--> $DIR/nonterminal-expansion.rs:17:19
14-
|
15-
LL | pass_nonterminal!(n!());
16-
| ^
17-
18-
error: aborting due to 2 previous errors
12+
error: aborting due to 1 previous error
1913

20-
For more information about this error, try `rustc --explain E0693`.

tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@ LL | #[unsafe(proc_macro_derive(Foo))]
2828
|
2929
= note: extraneous unsafe is not allowed in attributes
3030

31-
error: expected identifier, found keyword `unsafe`
32-
--> $DIR/proc-unsafe-attributes.rs:12:21
33-
|
34-
LL | #[proc_macro_derive(unsafe(Foo))]
35-
| ^^^^^^ expected identifier, found keyword
36-
|
37-
help: escape `unsafe` to use it as an identifier
38-
|
39-
LL | #[proc_macro_derive(r#unsafe(Foo))]
40-
| ++
41-
4231
error: `proc_macro_attribute` is not an unsafe attribute
4332
--> $DIR/proc-unsafe-attributes.rs:18:3
4433
|
@@ -114,6 +103,17 @@ LL | #[unsafe(allow(unsafe(dead_code)))]
114103
|
115104
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
116105

106+
error: expected identifier, found keyword `unsafe`
107+
--> $DIR/proc-unsafe-attributes.rs:12:21
108+
|
109+
LL | #[proc_macro_derive(unsafe(Foo))]
110+
| ^^^^^^ expected identifier, found keyword
111+
|
112+
help: escape `unsafe` to use it as an identifier
113+
|
114+
LL | #[proc_macro_derive(r#unsafe(Foo))]
115+
| ++
116+
117117
error[E0565]: malformed `proc_macro_derive` attribute input
118118
--> $DIR/proc-unsafe-attributes.rs:12:1
119119
|

tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct S9;
3838
macro_rules! generate_s10 {
3939
($expr: expr) => {
4040
#[cfg(feature = $expr)]
41-
//~^ ERROR expected unsuffixed literal, found `expr` metavariable
41+
//~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable
4242
struct S10;
4343
}
4444
}

tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ LL | #[cfg(a = b"hi")]
7171
|
7272
= note: expected a normal string literal, not a byte string literal
7373

74-
error: expected unsuffixed literal, found `expr` metavariable
74+
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable
7575
--> $DIR/cfg-attr-syntax-validation.rs:40:25
7676
|
7777
LL | #[cfg(feature = $expr)]

tests/ui/coverage-attr/bad-syntax.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
error: expected identifier, found `,`
2-
--> $DIR/bad-syntax.rs:44:12
3-
|
4-
LL | #[coverage(,off)]
5-
| ^ expected identifier
6-
|
7-
help: remove this comma
8-
|
9-
LL - #[coverage(,off)]
10-
LL + #[coverage(off)]
11-
|
12-
131
error: multiple `coverage` attributes
142
--> $DIR/bad-syntax.rs:9:1
153
|
@@ -162,6 +150,18 @@ LL - #[coverage(off, bogus)]
162150
LL + #[coverage(on)]
163151
|
164152

153+
error: expected identifier, found `,`
154+
--> $DIR/bad-syntax.rs:44:12
155+
|
156+
LL | #[coverage(,off)]
157+
| ^ expected identifier
158+
|
159+
help: remove this comma
160+
|
161+
LL - #[coverage(,off)]
162+
LL + #[coverage(off)]
163+
|
164+
165165
error: aborting due to 11 previous errors
166166

167167
Some errors have detailed explanations: E0539, E0805.

tests/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
// was a well-formed `MetaItem`.
44

55
fn main() {
6-
foo() //~ WARNING use of deprecated function `foo`
6+
foo()
77
}
88

99
#[deprecated(note = test)]
10-
//~^ ERROR expected unsuffixed literal, found `test`
10+
//~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `test`
1111
fn foo() {}

0 commit comments

Comments
 (0)