Skip to content

Commit

Permalink
Add some requested tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jul 2, 2020
1 parent 64a88db commit 52bdaaa
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/ui/parser/float-field-interpolated.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
struct S(u8, (u8, u8));

macro_rules! generate_field_accesses {
($a:tt, $b:literal, $c:expr) => {
let s = S(0, (0, 0));

s.$a; // OK
{ s.$b; } //~ ERROR unexpected token: `1.1`
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
{ s.$c; } //~ ERROR unexpected token: `1.1`
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
};
}

fn main() {
generate_field_accesses!(1.1, 1.1, 1.1);
}
46 changes: 46 additions & 0 deletions src/test/ui/parser/float-field-interpolated.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
error: unexpected token: `1.1`
--> $DIR/float-field-interpolated.rs:8:13
|
LL | { s.$b; }
| ^^
...
LL | generate_field_accesses!(1.1, 1.1, 1.1);
| ---------------------------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
--> $DIR/float-field-interpolated.rs:8:13
|
LL | { s.$b; }
| ^^ expected one of `.`, `;`, `?`, `}`, or an operator
...
LL | generate_field_accesses!(1.1, 1.1, 1.1);
| ---------------------------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: unexpected token: `1.1`
--> $DIR/float-field-interpolated.rs:10:13
|
LL | { s.$c; }
| ^^
...
LL | generate_field_accesses!(1.1, 1.1, 1.1);
| ---------------------------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1`
--> $DIR/float-field-interpolated.rs:10:13
|
LL | { s.$c; }
| ^^ expected one of `.`, `;`, `?`, `}`, or an operator
...
LL | generate_field_accesses!(1.1, 1.1, 1.1);
| ---------------------------------------- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 4 previous errors

1 change: 1 addition & 0 deletions src/test/ui/tuple/index-float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ fn main() {
let tuple = (((),),);

let _ = tuple. 0.0; // OK, whitespace
let _ = tuple.0. 0; // OK, whitespace

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

0 comments on commit 52bdaaa

Please sign in to comment.