diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs (renamed from tests/ui/parser/assoc-const-underscore-semantic-fail.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr (renamed from tests/ui/parser/assoc-const-underscore-semantic-fail.stderr) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs (renamed from tests/ui/parser/assoc-const-underscore-syntactic-pass.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-oddities-1.rs (renamed from tests/ui/parser/assoc-oddities-1.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-oddities-1.stderr (renamed from tests/ui/parser/assoc-oddities-1.stderr) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-oddities-2.rs (renamed from tests/ui/parser/assoc-oddities-2.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-oddities-2.stderr (renamed from tests/ui/parser/assoc-oddities-2.stderr) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-static-semantic-fail.rs (renamed from tests/ui/parser/assoc-static-semantic-fail.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-static-semantic-fail.stderr (renamed from tests/ui/parser/assoc-static-semantic-fail.stderr) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-static-syntactic-fail.rs (renamed from tests/ui/parser/assoc-static-syntactic-fail.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr (renamed from tests/ui/parser/assoc-static-syntactic-fail.stderr) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-type-in-type-arg.rs (renamed from tests/ui/parser/assoc-type-in-type-arg.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/assoc-type-in-type-arg.stderr (renamed from tests/ui/parser/assoc-type-in-type-arg.stderr) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs (renamed from tests/ui/parser/associated-types-project-from-hrtb-explicit.rs) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr (renamed from tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr) | 0 | ||||
| -rw-r--r-- | tests/ui/parser/issues/issue-15980.rs | 3 | ||||
| -rw-r--r-- | tests/ui/parser/issues/issue-15980.stderr | 13 | ||||
| -rw-r--r-- | tests/ui/parser/issues/issue-52496.stderr | 9 | ||||
| -rw-r--r-- | tests/ui/parser/issues/issue-89396.fixed | 4 | ||||
| -rw-r--r-- | tests/ui/parser/issues/issue-89396.rs | 4 | ||||
| -rw-r--r-- | tests/ui/parser/issues/issue-89396.stderr | 4 | ||||
| -rw-r--r-- | tests/ui/parser/missing-fat-arrow.rs | 38 | ||||
| -rw-r--r-- | tests/ui/parser/missing-fat-arrow.stderr | 78 | ||||
| -rw-r--r-- | tests/ui/parser/removed-syntax-with-2.stderr | 5 |
24 files changed, 136 insertions, 22 deletions
diff --git a/tests/ui/parser/assoc-const-underscore-semantic-fail.rs b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs index d37ce06c555..d37ce06c555 100644 --- a/tests/ui/parser/assoc-const-underscore-semantic-fail.rs +++ b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs diff --git a/tests/ui/parser/assoc-const-underscore-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr index 538bf0ec100..538bf0ec100 100644 --- a/tests/ui/parser/assoc-const-underscore-semantic-fail.stderr +++ b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr diff --git a/tests/ui/parser/assoc-const-underscore-syntactic-pass.rs b/tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs index 60da408c811..60da408c811 100644 --- a/tests/ui/parser/assoc-const-underscore-syntactic-pass.rs +++ b/tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs diff --git a/tests/ui/parser/assoc-oddities-1.rs b/tests/ui/parser/assoc/assoc-oddities-1.rs index 5914805e5c1..5914805e5c1 100644 --- a/tests/ui/parser/assoc-oddities-1.rs +++ b/tests/ui/parser/assoc/assoc-oddities-1.rs diff --git a/tests/ui/parser/assoc-oddities-1.stderr b/tests/ui/parser/assoc/assoc-oddities-1.stderr index acf71b4893a..acf71b4893a 100644 --- a/tests/ui/parser/assoc-oddities-1.stderr +++ b/tests/ui/parser/assoc/assoc-oddities-1.stderr diff --git a/tests/ui/parser/assoc-oddities-2.rs b/tests/ui/parser/assoc/assoc-oddities-2.rs index 3d35aad7455..3d35aad7455 100644 --- a/tests/ui/parser/assoc-oddities-2.rs +++ b/tests/ui/parser/assoc/assoc-oddities-2.rs diff --git a/tests/ui/parser/assoc-oddities-2.stderr b/tests/ui/parser/assoc/assoc-oddities-2.stderr index d3b90c34c29..d3b90c34c29 100644 --- a/tests/ui/parser/assoc-oddities-2.stderr +++ b/tests/ui/parser/assoc/assoc-oddities-2.stderr diff --git a/tests/ui/parser/assoc-static-semantic-fail.rs b/tests/ui/parser/assoc/assoc-static-semantic-fail.rs index 403160f1253..403160f1253 100644 --- a/tests/ui/parser/assoc-static-semantic-fail.rs +++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.rs diff --git a/tests/ui/parser/assoc-static-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr index 8178bd22373..8178bd22373 100644 --- a/tests/ui/parser/assoc-static-semantic-fail.stderr +++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr diff --git a/tests/ui/parser/assoc-static-syntactic-fail.rs b/tests/ui/parser/assoc/assoc-static-syntactic-fail.rs index 492f2ea16ef..492f2ea16ef 100644 --- a/tests/ui/parser/assoc-static-syntactic-fail.rs +++ b/tests/ui/parser/assoc/assoc-static-syntactic-fail.rs diff --git a/tests/ui/parser/assoc-static-syntactic-fail.stderr b/tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr index e9723614512..e9723614512 100644 --- a/tests/ui/parser/assoc-static-syntactic-fail.stderr +++ b/tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr diff --git a/tests/ui/parser/assoc-type-in-type-arg.rs b/tests/ui/parser/assoc/assoc-type-in-type-arg.rs index 000956ea24f..000956ea24f 100644 --- a/tests/ui/parser/assoc-type-in-type-arg.rs +++ b/tests/ui/parser/assoc/assoc-type-in-type-arg.rs diff --git a/tests/ui/parser/assoc-type-in-type-arg.stderr b/tests/ui/parser/assoc/assoc-type-in-type-arg.stderr index b637702f21e..b637702f21e 100644 --- a/tests/ui/parser/assoc-type-in-type-arg.stderr +++ b/tests/ui/parser/assoc/assoc-type-in-type-arg.stderr diff --git a/tests/ui/parser/associated-types-project-from-hrtb-explicit.rs b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs index b238a9ca226..b238a9ca226 100644 --- a/tests/ui/parser/associated-types-project-from-hrtb-explicit.rs +++ b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs diff --git a/tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr index aa0fa0e3c0a..aa0fa0e3c0a 100644 --- a/tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr +++ b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr diff --git a/tests/ui/parser/issues/issue-15980.rs b/tests/ui/parser/issues/issue-15980.rs index 87faa7d5ff1..eb7b6ca8296 100644 --- a/tests/ui/parser/issues/issue-15980.rs +++ b/tests/ui/parser/issues/issue-15980.rs @@ -9,9 +9,6 @@ fn main(){ //~^ ERROR expected identifier, found keyword `return` //~| NOTE expected identifier, found keyword } - //~^ NOTE expected one of `.`, `=>`, `?`, or an operator _ => {} - //~^ ERROR expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_` - //~| NOTE unexpected token } } diff --git a/tests/ui/parser/issues/issue-15980.stderr b/tests/ui/parser/issues/issue-15980.stderr index c59c811199e..cf8d0114787 100644 --- a/tests/ui/parser/issues/issue-15980.stderr +++ b/tests/ui/parser/issues/issue-15980.stderr @@ -11,15 +11,10 @@ help: escape `return` to use it as an identifier | LL | r#return | ++ - -error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_` - --> $DIR/issue-15980.rs:13:9 +help: you might have meant to start a match arm after the match guard | -LL | } - | - expected one of `.`, `=>`, `?`, or an operator -LL | -LL | _ => {} - | ^ unexpected token +LL | Err(ref e) if e.kind == io::EndOfFile => { + | ++ -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-52496.stderr b/tests/ui/parser/issues/issue-52496.stderr index 77335c64c21..78c81bf5b0d 100644 --- a/tests/ui/parser/issues/issue-52496.stderr +++ b/tests/ui/parser/issues/issue-52496.stderr @@ -8,10 +8,15 @@ error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/issue-52496.rs:8:22 | LL | let _ = Foo { bar.into(), bat: -1, . }; - | --- - ^ expected one of `,`, `:`, or `}` + | --- ---^ expected one of `,`, `:`, or `}` | | | - | | help: try naming a field: `bar:` + | | while parsing this struct field | while parsing this struct + | +help: try naming a field + | +LL | let _ = Foo { bar: bar.into(), bat: -1, . }; + | ++++ error: expected identifier, found `.` --> $DIR/issue-52496.rs:8:40 diff --git a/tests/ui/parser/issues/issue-89396.fixed b/tests/ui/parser/issues/issue-89396.fixed index 823ad8cd1f8..0c040ddea44 100644 --- a/tests/ui/parser/issues/issue-89396.fixed +++ b/tests/ui/parser/issues/issue-89396.fixed @@ -8,9 +8,9 @@ fn main() { let _ = match opt { Some(_) => true, //~^ ERROR: expected one of - //~| HELP: try using a fat arrow here + //~| HELP: use a fat arrow to start a match arm None => false, //~^ ERROR: expected one of - //~| HELP: try using a fat arrow here + //~| HELP: use a fat arrow to start a match arm }; } diff --git a/tests/ui/parser/issues/issue-89396.rs b/tests/ui/parser/issues/issue-89396.rs index f1d9efa524f..d95f666d797 100644 --- a/tests/ui/parser/issues/issue-89396.rs +++ b/tests/ui/parser/issues/issue-89396.rs @@ -8,9 +8,9 @@ fn main() { let _ = match opt { Some(_) = true, //~^ ERROR: expected one of - //~| HELP: try using a fat arrow here + //~| HELP: use a fat arrow to start a match arm None -> false, //~^ ERROR: expected one of - //~| HELP: try using a fat arrow here + //~| HELP: use a fat arrow to start a match arm }; } diff --git a/tests/ui/parser/issues/issue-89396.stderr b/tests/ui/parser/issues/issue-89396.stderr index 504420574e2..41ce0705074 100644 --- a/tests/ui/parser/issues/issue-89396.stderr +++ b/tests/ui/parser/issues/issue-89396.stderr @@ -5,7 +5,7 @@ LL | Some(_) = true, | ^ | | | expected one of `=>`, `if`, or `|` - | help: try using a fat arrow here: `=>` + | help: use a fat arrow to start a match arm: `=>` error: expected one of `=>`, `@`, `if`, or `|`, found `->` --> $DIR/issue-89396.rs:12:14 @@ -14,7 +14,7 @@ LL | None -> false, | ^^ | | | expected one of `=>`, `@`, `if`, or `|` - | help: try using a fat arrow here: `=>` + | help: use a fat arrow to start a match arm: `=>` error: aborting due to 2 previous errors diff --git a/tests/ui/parser/missing-fat-arrow.rs b/tests/ui/parser/missing-fat-arrow.rs new file mode 100644 index 00000000000..325f1ccf2fd --- /dev/null +++ b/tests/ui/parser/missing-fat-arrow.rs @@ -0,0 +1,38 @@ +fn main() { + let x = 1; + let y = 2; + let value = 3; + + match value { + Some(x) if x == y { + self.next_token()?; //~ ERROR expected identifier, found keyword `self` + }, + _ => {} + } + let _: i32 = (); //~ ERROR mismatched types +} + +struct Foo { + value: usize +} + +fn foo(a: Option<&mut Foo>, b: usize) { + match a { + Some(a) if a.value == b { + a.value = 1; //~ ERROR expected one of `,`, `:`, or `}`, found `.` + }, + _ => {} + } + let _: i32 = (); //~ ERROR mismatched types +} + +fn bar(a: Option<&mut Foo>, b: usize) { + match a { + Some(a) if a.value == b { + a.value, //~ ERROR expected one of `,`, `:`, or `}`, found `.` + } => { + } + _ => {} + } + let _: i32 = (); //~ ERROR mismatched types +} diff --git a/tests/ui/parser/missing-fat-arrow.stderr b/tests/ui/parser/missing-fat-arrow.stderr new file mode 100644 index 00000000000..a6c786905e9 --- /dev/null +++ b/tests/ui/parser/missing-fat-arrow.stderr @@ -0,0 +1,78 @@ +error: expected identifier, found keyword `self` + --> $DIR/missing-fat-arrow.rs:8:13 + | +LL | Some(x) if x == y { + | - while parsing this struct +LL | self.next_token()?; + | ^^^^ expected identifier, found keyword + | +help: you might have meant to start a match arm after the match guard + | +LL | Some(x) if x == y => { + | ++ + +error: expected one of `,`, `:`, or `}`, found `.` + --> $DIR/missing-fat-arrow.rs:22:14 + | +LL | Some(a) if a.value == b { + | - while parsing this struct +LL | a.value = 1; + | -^ expected one of `,`, `:`, or `}` + | | + | while parsing this struct field + | +help: try naming a field + | +LL | a: a.value = 1; + | ++ +help: you might have meant to start a match arm after the match guard + | +LL | Some(a) if a.value == b => { + | ++ + +error: expected one of `,`, `:`, or `}`, found `.` + --> $DIR/missing-fat-arrow.rs:32:14 + | +LL | Some(a) if a.value == b { + | - while parsing this struct +LL | a.value, + | -^ expected one of `,`, `:`, or `}` + | | + | while parsing this struct field + | +help: try naming a field + | +LL | a: a.value, + | ++ +help: you might have meant to start a match arm after the match guard + | +LL | Some(a) if a.value == b => { + | ++ + +error[E0308]: mismatched types + --> $DIR/missing-fat-arrow.rs:12:18 + | +LL | let _: i32 = (); + | --- ^^ expected `i32`, found `()` + | | + | expected due to this + +error[E0308]: mismatched types + --> $DIR/missing-fat-arrow.rs:26:18 + | +LL | let _: i32 = (); + | --- ^^ expected `i32`, found `()` + | | + | expected due to this + +error[E0308]: mismatched types + --> $DIR/missing-fat-arrow.rs:37:18 + | +LL | let _: i32 = (); + | --- ^^ expected `i32`, found `()` + | | + | expected due to this + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/removed-syntax-with-2.stderr b/tests/ui/parser/removed-syntax-with-2.stderr index c6ae1ce674f..e75c5bcd643 100644 --- a/tests/ui/parser/removed-syntax-with-2.stderr +++ b/tests/ui/parser/removed-syntax-with-2.stderr @@ -2,8 +2,9 @@ error: expected one of `,`, `:`, or `}`, found `a` --> $DIR/removed-syntax-with-2.rs:8:31 | LL | let b = S { foo: (), with a }; - | - ^ expected one of `,`, `:`, or `}` - | | + | - ---- ^ expected one of `,`, `:`, or `}` + | | | + | | while parsing this struct field | while parsing this struct error[E0063]: missing field `bar` in initializer of `S` |
