Skip to content

Commit 52bdaaa

Browse files
committed
Add some requested tests
1 parent 64a88db commit 52bdaaa

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
struct S(u8, (u8, u8));
2+
3+
macro_rules! generate_field_accesses {
4+
($a:tt, $b:literal, $c:expr) => {
5+
let s = S(0, (0, 0));
6+
7+
s.$a; // OK
8+
{ s.$b; } //~ ERROR unexpected token: `1.1`
9+
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
10+
{ s.$c; } //~ ERROR unexpected token: `1.1`
11+
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
12+
};
13+
}
14+
15+
fn main() {
16+
generate_field_accesses!(1.1, 1.1, 1.1);
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
error: unexpected token: `1.1`
2+
--> $DIR/float-field-interpolated.rs:8:13
3+
|
4+
LL | { s.$b; }
5+
| ^^
6+
...
7+
LL | generate_field_accesses!(1.1, 1.1, 1.1);
8+
| ---------------------------------------- in this macro invocation
9+
|
10+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
11+
12+
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
13+
--> $DIR/float-field-interpolated.rs:8:13
14+
|
15+
LL | { s.$b; }
16+
| ^^ expected one of `.`, `;`, `?`, `}`, or an operator
17+
...
18+
LL | generate_field_accesses!(1.1, 1.1, 1.1);
19+
| ---------------------------------------- in this macro invocation
20+
|
21+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
22+
23+
error: unexpected token: `1.1`
24+
--> $DIR/float-field-interpolated.rs:10:13
25+
|
26+
LL | { s.$c; }
27+
| ^^
28+
...
29+
LL | generate_field_accesses!(1.1, 1.1, 1.1);
30+
| ---------------------------------------- in this macro invocation
31+
|
32+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
33+
34+
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
35+
--> $DIR/float-field-interpolated.rs:10:13
36+
|
37+
LL | { s.$c; }
38+
| ^^ expected one of `.`, `;`, `?`, `}`, or an operator
39+
...
40+
LL | generate_field_accesses!(1.1, 1.1, 1.1);
41+
| ---------------------------------------- in this macro invocation
42+
|
43+
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
44+
45+
error: aborting due to 4 previous errors
46+

src/test/ui/tuple/index-float.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fn main() {
44
let tuple = (((),),);
55

66
let _ = tuple. 0.0; // OK, whitespace
7+
let _ = tuple.0. 0; // OK, whitespace
78

89
let _ = tuple./*special cases*/0.0; // OK, comment
910
}

0 commit comments

Comments
 (0)