diff options
Diffstat (limited to 'src/test/ui/parser')
87 files changed, 843 insertions, 300 deletions
diff --git a/src/test/ui/parser/assoc-static-semantic-fail.stderr b/src/test/ui/parser/assoc-static-semantic-fail.stderr index 7ae092cee..8a74f49b9 100644 --- a/src/test/ui/parser/assoc-static-semantic-fail.stderr +++ b/src/test/ui/parser/assoc-static-semantic-fail.stderr @@ -168,9 +168,9 @@ warning: the feature `specialization` is incomplete and may not be safe to use a LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default error: aborting due to 24 previous errors; 1 warning emitted diff --git a/src/test/ui/parser/attr-stmt-expr-attr-bad.rs b/src/test/ui/parser/attr-stmt-expr-attr-bad.rs index 09f494bdc..469c3855c 100644 --- a/src/test/ui/parser/attr-stmt-expr-attr-bad.rs +++ b/src/test/ui/parser/attr-stmt-expr-attr-bad.rs @@ -1,5 +1,3 @@ -#![feature(half_open_range_patterns)] - fn main() {} #[cfg(FALSE)] fn e() { let _ = box #![attr] 0; } diff --git a/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr b/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr index 7bb3db030..872c560cb 100644 --- a/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr +++ b/src/test/ui/parser/attr-stmt-expr-attr-bad.stderr @@ -1,5 +1,5 @@ error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:5:36 + --> $DIR/attr-stmt-expr-attr-bad.rs:3:36 | LL | #[cfg(FALSE)] fn e() { let _ = box #![attr] 0; } | ^^^^^^^^ @@ -8,19 +8,19 @@ LL | #[cfg(FALSE)] fn e() { let _ = box #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `]` - --> $DIR/attr-stmt-expr-attr-bad.rs:7:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:5:40 | LL | #[cfg(FALSE)] fn e() { let _ = [#[attr]]; } | ^ expected expression error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:9:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:7:35 | LL | #[cfg(FALSE)] fn e() { let _ = foo#[attr](); } | ^ expected one of 8 possible tokens error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:11:36 + --> $DIR/attr-stmt-expr-attr-bad.rs:9:36 | LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | ^^^^^^^^ @@ -29,13 +29,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `)` - --> $DIR/attr-stmt-expr-attr-bad.rs:11:44 + --> $DIR/attr-stmt-expr-attr-bad.rs:9:44 | LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | ^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:14:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:12:38 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | ^^^^^^^^ @@ -44,13 +44,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `)` - --> $DIR/attr-stmt-expr-attr-bad.rs:14:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:12:46 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | ^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:17:36 + --> $DIR/attr-stmt-expr-attr-bad.rs:15:36 | LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } | ^^^^^^^^ @@ -59,7 +59,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:19:33 + --> $DIR/attr-stmt-expr-attr-bad.rs:17:33 | LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } | ^^^^^^^^ @@ -68,7 +68,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:21:33 + --> $DIR/attr-stmt-expr-attr-bad.rs:19:33 | LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } | ^^^^^^^^ @@ -77,13 +77,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:23:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:21:34 | LL | #[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; } | ^ expected one of 8 possible tokens error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:25:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:23:35 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } | ^^^^^^^^ @@ -92,7 +92,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:27:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:25:40 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } | ^^^^^^^^ @@ -101,7 +101,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:29:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:27:35 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } | ^^^^^^^^ @@ -110,7 +110,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:31:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:29:40 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } | ^^^^^^^^ @@ -119,19 +119,19 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `..` - --> $DIR/attr-stmt-expr-attr-bad.rs:33:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:31:40 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; } | ^^ expected expression error: expected expression, found `..` - --> $DIR/attr-stmt-expr-attr-bad.rs:35:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:33:40 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..; } | ^^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:37:41 + --> $DIR/attr-stmt-expr-attr-bad.rs:35:41 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } | ^^^^^^^^ @@ -140,7 +140,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:39:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:37:45 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } | ^^^^^^^^ @@ -149,7 +149,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:41:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:39:37 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -158,7 +158,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:43:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:41:38 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } | ^^^^^^^^ @@ -167,13 +167,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:45:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:43:40 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:47:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:45:45 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch @@ -182,7 +182,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | the branch belongs to this `else` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:49:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:47:46 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } | ^^^^^^^^ @@ -191,7 +191,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:51:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:49:45 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | ---- ^^^^^^^ ------- the attributes are attached to this branch @@ -200,7 +200,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | the branch belongs to this `else` error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:53:50 + --> $DIR/attr-stmt-expr-attr-bad.rs:51:50 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -209,7 +209,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:55:51 + --> $DIR/attr-stmt-expr-attr-bad.rs:53:51 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } | ^^^^^^^^ @@ -218,7 +218,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:57:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:55:45 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -227,7 +227,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:59:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:57:46 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } | ^^^^^^^^ @@ -236,13 +236,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:61:48 + --> $DIR/attr-stmt-expr-attr-bad.rs:59:48 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:63:53 + --> $DIR/attr-stmt-expr-attr-bad.rs:61:53 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch @@ -251,7 +251,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | the branch belongs to this `else` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:65:54 + --> $DIR/attr-stmt-expr-attr-bad.rs:63:54 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } | ^^^^^^^^ @@ -260,7 +260,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:67:53 + --> $DIR/attr-stmt-expr-attr-bad.rs:65:53 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | ---- ^^^^^^^ --------------- the attributes are attached to this branch @@ -269,7 +269,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {} | the branch belongs to this `else` error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:69:66 + --> $DIR/attr-stmt-expr-attr-bad.rs:67:66 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -278,7 +278,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {} | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:71:67 + --> $DIR/attr-stmt-expr-attr-bad.rs:69:67 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; } | ^^^^^^^^ @@ -287,7 +287,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]} = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:74:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:72:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } | ------- ^^^^^^^^ not permitted following an outer attribute @@ -298,7 +298,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:76:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:74:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } | ------- ^^^^^^^^ not permitted following an outer attribute @@ -309,7 +309,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:78:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:76:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation @@ -325,7 +325,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!(); } | error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:80:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:78:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation @@ -341,7 +341,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo![]; } | error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:82:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:80:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } | ------- ^^^^^^^^ ------ the inner attribute doesn't annotate this item macro invocation @@ -357,7 +357,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!{}; } | error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:86:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | ^^^ help: use `..` instead @@ -365,13 +365,13 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:88:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:86:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | ^ expected one of `=>`, `if`, or `|` error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:91:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:89:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | ^^^ help: use `..` instead @@ -379,19 +379,19 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:91:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:89:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | ^ expected one of `=>`, `if`, or `|` error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:94:39 + --> $DIR/attr-stmt-expr-attr-bad.rs:92:39 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } } | ^ error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:96:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:94:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | ^^^ help: use `..` instead @@ -399,43 +399,43 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:96:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:94:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | ^ expected one of `=>`, `if`, or `|` error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:100:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:98:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | ^ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:100:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:98:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:103:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:101:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | ^ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:103:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:101:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: expected statement after outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:108:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:106:37 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } } | ^^^^^^^ error: expected statement after outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:110:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:108:37 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } } | ^^^^^^^ diff --git a/src/test/ui/parser/bad-let-as-field.rs b/src/test/ui/parser/bad-let-as-field.rs new file mode 100644 index 000000000..fec2bc256 --- /dev/null +++ b/src/test/ui/parser/bad-let-as-field.rs @@ -0,0 +1,6 @@ +struct Foo { + let: i32, + //~^ ERROR expected identifier, found keyword +} + +fn main() {} diff --git a/src/test/ui/parser/bad-let-as-field.stderr b/src/test/ui/parser/bad-let-as-field.stderr new file mode 100644 index 000000000..57def42b1 --- /dev/null +++ b/src/test/ui/parser/bad-let-as-field.stderr @@ -0,0 +1,15 @@ +error: expected identifier, found keyword `let` + --> $DIR/bad-let-as-field.rs:2:5 + | +LL | struct Foo { + | --- while parsing this struct +LL | let: i32, + | ^^^ expected identifier, found keyword + | +help: escape `let` to use it as an identifier + | +LL | r#let: i32, + | ++ + +error: aborting due to previous error + diff --git a/src/test/ui/parser/bad-lit-suffixes.rs b/src/test/ui/parser/bad-lit-suffixes.rs index 446a09405..9724533c4 100644 --- a/src/test/ui/parser/bad-lit-suffixes.rs +++ b/src/test/ui/parser/bad-lit-suffixes.rs @@ -1,18 +1,18 @@ extern - "C"suffix //~ ERROR suffixes on a string literal are invalid + "C"suffix //~ ERROR suffixes on string literals are invalid fn foo() {} extern - "C"suffix //~ ERROR suffixes on a string literal are invalid + "C"suffix //~ ERROR suffixes on string literals are invalid {} fn main() { - ""suffix; //~ ERROR suffixes on a string literal are invalid - b""suffix; //~ ERROR suffixes on a byte string literal are invalid - r#""#suffix; //~ ERROR suffixes on a string literal are invalid - br#""#suffix; //~ ERROR suffixes on a byte string literal are invalid - 'a'suffix; //~ ERROR suffixes on a char literal are invalid - b'a'suffix; //~ ERROR suffixes on a byte literal are invalid + ""suffix; //~ ERROR suffixes on string literals are invalid + b""suffix; //~ ERROR suffixes on byte string literals are invalid + r#""#suffix; //~ ERROR suffixes on string literals are invalid + br#""#suffix; //~ ERROR suffixes on byte string literals are invalid + 'a'suffix; //~ ERROR suffixes on char literals are invalid + b'a'suffix; //~ ERROR suffixes on byte literals are invalid 1234u1024; //~ ERROR invalid width `1024` for integer literal 1234i1024; //~ ERROR invalid width `1024` for integer literal diff --git a/src/test/ui/parser/bad-lit-suffixes.stderr b/src/test/ui/parser/bad-lit-suffixes.stderr index 9b5965714..f74eef324 100644 --- a/src/test/ui/parser/bad-lit-suffixes.stderr +++ b/src/test/ui/parser/bad-lit-suffixes.stderr @@ -1,46 +1,46 @@ -error: suffixes on a string literal are invalid +error: suffixes on string literals are invalid --> $DIR/bad-lit-suffixes.rs:2:5 | LL | "C"suffix | ^^^^^^^^^ invalid suffix `suffix` -error: suffixes on a string literal are invalid +error: suffixes on string literals are invalid --> $DIR/bad-lit-suffixes.rs:6:5 | LL | "C"suffix | ^^^^^^^^^ invalid suffix `suffix` -error: suffixes on a string literal are invalid +error: suffixes on string literals are invalid --> $DIR/bad-lit-suffixes.rs:10:5 | LL | ""suffix; | ^^^^^^^^ invalid suffix `suffix` -error: suffixes on a byte string literal are invalid +error: suffixes on byte string literals are invalid --> $DIR/bad-lit-suffixes.rs:11:5 | LL | b""suffix; | ^^^^^^^^^ invalid suffix `suffix` -error: suffixes on a string literal are invalid +error: suffixes on string literals are invalid --> $DIR/bad-lit-suffixes.rs:12:5 | LL | r#""#suffix; | ^^^^^^^^^^^ invalid suffix `suffix` -error: suffixes on a byte string literal are invalid +error: suffixes on byte string literals are invalid --> $DIR/bad-lit-suffixes.rs:13:5 | LL | br#""#suffix; | ^^^^^^^^^^^^ invalid suffix `suffix` -error: suffixes on a char literal are invalid +error: suffixes on char literals are invalid --> $DIR/bad-lit-suffixes.rs:14:5 | LL | 'a'suffix; | ^^^^^^^^^ invalid suffix `suffix` -error: suffixes on a byte literal are invalid +error: suffixes on byte literals are invalid --> $DIR/bad-lit-suffixes.rs:15:5 | LL | b'a'suffix; diff --git a/src/test/ui/parser/bad-pointer-type.rs b/src/test/ui/parser/bad-pointer-type.rs index 59e5e0c5d..6a82acb4c 100644 --- a/src/test/ui/parser/bad-pointer-type.rs +++ b/src/test/ui/parser/bad-pointer-type.rs @@ -1,5 +1,5 @@ fn foo(_: *()) { - //~^ ERROR expected mut or const in raw pointer type + //~^ ERROR expected `mut` or `const` keyword in raw pointer type } fn main() {} diff --git a/src/test/ui/parser/bad-pointer-type.stderr b/src/test/ui/parser/bad-pointer-type.stderr index e18c220af..b7225ca88 100644 --- a/src/test/ui/parser/bad-pointer-type.stderr +++ b/src/test/ui/parser/bad-pointer-type.stderr @@ -1,10 +1,15 @@ -error: expected mut or const in raw pointer type +error: expected `mut` or `const` keyword in raw pointer type --> $DIR/bad-pointer-type.rs:1:11 | LL | fn foo(_: *()) { - | ^ expected mut or const in raw pointer type + | ^ | - = help: use `*mut T` or `*const T` as appropriate +help: add `mut` or `const` here + | +LL | fn foo(_: *const ()) { + | +++++ +LL | fn foo(_: *mut ()) { + | +++ error: aborting due to previous error diff --git a/src/test/ui/parser/default.stderr b/src/test/ui/parser/default.stderr index 5b763ae72..37aa48ccf 100644 --- a/src/test/ui/parser/default.stderr +++ b/src/test/ui/parser/default.stderr @@ -29,9 +29,9 @@ warning: the feature `specialization` is incomplete and may not be safe to use a LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default error[E0046]: not all trait items implemented, missing: `foo` --> $DIR/default.rs:22:1 diff --git a/src/test/ui/parser/doc-after-struct-field.rs b/src/test/ui/parser/doc-after-struct-field.rs index 5b6f08036..03faa6733 100644 --- a/src/test/ui/parser/doc-after-struct-field.rs +++ b/src/test/ui/parser/doc-after-struct-field.rs @@ -1,13 +1,13 @@ struct X { a: u8 /** document a */, //~^ ERROR found a documentation comment that doesn't document anything - //~| HELP maybe a comment was intended + //~| HELP if a comment was intended use `//` } struct Y { a: u8 /// document a //~^ ERROR found a documentation comment that doesn't document anything - //~| HELP maybe a comment was intended + //~| HELP if a comment was intended use `//` } fn main() { diff --git a/src/test/ui/parser/doc-after-struct-field.stderr b/src/test/ui/parser/doc-after-struct-field.stderr index e3b32a7f0..ae177f1a2 100644 --- a/src/test/ui/parser/doc-after-struct-field.stderr +++ b/src/test/ui/parser/doc-after-struct-field.stderr @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything LL | a: u8 /** document a */, | ^^^^^^^^^^^^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error[E0585]: found a documentation comment that doesn't document anything --> $DIR/doc-after-struct-field.rs:8:11 @@ -12,7 +12,7 @@ error[E0585]: found a documentation comment that doesn't document anything LL | a: u8 /// document a | ^^^^^^^^^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/doc-before-extern-rbrace.stderr b/src/test/ui/parser/doc-before-extern-rbrace.stderr index 0edceb268..8fa12ec26 100644 --- a/src/test/ui/parser/doc-before-extern-rbrace.stderr +++ b/src/test/ui/parser/doc-before-extern-rbrace.stderr @@ -4,7 +4,7 @@ error[E0584]: found a documentation comment that doesn't document anything LL | /// hi | ^^^^^^ this doc comment doesn't document anything | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-fn-rbrace.rs b/src/test/ui/parser/doc-before-fn-rbrace.rs index eb355136f..c85021648 100644 --- a/src/test/ui/parser/doc-before-fn-rbrace.rs +++ b/src/test/ui/parser/doc-before-fn-rbrace.rs @@ -1,5 +1,5 @@ fn main() { /// document //~^ ERROR found a documentation comment that doesn't document anything - //~| HELP maybe a comment was intended + //~| HELP if a comment was intended use `//` } diff --git a/src/test/ui/parser/doc-before-fn-rbrace.stderr b/src/test/ui/parser/doc-before-fn-rbrace.stderr index 56241de70..6ea68e42b 100644 --- a/src/test/ui/parser/doc-before-fn-rbrace.stderr +++ b/src/test/ui/parser/doc-before-fn-rbrace.stderr @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything LL | /// document | ^^^^^^^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-rbrace.rs b/src/test/ui/parser/doc-before-rbrace.rs index 8ff946344..570306f2c 100644 --- a/src/test/ui/parser/doc-before-rbrace.rs +++ b/src/test/ui/parser/doc-before-rbrace.rs @@ -1,5 +1,5 @@ fn main() { println!("Hi"); /// hi //~^ ERROR found a documentation comment that doesn't document anything - //~| HELP maybe a comment was intended + //~| HELP if a comment was intended use `//` } diff --git a/src/test/ui/parser/doc-before-rbrace.stderr b/src/test/ui/parser/doc-before-rbrace.stderr index 55719cf64..4d4741dfe 100644 --- a/src/test/ui/parser/doc-before-rbrace.stderr +++ b/src/test/ui/parser/doc-before-rbrace.stderr @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything LL | println!("Hi"); /// hi | ^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-semi.rs b/src/test/ui/parser/doc-before-semi.rs index 405a7e1e2..444b5874e 100644 --- a/src/test/ui/parser/doc-before-semi.rs +++ b/src/test/ui/parser/doc-before-semi.rs @@ -1,6 +1,6 @@ fn main() { /// hi //~^ ERROR found a documentation comment that doesn't document anything - //~| HELP maybe a comment was intended + //~| HELP if a comment was intended use `//` ; } diff --git a/src/test/ui/parser/doc-before-semi.stderr b/src/test/ui/parser/doc-before-semi.stderr index e6bade18d..a879e13ff 100644 --- a/src/test/ui/parser/doc-before-semi.stderr +++ b/src/test/ui/parser/doc-before-semi.stderr @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything LL | /// hi | ^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-struct-rbrace-1.rs b/src/test/ui/parser/doc-before-struct-rbrace-1.rs index 3866a3105..0c8d90c3b 100644 --- a/src/test/ui/parser/doc-before-struct-rbrace-1.rs +++ b/src/test/ui/parser/doc-before-struct-rbrace-1.rs @@ -2,7 +2,7 @@ struct X { a: u8, /// document //~^ ERROR found a documentation comment that doesn't document anything - //~| HELP maybe a comment was intended + //~| HELP if a comment was intended use `//` } fn main() { diff --git a/src/test/ui/parser/doc-before-struct-rbrace-1.stderr b/src/test/ui/parser/doc-before-struct-rbrace-1.stderr index 19f906773..94934f734 100644 --- a/src/test/ui/parser/doc-before-struct-rbrace-1.stderr +++ b/src/test/ui/parser/doc-before-struct-rbrace-1.stderr @@ -1,10 +1,13 @@ error[E0585]: found a documentation comment that doesn't document anything --> $DIR/doc-before-struct-rbrace-1.rs:3:5 | +LL | struct X { + | - while parsing this struct +LL | a: u8, LL | /// document | ^^^^^^^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-struct-rbrace-2.rs b/src/test/ui/parser/doc-before-struct-rbrace-2.rs index dda138f1a..2b2aadf79 100644 --- a/src/test/ui/parser/doc-before-struct-rbrace-2.rs +++ b/src/test/ui/parser/doc-before-struct-rbrace-2.rs @@ -1,7 +1,7 @@ struct X { a: u8 /// document //~^ ERROR found a documentation comment that doesn't document anything - //~| HELP maybe a comment was intended + //~| HELP if a comment was intended use `//` } fn main() { diff --git a/src/test/ui/parser/doc-before-struct-rbrace-2.stderr b/src/test/ui/parser/doc-before-struct-rbrace-2.stderr index b25ccab79..6b5c8c1f8 100644 --- a/src/test/ui/parser/doc-before-struct-rbrace-2.stderr +++ b/src/test/ui/parser/doc-before-struct-rbrace-2.stderr @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything LL | a: u8 /// document | ^^^^^^^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/doc-inside-trait-item.stderr b/src/test/ui/parser/doc-inside-trait-item.stderr index 246255a0a..900124adc 100644 --- a/src/test/ui/parser/doc-inside-trait-item.stderr +++ b/src/test/ui/parser/doc-inside-trait-item.stderr @@ -4,7 +4,7 @@ error[E0584]: found a documentation comment that doesn't document anything LL | /// empty doc | ^^^^^^^^^^^^^ this doc comment doesn't document anything | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/double-pointer.rs b/src/test/ui/parser/double-pointer.rs new file mode 100644 index 000000000..54d34db4a --- /dev/null +++ b/src/test/ui/parser/double-pointer.rs @@ -0,0 +1,7 @@ +fn main() { + let x: i32 = 5; + let ptr: *const i32 = &x; + let dptr: **const i32 = &ptr; + //~^ ERROR expected `mut` or `const` keyword in raw pointer type + //~| HELP add `mut` or `const` here +} diff --git a/src/test/ui/parser/double-pointer.stderr b/src/test/ui/parser/double-pointer.stderr new file mode 100644 index 000000000..28037f932 --- /dev/null +++ b/src/test/ui/parser/double-pointer.stderr @@ -0,0 +1,15 @@ +error: expected `mut` or `const` keyword in raw pointer type + --> $DIR/double-pointer.rs:4:15 + | +LL | let dptr: **const i32 = &ptr; + | ^ + | +help: add `mut` or `const` here + | +LL | let dptr: *const *const i32 = &ptr; + | +++++ +LL | let dptr: *mut *const i32 = &ptr; + | +++ + +error: aborting due to previous error + diff --git a/src/test/ui/parser/emoji-identifiers.stderr b/src/test/ui/parser/emoji-identifiers.stderr index 2550dc3d3..e645b68ba 100644 --- a/src/test/ui/parser/emoji-identifiers.stderr +++ b/src/test/ui/parser/emoji-identifiers.stderr @@ -9,15 +9,6 @@ help: Unicode character '➖' (Heavy Minus Sign) looks like '-' (Minus/Hyphen), LL | let _ = i_like_to_😄_a_lot() - 4; | ~ -error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope - --> $DIR/emoji-identifiers.rs:13:13 - | -LL | fn i_like_to_😅_a_lot() -> 👀 { - | ----------------------------- similarly named function `i_like_to_😅_a_lot` defined here -... -LL | let _ = i_like_to_😄_a_lot() ➖ 4; - | ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `i_like_to_😅_a_lot` - error: Ferris cannot be used as an identifier --> $DIR/emoji-identifiers.rs:17:9 | @@ -85,6 +76,15 @@ LL | 👀::full_of✨() | function or associated item not found in `👀` | help: there is an associated function with a similar name: `full_of_✨` +error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope + --> $DIR/emoji-identifiers.rs:13:13 + | +LL | fn i_like_to_😅_a_lot() -> 👀 { + | ----------------------------- similarly named function `i_like_to_😅_a_lot` defined here +... +LL | let _ = i_like_to_😄_a_lot() ➖ 4; + | ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `i_like_to_😅_a_lot` + error: aborting due to 10 previous errors Some errors have detailed explanations: E0425, E0599. diff --git a/src/test/ui/parser/empty-impl-semicolon.rs b/src/test/ui/parser/empty-impl-semicolon.rs index 207ebef64..2485f5b85 100644 --- a/src/test/ui/parser/empty-impl-semicolon.rs +++ b/src/test/ui/parser/empty-impl-semicolon.rs @@ -1 +1,4 @@ -impl Foo; //~ ERROR expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` +struct Foo; +impl Foo; //~ ERROR expected `{}`, found `;` + +fn main() {} diff --git a/src/test/ui/parser/empty-impl-semicolon.stderr b/src/test/ui/parser/empty-impl-semicolon.stderr index 398eb5c89..6ed309eba 100644 --- a/src/test/ui/parser/empty-impl-semicolon.stderr +++ b/src/test/ui/parser/empty-impl-semicolon.stderr @@ -1,8 +1,10 @@ -error: expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` - --> $DIR/empty-impl-semicolon.rs:1:9 +error: expected `{}`, found `;` + --> $DIR/empty-impl-semicolon.rs:2:9 | LL | impl Foo; - | ^ expected one of 8 possible tokens + | ^ + | + = help: try using `{}` instead error: aborting due to previous error diff --git a/src/test/ui/parser/expr-as-stmt-2.stderr b/src/test/ui/parser/expr-as-stmt-2.stderr index 9b939f05e..2b6314c38 100644 --- a/src/test/ui/parser/expr-as-stmt-2.stderr +++ b/src/test/ui/parser/expr-as-stmt-2.stderr @@ -36,11 +36,6 @@ LL | / && LL | | if let Some(y) = a { true } else { false } | |______________________________________________^ expected `bool`, found `&&bool` | -help: consider removing the `&&` - | -LL - && -LL + if let Some(y) = a { true } else { false } - | help: parentheses are required to parse this as an expression | LL | (if let Some(x) = a { true } else { false }) diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr index 858b4e8db..6da4ac340 100644 --- a/src/test/ui/parser/expr-as-stmt.stderr +++ b/src/test/ui/parser/expr-as-stmt.stderr @@ -170,11 +170,6 @@ LL | fn revenge_from_mars() -> bool { LL | { true } && { true } | ^^^^^^^^^^^ expected `bool`, found `&&bool` | -help: consider removing the `&&` - | -LL - { true } && { true } -LL + { true } { true } - | help: parentheses are required to parse this as an expression | LL | ({ true }) && { true } @@ -201,10 +196,6 @@ LL | { true } || { true } | = note: expected type `bool` found closure `[closure@$DIR/expr-as-stmt.rs:51:14: 51:16]` -help: use parentheses to call this closure - | -LL | { true } (|| { true })() - | + +++ help: parentheses are required to parse this as an expression | LL | ({ true }) || { true } diff --git a/src/test/ui/parser/fn-field-parse-error-ice.rs b/src/test/ui/parser/fn-field-parse-error-ice.rs index 4ea55062f..188257ea5 100644 --- a/src/test/ui/parser/fn-field-parse-error-ice.rs +++ b/src/test/ui/parser/fn-field-parse-error-ice.rs @@ -3,7 +3,7 @@ struct Baz { inner : dyn fn () //~^ ERROR expected `,`, or `}`, found keyword `fn` - //~| ERROR functions are not allowed in struct definitions + //~| ERROR expected identifier, found keyword `fn` //~| ERROR cannot find type `dyn` in this scope } diff --git a/src/test/ui/parser/fn-field-parse-error-ice.stderr b/src/test/ui/parser/fn-field-parse-error-ice.stderr index d582f61cc..3bf68e8cc 100644 --- a/src/test/ui/parser/fn-field-parse-error-ice.stderr +++ b/src/test/ui/parser/fn-field-parse-error-ice.stderr @@ -4,14 +4,18 @@ error: expected `,`, or `}`, found keyword `fn` LL | inner : dyn fn () | ^ help: try adding a comma: `,` -error: functions are not allowed in struct definitions +error: expected identifier, found keyword `fn` --> $DIR/fn-field-parse-error-ice.rs:4:17 | +LL | struct Baz { + | --- while parsing this struct LL | inner : dyn fn () - | ^^ + | ^^ expected identifier, found keyword | - = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks - = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information +help: escape `fn` to use it as an identifier + | +LL | inner : dyn r#fn () + | ++ error[E0412]: cannot find type `dyn` in this scope --> $DIR/fn-field-parse-error-ice.rs:4:13 diff --git a/src/test/ui/parser/fn-header-semantic-fail.stderr b/src/test/ui/parser/fn-header-semantic-fail.stderr index 36304779d..038fdfb2d 100644 --- a/src/test/ui/parser/fn-header-semantic-fail.stderr +++ b/src/test/ui/parser/fn-header-semantic-fail.stderr @@ -147,7 +147,7 @@ LL | async fn ft1(); = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information - = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` --> $DIR/fn-header-semantic-fail.rs:21:9 @@ -160,7 +160,7 @@ LL | const async unsafe extern "C" fn ft5(); = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information - = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` --> $DIR/fn-header-semantic-fail.rs:29:9 @@ -173,7 +173,7 @@ LL | async fn ft1() {} = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information - = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0706]: functions in traits cannot be declared `async` --> $DIR/fn-header-semantic-fail.rs:33:9 @@ -186,7 +186,7 @@ LL | const async unsafe extern "C" fn ft5() {} = note: `async` trait functions are not currently supported = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait = note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information - = help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable + = help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable error[E0391]: cycle detected when computing type of `main::ff5::{opaque#0}` --> $DIR/fn-header-semantic-fail.rs:12:44 @@ -199,7 +199,7 @@ note: ...which requires borrow-checking `main::ff5`... | LL | const async unsafe extern "C" fn ff5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing `main::ff5`... +note: ...which requires processing MIR for `main::ff5`... --> $DIR/fn-header-semantic-fail.rs:12:5 | LL | const async unsafe extern "C" fn ff5() {} @@ -235,7 +235,7 @@ note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic- | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`... +note: ...which requires processing MIR for `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5`... --> $DIR/fn-header-semantic-fail.rs:33:9 | LL | const async unsafe extern "C" fn ft5() {} @@ -271,7 +271,7 @@ note: ...which requires borrow-checking `main::<impl at $DIR/fn-header-semantic- | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires processing `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5`... +note: ...which requires processing MIR for `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5`... --> $DIR/fn-header-semantic-fail.rs:45:9 | LL | const async unsafe extern "C" fn fi5() {} diff --git a/src/test/ui/parser/inner-attr-after-doc-comment.stderr b/src/test/ui/parser/inner-attr-after-doc-comment.stderr index 2cfafac77..3ec3ad8e9 100644 --- a/src/test/ui/parser/inner-attr-after-doc-comment.stderr +++ b/src/test/ui/parser/inner-attr-after-doc-comment.stderr @@ -7,7 +7,7 @@ LL | | */ | |___- previous doc comment LL | LL | #![recursion_limit="100"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ not permitted following an outer attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^ not permitted following an outer doc comment LL | LL | fn main() {} | ------------ the inner attribute doesn't annotate this function diff --git a/src/test/ui/parser/issue-103143.rs b/src/test/ui/parser/issue-103143.rs new file mode 100644 index 000000000..a584274c4 --- /dev/null +++ b/src/test/ui/parser/issue-103143.rs @@ -0,0 +1,5 @@ +fn main() { + x::<#[a]y::<z>> + //~^ ERROR invalid const generic expression + //~| ERROR cannot find value `x` in this scope +} diff --git a/src/test/ui/parser/issue-103143.stderr b/src/test/ui/parser/issue-103143.stderr new file mode 100644 index 000000000..4035c69af --- /dev/null +++ b/src/test/ui/parser/issue-103143.stderr @@ -0,0 +1,20 @@ +error: invalid const generic expression + --> $DIR/issue-103143.rs:2:13 + | +LL | x::<#[a]y::<z>> + | ^^^^^^ + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | x::<#[a]{ y::<z> }> + | + + + +error[E0425]: cannot find value `x` in this scope + --> $DIR/issue-103143.rs:2:5 + | +LL | x::<#[a]y::<z>> + | ^ not found in this scope + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/parser/issue-103425.rs b/src/test/ui/parser/issue-103425.rs new file mode 100644 index 000000000..c2f8123ca --- /dev/null +++ b/src/test/ui/parser/issue-103425.rs @@ -0,0 +1,15 @@ +fn f() -> f32 { + 3 + //~^ ERROR expected `;` + 5.0 +} + +fn k() -> f32 { + 2_u32 + //~^ ERROR expected `;` + 3_i8 + //~^ ERROR expected `;` + 5.0 +} + +fn main() {} diff --git a/src/test/ui/parser/issue-103425.stderr b/src/test/ui/parser/issue-103425.stderr new file mode 100644 index 000000000..0efe3e3ca --- /dev/null +++ b/src/test/ui/parser/issue-103425.stderr @@ -0,0 +1,29 @@ +error: expected `;`, found `5.0` + --> $DIR/issue-103425.rs:2:6 + | +LL | 3 + | ^ help: add `;` here +LL | +LL | 5.0 + | --- unexpected token + +error: expected `;`, found `3_i8` + --> $DIR/issue-103425.rs:8:10 + | +LL | 2_u32 + | ^ help: add `;` here +LL | +LL | 3_i8 + | ---- unexpected token + +error: expected `;`, found `5.0` + --> $DIR/issue-103425.rs:10:9 + | +LL | 3_i8 + | ^ help: add `;` here +LL | +LL | 5.0 + | --- unexpected token + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/parser/issue-17718-parse-const.rs b/src/test/ui/parser/issue-17718-parse-const.rs new file mode 100644 index 000000000..d5a5f445d --- /dev/null +++ b/src/test/ui/parser/issue-17718-parse-const.rs @@ -0,0 +1,7 @@ +// run-pass + +const FOO: usize = 3; + +fn main() { + assert_eq!(FOO, 3); +} diff --git a/src/test/ui/parser/issues/issue-101540.rs b/src/test/ui/parser/issues/issue-101540.rs new file mode 100644 index 000000000..328ec6f90 --- /dev/null +++ b/src/test/ui/parser/issues/issue-101540.rs @@ -0,0 +1,7 @@ +struct S1 { + struct S2 { + //~^ ERROR structs are not allowed in struct definitions + } +} + +fn main() {} diff --git a/src/test/ui/parser/issues/issue-101540.stderr b/src/test/ui/parser/issues/issue-101540.stderr new file mode 100644 index 000000000..8af887050 --- /dev/null +++ b/src/test/ui/parser/issues/issue-101540.stderr @@ -0,0 +1,12 @@ +error: structs are not allowed in struct definitions + --> $DIR/issue-101540.rs:2:5 + | +LL | struct S1 { + | -- while parsing this struct +LL | struct S2 { + | ^^^^^^^^^ + | + = help: consider creating a new `struct` definition instead of nesting + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issues/issue-102182-impl-trait-recover.rs b/src/test/ui/parser/issues/issue-102182-impl-trait-recover.rs new file mode 100644 index 000000000..4bfc676d6 --- /dev/null +++ b/src/test/ui/parser/issues/issue-102182-impl-trait-recover.rs @@ -0,0 +1,3 @@ +fn foo<T: impl Trait>() {} +//~^ ERROR expected trait bound, found `impl Trait` type +fn main() {} diff --git a/src/test/ui/parser/issues/issue-102182-impl-trait-recover.stderr b/src/test/ui/parser/issues/issue-102182-impl-trait-recover.stderr new file mode 100644 index 000000000..52b6ae5df --- /dev/null +++ b/src/test/ui/parser/issues/issue-102182-impl-trait-recover.stderr @@ -0,0 +1,14 @@ +error: expected trait bound, found `impl Trait` type + --> $DIR/issue-102182-impl-trait-recover.rs:1:11 + | +LL | fn foo<T: impl Trait>() {} + | ^^^^^^^^^^ not a trait + | +help: use the trait bounds directly + | +LL - fn foo<T: impl Trait>() {} +LL + fn foo<T: Trait>() {} + | + +error: aborting due to previous error + diff --git a/src/test/ui/parser/issues/issue-17383.rs b/src/test/ui/parser/issues/issue-17383.rs deleted file mode 100644 index 7bf0e64f2..000000000 --- a/src/test/ui/parser/issues/issue-17383.rs +++ /dev/null @@ -1,7 +0,0 @@ -enum X { - A = 3, - //~^ ERROR custom discriminant values are not allowed in enums with tuple or struct variants - B(usize) -} - -fn main() {} diff --git a/src/test/ui/parser/issues/issue-17383.stderr b/src/test/ui/parser/issues/issue-17383.stderr deleted file mode 100644 index 265d6e148..000000000 --- a/src/test/ui/parser/issues/issue-17383.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants - --> $DIR/issue-17383.rs:2:9 - | -LL | A = 3, - | ^ disallowed custom discriminant -LL | -LL | B(usize) - | -------- tuple variant defined here - | - = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information - = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/parser/issues/issue-34222-1.stderr b/src/test/ui/parser/issues/issue-34222-1.stderr index 0799656b0..b451484ba 100644 --- a/src/test/ui/parser/issues/issue-34222-1.stderr +++ b/src/test/ui/parser/issues/issue-34222-1.stderr @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything LL | /// comment | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-48636.stderr b/src/test/ui/parser/issues/issue-48636.stderr index 462723d1d..6177870d1 100644 --- a/src/test/ui/parser/issues/issue-48636.stderr +++ b/src/test/ui/parser/issues/issue-48636.stderr @@ -1,12 +1,14 @@ error[E0585]: found a documentation comment that doesn't document anything --> $DIR/issue-48636.rs:7:5 | +LL | struct S { + | - while parsing this struct LL | x: u8 | - help: missing comma here: `,` LL | /// The ID of the parent core | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: doc comments must come before what they document, maybe a comment was intended with `//`? + = help: doc comments must come before what they document, if a comment was intended use `//` error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-63115-range-pat-interpolated.rs b/src/test/ui/parser/issues/issue-63115-range-pat-interpolated.rs index 8efb3c73f..b6e5091b6 100644 --- a/src/test/ui/parser/issues/issue-63115-range-pat-interpolated.rs +++ b/src/test/ui/parser/issues/issue-63115-range-pat-interpolated.rs @@ -1,7 +1,6 @@ // check-pass #![feature(exclusive_range_pattern)] -#![feature(half_open_range_patterns)] #![allow(ellipsis_inclusive_range_patterns)] diff --git a/src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr b/src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr index ef365a616..adabb6859 100644 --- a/src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr +++ b/src/test/ui/parser/issues/issue-68000-unicode-ident-after-missing-comma.stderr @@ -7,6 +7,8 @@ LL | pub bar: Vec<i32>ö error: expected `:`, found `}` --> $DIR/issue-68000-unicode-ident-after-missing-comma.rs:4:1 | +LL | pub struct Foo { + | --- while parsing this struct LL | pub bar: Vec<i32>ö | - expected `:` LL | diff --git a/src/test/ui/parser/issues/issue-8537.stderr b/src/test/ui/parser/issues/issue-8537.stderr index 505d830ef..523cc9dc5 100644 --- a/src/test/ui/parser/issues/issue-8537.stderr +++ b/src/test/ui/parser/issues/issue-8537.stderr @@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `invalid-ab_isize` LL | "invalid-ab_isize" | ^^^^^^^^^^^^^^^^^^ invalid ABI | - = help: valid ABIs: Rust, C, C-unwind, cdecl, cdecl-unwind, stdcall, stdcall-unwind, fastcall, fastcall-unwind, vectorcall, vectorcall-unwind, thiscall, thiscall-unwind, aapcs, aapcs-unwind, win64, win64-unwind, sysv64, sysv64-unwind, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, efiapi, avr-interrupt, avr-non-blocking-interrupt, C-cmse-nonsecure-call, wasm, system, system-unwind, rust-intrinsic, rust-call, platform-intrinsic, unadjusted, rust-cold + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. error: aborting due to previous error diff --git a/src/test/ui/parser/issues/issue-93282.rs b/src/test/ui/parser/issues/issue-93282.rs index 261fcb5f9..274245f1a 100644 --- a/src/test/ui/parser/issues/issue-93282.rs +++ b/src/test/ui/parser/issues/issue-93282.rs @@ -12,4 +12,5 @@ fn foo() { let x = 1; bar('y, x); //~^ ERROR expected + //~| ERROR mismatched types } diff --git a/src/test/ui/parser/issues/issue-93282.stderr b/src/test/ui/parser/issues/issue-93282.stderr index ee554784b..c6140bb82 100644 --- a/src/test/ui/parser/issues/issue-93282.stderr +++ b/src/test/ui/parser/issues/issue-93282.stderr @@ -3,6 +3,11 @@ error: expected `while`, `for`, `loop` or `{` after a label | LL | f<'a,> | ^ expected `while`, `for`, `loop` or `{` after a label + | +help: add `'` to close the char literal + | +LL | f<'a',> + | + error: expected one of `.`, `:`, `;`, `?`, `for`, `loop`, `while`, `}`, or an operator, found `,` --> $DIR/issue-93282.rs:2:9 @@ -20,6 +25,26 @@ error: expected `while`, `for`, `loop` or `{` after a label | LL | bar('y, x); | ^ expected `while`, `for`, `loop` or `{` after a label + | +help: add `'` to close the char literal + | +LL | bar('y', x); + | + + +error[E0308]: mismatched types + --> $DIR/issue-93282.rs:13:9 + | +LL | bar('y, x); + | --- ^^ expected `usize`, found `char` + | | + | arguments to this function are incorrect + | +note: function defined here + --> $DIR/issue-93282.rs:7:4 + | +LL | fn bar(a: usize, b: usize) -> usize { + | ^^^ -------- -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/item-needs-block.rs b/src/test/ui/parser/item-needs-block.rs new file mode 100644 index 000000000..4edac588e --- /dev/null +++ b/src/test/ui/parser/item-needs-block.rs @@ -0,0 +1,10 @@ +trait Trait; +//~^ ERROR expected `{}`, found `;` + +impl Trait for (); +//~^ ERROR expected `{}`, found `;` + +enum Enum; +//~^ ERROR expected `{}`, found `;` + +fn main() {} diff --git a/src/test/ui/parser/item-needs-block.stderr b/src/test/ui/parser/item-needs-block.stderr new file mode 100644 index 000000000..3cabd0c73 --- /dev/null +++ b/src/test/ui/parser/item-needs-block.stderr @@ -0,0 +1,26 @@ +error: expected `{}`, found `;` + --> $DIR/item-needs-block.rs:1:12 + | +LL | trait Trait; + | ^ + | + = help: try using `{}` instead + +error: expected `{}`, found `;` + --> $DIR/item-needs-block.rs:4:18 + | +LL | impl Trait for (); + | ^ + | + = help: try using `{}` instead + +error: expected `{}`, found `;` + --> $DIR/item-needs-block.rs:7:10 + | +LL | enum Enum; + | ^ + | + = help: try using `{}` instead + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/parser/label-after-block-like.rs b/src/test/ui/parser/label-after-block-like.rs new file mode 100644 index 000000000..55f3f8f9f --- /dev/null +++ b/src/test/ui/parser/label-after-block-like.rs @@ -0,0 +1,43 @@ +fn a() { + if let () = () 'a {} + //~^ ERROR labeled expression must be followed by `:` + //~| ERROR expected `{`, found `'a` +} + +fn b() { + if true 'a {} + //~^ ERROR labeled expression must be followed by `:` + //~| ERROR expected `{`, found `'a` +} + +fn c() { + loop 'a {} + //~^ ERROR labeled expression must be followed by `:` + //~| ERROR expected `{`, found `'a` +} + +fn d() { + while true 'a {} + //~^ ERROR labeled expression must be followed by `:` + //~| ERROR expected `{`, found `'a` +} + +fn e() { + while let () = () 'a {} + //~^ ERROR labeled expression must be followed by `:` + //~| ERROR expected `{`, found `'a` +} + +fn f() { + for _ in 0..0 'a {} + //~^ ERROR labeled expression must be followed by `:` + //~| ERROR expected `{`, found `'a` +} + +fn g() { + unsafe 'a {} + //~^ ERROR labeled expression must be followed by `:` + //~| ERROR expected `{`, found `'a` +} + +fn main() {} diff --git a/src/test/ui/parser/label-after-block-like.stderr b/src/test/ui/parser/label-after-block-like.stderr new file mode 100644 index 000000000..8ff50b124 --- /dev/null +++ b/src/test/ui/parser/label-after-block-like.stderr @@ -0,0 +1,176 @@ +error: labeled expression must be followed by `:` + --> $DIR/label-after-block-like.rs:2:20 + | +LL | if let () = () 'a {} + | ---^^ + | | | + | | help: add `:` after the label + | the label + | + = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them + +error: expected `{`, found `'a` + --> $DIR/label-after-block-like.rs:2:20 + | +LL | if let () = () 'a {} + | ^^ expected `{` + | +note: the `if` expression is missing a block after this condition + --> $DIR/label-after-block-like.rs:2:8 + | +LL | if let () = () 'a {} + | ^^^^^^^^^^^ +help: try placing this code inside a block + | +LL | if let () = () { 'a {} } + | + + + +error: labeled expression must be followed by `:` + --> $DIR/label-after-block-like.rs:8:13 + | +LL | if true 'a {} + | ---^^ + | | | + | | help: add `:` after the label + | the label + | + = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them + +error: expected `{`, found `'a` + --> $DIR/label-after-block-like.rs:8:13 + | +LL | if true 'a {} + | ^^ expected `{` + | +note: the `if` expression is missing a block after this condition + --> $DIR/label-after-block-like.rs:8:8 + | +LL | if true 'a {} + | ^^^^ +help: try placing this code inside a block + | +LL | if true { 'a {} } + | + + + +error: labeled expression must be followed by `:` + --> $DIR/label-after-block-like.rs:14:10 + | +LL | loop 'a {} + | ---^^ + | | | + | | help: add `:` after the label + | the label + | + = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them + +error: expected `{`, found `'a` + --> $DIR/label-after-block-like.rs:14:10 + | +LL | loop 'a {} + | ---- ^^ expected `{` + | | + | while parsing this `loop` expression + | +help: try placing this code inside a block + | +LL | loop { 'a {} } + | + + + +error: labeled expression must be followed by `:` + --> $DIR/label-after-block-like.rs:20:16 + | +LL | while true 'a {} + | ---^^ + | | | + | | help: add `:` after the label + | the label + | + = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them + +error: expected `{`, found `'a` + --> $DIR/label-after-block-like.rs:20:16 + | +LL | while true 'a {} + | ----- ---- ^^ expected `{` + | | | + | | this `while` condition successfully parsed + | while parsing the body of this `while` expression + | +help: try placing this code inside a block + | +LL | while true { 'a {} } + | + + + +error: labeled expression must be followed by `:` + --> $DIR/label-after-block-like.rs:26:23 + | +LL | while let () = () 'a {} + | ---^^ + | | | + | | help: add `:` after the label + | the label + | + = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them + +error: expected `{`, found `'a` + --> $DIR/label-after-block-like.rs:26:23 + | +LL | while let () = () 'a {} + | ----- ----------- ^^ expected `{` + | | | + | | this `while` condition successfully parsed + | while parsing the body of this `while` expression + | +help: try placing this code inside a block + | +LL | while let () = () { 'a {} } + | + + + +error: labeled expression must be followed by `:` + --> $DIR/label-after-block-like.rs:32:19 + | +LL | for _ in 0..0 'a {} + | ---^^ + | | | + | | help: add `:` after the label + | the label + | + = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them + +error: expected `{`, found `'a` + --> $DIR/label-after-block-like.rs:32:19 + | +LL | for _ in 0..0 'a {} + | ^^ expected `{` + | +help: try placing this code inside a block + | +LL | for _ in 0..0 { 'a {} } + | + + + +error: labeled expression must be followed by `:` + --> $DIR/label-after-block-like.rs:38:12 + | +LL | unsafe 'a {} + | ---^^ + | | | + | | help: add `:` after the label + | the label + | + = note: labels are used before loops and blocks, allowing e.g., `break 'label` to them + +error: expected `{`, found `'a` + --> $DIR/label-after-block-like.rs:38:12 + | +LL | unsafe 'a {} + | ------ ^^ expected `{` + | | + | while parsing this `unsafe` expression + | +help: try placing this code inside a block + | +LL | unsafe { 'a {} } + | + + + +error: aborting due to 14 previous errors + diff --git a/src/test/ui/parser/label-is-actually-char.rs b/src/test/ui/parser/label-is-actually-char.rs new file mode 100644 index 000000000..183da603d --- /dev/null +++ b/src/test/ui/parser/label-is-actually-char.rs @@ -0,0 +1,16 @@ +fn main() { + let c = 'a; + //~^ ERROR expected `while`, `for`, `loop` or `{` after a label + //~| HELP add `'` to close the char literal + match c { + 'a'..='b => {} + //~^ ERROR unexpected token: `'b` + //~| HELP add `'` to close the char literal + _ => {} + } + let x = ['a, 'b]; + //~^ ERROR expected `while`, `for`, `loop` or `{` after a label + //~| ERROR expected `while`, `for`, `loop` or `{` after a label + //~| HELP add `'` to close the char literal + //~| HELP add `'` to close the char literal +} diff --git a/src/test/ui/parser/label-is-actually-char.stderr b/src/test/ui/parser/label-is-actually-char.stderr new file mode 100644 index 000000000..28c8d2ada --- /dev/null +++ b/src/test/ui/parser/label-is-actually-char.stderr @@ -0,0 +1,46 @@ +error: expected `while`, `for`, `loop` or `{` after a label + --> $DIR/label-is-actually-char.rs:2:15 + | +LL | let c = 'a; + | ^ expected `while`, `for`, `loop` or `{` after a label + | +help: add `'` to close the char literal + | +LL | let c = 'a'; + | + + +error: unexpected token: `'b` + --> $DIR/label-is-actually-char.rs:6:15 + | +LL | 'a'..='b => {} + | ^^ + | +help: add `'` to close the char literal + | +LL | 'a'..='b' => {} + | + + +error: expected `while`, `for`, `loop` or `{` after a label + --> $DIR/label-is-actually-char.rs:11:16 + | +LL | let x = ['a, 'b]; + | ^ expected `while`, `for`, `loop` or `{` after a label + | +help: add `'` to close the char literal + | +LL | let x = ['a', 'b]; + | + + +error: expected `while`, `for`, `loop` or `{` after a label + --> $DIR/label-is-actually-char.rs:11:20 + | +LL | let x = ['a, 'b]; + | ^ expected `while`, `for`, `loop` or `{` after a label + | +help: add `'` to close the char literal + | +LL | let x = ['a, 'b']; + | + + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/parser/macro/issue-33569.stderr b/src/test/ui/parser/macro/issue-33569.stderr index 39d49fd03..0dca090fb 100644 --- a/src/test/ui/parser/macro/issue-33569.stderr +++ b/src/test/ui/parser/macro/issue-33569.stderr @@ -22,9 +22,9 @@ error: missing fragment specifier LL | { $+ } => { | ^ | - = note: `#[deny(missing_fragment_specifier)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107> + = note: `#[deny(missing_fragment_specifier)]` on by default error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/macro/issue-37113.stderr b/src/test/ui/parser/macro/issue-37113.stderr index 0912858dd..b1f8674fb 100644 --- a/src/test/ui/parser/macro/issue-37113.stderr +++ b/src/test/ui/parser/macro/issue-37113.stderr @@ -1,6 +1,8 @@ error: expected identifier, found `String` --> $DIR/issue-37113.rs:4:16 | +LL | enum SomeEnum { + | -------- while parsing this enum LL | $( $t, )* | ^^ expected identifier ... diff --git a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr index a47d5506e..ad1e90e43 100644 --- a/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr +++ b/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr @@ -10,6 +10,9 @@ LL | fn main() {} error: expected identifier, found keyword `trait` --> $DIR/missing-close-brace-in-struct.rs:4:1 | +LL | pub(crate) struct Bar<T> { + | --- while parsing this struct +... LL | trait T { | ^^^^^ expected identifier, found keyword diff --git a/src/test/ui/parser/missing-closing-angle-bracket-struct-field-ty.stderr b/src/test/ui/parser/missing-closing-angle-bracket-struct-field-ty.stderr index 46ca1f06b..6d8b0c3fc 100644 --- a/src/test/ui/parser/missing-closing-angle-bracket-struct-field-ty.stderr +++ b/src/test/ui/parser/missing-closing-angle-bracket-struct-field-ty.stderr @@ -1,6 +1,9 @@ error: expected one of `>`, a const expression, lifetime, or type, found `}` --> $DIR/missing-closing-angle-bracket-struct-field-ty.rs:9:1 | +LL | pub struct Foo { + | --- while parsing this struct +... LL | c: Arc<Mutex<usize>>, | - expected one of `>`, a const expression, lifetime, or type LL | } diff --git a/src/test/ui/parser/numeric-lifetime.stderr b/src/test/ui/parser/numeric-lifetime.stderr index 73a828952..7c1bcb726 100644 --- a/src/test/ui/parser/numeric-lifetime.stderr +++ b/src/test/ui/parser/numeric-lifetime.stderr @@ -1,3 +1,11 @@ +error[E0308]: mismatched types + --> $DIR/numeric-lifetime.rs:6:20 + | +LL | let x: usize = ""; + | ----- ^^ expected `usize`, found `&str` + | | + | expected due to this + error: lifetimes cannot start with a number --> $DIR/numeric-lifetime.rs:1:10 | @@ -10,14 +18,6 @@ error: lifetimes cannot start with a number LL | struct S<'1> { s: &'1 usize } | ^^ -error[E0308]: mismatched types - --> $DIR/numeric-lifetime.rs:6:20 - | -LL | let x: usize = ""; - | ----- ^^ expected `usize`, found `&str` - | | - | expected due to this - error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/parser-recovery-1.stderr b/src/test/ui/parser/parser-recovery-1.stderr index f56060c3e..0cb771ea3 100644 --- a/src/test/ui/parser/parser-recovery-1.stderr +++ b/src/test/ui/parser/parser-recovery-1.stderr @@ -18,18 +18,18 @@ error: unexpected token: `;` LL | let x = y.; | ^ -error[E0425]: cannot find function `foo` in this scope - --> $DIR/parser-recovery-1.rs:5:17 - | -LL | let x = foo(); - | ^^^ not found in this scope - error[E0425]: cannot find value `y` in this scope --> $DIR/parser-recovery-1.rs:10:13 | LL | let x = y.; | ^ not found in this scope +error[E0425]: cannot find function `foo` in this scope + --> $DIR/parser-recovery-1.rs:5:17 + | +LL | let x = foo(); + | ^^^ not found in this scope + error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/parser/parser-recovery-2.stderr b/src/test/ui/parser/parser-recovery-2.stderr index 0980d033f..8829cf4c1 100644 --- a/src/test/ui/parser/parser-recovery-2.stderr +++ b/src/test/ui/parser/parser-recovery-2.stderr @@ -13,18 +13,18 @@ LL | let x = foo(); LL | ) | ^ mismatched closing delimiter -error[E0425]: cannot find function `foo` in this scope - --> $DIR/parser-recovery-2.rs:5:17 - | -LL | let x = foo(); - | ^^^ not found in this scope - error[E0425]: cannot find value `y` in this scope --> $DIR/parser-recovery-2.rs:10:13 | LL | let x = y.; | ^ not found in this scope +error[E0425]: cannot find function `foo` in this scope + --> $DIR/parser-recovery-2.rs:5:17 + | +LL | let x = foo(); + | ^^^ not found in this scope + error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/parser/recover-enum2.stderr b/src/test/ui/parser/recover-enum2.stderr index ee29f0663..7634bca92 100644 --- a/src/test/ui/parser/recover-enum2.stderr +++ b/src/test/ui/parser/recover-enum2.stderr @@ -1,6 +1,8 @@ error: expected type, found `{` --> $DIR/recover-enum2.rs:6:18 | +LL | Var3 { + | ---- while parsing this struct LL | abc: {}, | ^ expected type diff --git a/src/test/ui/parser/recover-field-semi.stderr b/src/test/ui/parser/recover-field-semi.stderr index 657366db9..3cf484748 100644 --- a/src/test/ui/parser/recover-field-semi.stderr +++ b/src/test/ui/parser/recover-field-semi.stderr @@ -1,12 +1,16 @@ error: struct fields are separated by `,` --> $DIR/recover-field-semi.rs:2:13 | +LL | struct Foo { + | --- while parsing this struct LL | foo: i32; | ^ help: replace `;` with `,` error: union fields are separated by `,` --> $DIR/recover-field-semi.rs:7:13 | +LL | union Bar { + | --- while parsing this union LL | foo: i32; | ^ help: replace `;` with `,` @@ -14,7 +18,9 @@ error: struct fields are separated by `,` --> $DIR/recover-field-semi.rs:12:19 | LL | Qux { foo: i32; } - | ^ help: replace `;` with `,` + | --- ^ help: replace `;` with `,` + | | + | while parsing this struct error: unions cannot have zero fields --> $DIR/recover-field-semi.rs:6:1 diff --git a/src/test/ui/parser/recover-range-pats.rs b/src/test/ui/parser/recover-range-pats.rs index 2e5a99154..156c7ad94 100644 --- a/src/test/ui/parser/recover-range-pats.rs +++ b/src/test/ui/parser/recover-range-pats.rs @@ -4,7 +4,6 @@ // 2. Or at least we have parser recovery if they don't. #![feature(exclusive_range_pattern)] -#![feature(half_open_range_patterns)] #![deny(ellipsis_inclusive_range_patterns)] fn main() {} diff --git a/src/test/ui/parser/recover-range-pats.stderr b/src/test/ui/parser/recover-range-pats.stderr index d0979b23f..c54f13e01 100644 --- a/src/test/ui/parser/recover-range-pats.stderr +++ b/src/test/ui/parser/recover-range-pats.stderr @@ -1,47 +1,47 @@ error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:22:12 + --> $DIR/recover-range-pats.rs:21:12 | LL | if let .0..Y = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:24:16 + --> $DIR/recover-range-pats.rs:23:16 | LL | if let X.. .0 = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:35:12 + --> $DIR/recover-range-pats.rs:34:12 | LL | if let .0..=Y = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:37:16 + --> $DIR/recover-range-pats.rs:36:16 | LL | if let X..=.0 = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:60:12 + --> $DIR/recover-range-pats.rs:59:12 | LL | if let .0...Y = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:64:17 + --> $DIR/recover-range-pats.rs:63:17 | LL | if let X... .0 = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:75:12 + --> $DIR/recover-range-pats.rs:74:12 | LL | if let .0.. = 0 {} | ^^ help: must have an integer part: `0.0` error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:81:13 + --> $DIR/recover-range-pats.rs:80:13 | LL | if let 0..= = 0 {} | ^^^ help: use `..` instead @@ -49,7 +49,7 @@ LL | if let 0..= = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:82:13 + --> $DIR/recover-range-pats.rs:81:13 | LL | if let X..= = 0 {} | ^^^ help: use `..` instead @@ -57,7 +57,7 @@ LL | if let X..= = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:83:16 + --> $DIR/recover-range-pats.rs:82:16 | LL | if let true..= = 0 {} | ^^^ help: use `..` instead @@ -65,13 +65,13 @@ LL | if let true..= = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:85:12 + --> $DIR/recover-range-pats.rs:84:12 | LL | if let .0..= = 0 {} | ^^ help: must have an integer part: `0.0` error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:85:14 + --> $DIR/recover-range-pats.rs:84:14 | LL | if let .0..= = 0 {} | ^^^ help: use `..` instead @@ -79,7 +79,7 @@ LL | if let .0..= = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:91:13 + --> $DIR/recover-range-pats.rs:90:13 | LL | if let 0... = 0 {} | ^^^ help: use `..` instead @@ -87,7 +87,7 @@ LL | if let 0... = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:92:13 + --> $DIR/recover-range-pats.rs:91:13 | LL | if let X... = 0 {} | ^^^ help: use `..` instead @@ -95,7 +95,7 @@ LL | if let X... = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:93:16 + --> $DIR/recover-range-pats.rs:92:16 | LL | if let true... = 0 {} | ^^^ help: use `..` instead @@ -103,13 +103,13 @@ LL | if let true... = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:95:12 + --> $DIR/recover-range-pats.rs:94:12 | LL | if let .0... = 0 {} | ^^ help: must have an integer part: `0.0` error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:95:14 + --> $DIR/recover-range-pats.rs:94:14 | LL | if let .0... = 0 {} | ^^^ help: use `..` instead @@ -117,49 +117,49 @@ LL | if let .0... = 0 {} = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:105:15 + --> $DIR/recover-range-pats.rs:104:15 | LL | if let .. .0 = 0 {} | ^^ help: must have an integer part: `0.0` error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:115:15 + --> $DIR/recover-range-pats.rs:114:15 | LL | if let ..=.0 = 0 {} | ^^ help: must have an integer part: `0.0` error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:121:12 + --> $DIR/recover-range-pats.rs:120:12 | LL | if let ...3 = 0 {} | ^^^ help: use `..=` instead error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:123:12 + --> $DIR/recover-range-pats.rs:122:12 | LL | if let ...Y = 0 {} | ^^^ help: use `..=` instead error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:125:12 + --> $DIR/recover-range-pats.rs:124:12 | LL | if let ...true = 0 {} | ^^^ help: use `..=` instead error: float literals must have an integer part - --> $DIR/recover-range-pats.rs:128:15 + --> $DIR/recover-range-pats.rs:127:15 | LL | if let ....3 = 0 {} | ^^ help: must have an integer part: `0.3` error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:128:12 + --> $DIR/recover-range-pats.rs:127:12 | LL | if let ....3 = 0 {} | ^^^ help: use `..=` instead error: range-to patterns with `...` are not allowed - --> $DIR/recover-range-pats.rs:150:17 + --> $DIR/recover-range-pats.rs:149:17 | LL | let ...$e; | ^^^ help: use `..=` instead @@ -170,7 +170,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:154:19 + --> $DIR/recover-range-pats.rs:153:19 | LL | let $e...; | ^^^ help: use `..` instead @@ -182,7 +182,7 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0586]: inclusive range with no end - --> $DIR/recover-range-pats.rs:155:19 + --> $DIR/recover-range-pats.rs:154:19 | LL | let $e..=; | ^^^ help: use `..` instead @@ -194,21 +194,21 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:42:13 + --> $DIR/recover-range-pats.rs:41:13 | LL | if let 0...3 = 0 {} | ^^^ help: use `..=` for an inclusive range | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> note: the lint level is defined here - --> $DIR/recover-range-pats.rs:8:9 + --> $DIR/recover-range-pats.rs:7:9 | LL | #![deny(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:45:13 + --> $DIR/recover-range-pats.rs:44:13 | LL | if let 0...Y = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -217,7 +217,7 @@ LL | if let 0...Y = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:48:13 + --> $DIR/recover-range-pats.rs:47:13 | LL | if let X...3 = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -226,7 +226,7 @@ LL | if let X...3 = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:51:13 + --> $DIR/recover-range-pats.rs:50:13 | LL | if let X...Y = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -235,7 +235,7 @@ LL | if let X...Y = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:54:16 + --> $DIR/recover-range-pats.rs:53:16 | LL | if let true...Y = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -244,7 +244,7 @@ LL | if let true...Y = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:57:13 + --> $DIR/recover-range-pats.rs:56:13 | LL | if let X...true = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -253,7 +253,7 @@ LL | if let X...true = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:60:14 + --> $DIR/recover-range-pats.rs:59:14 | LL | if let .0...Y = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -262,7 +262,7 @@ LL | if let .0...Y = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:64:13 + --> $DIR/recover-range-pats.rs:63:13 | LL | if let X... .0 = 0 {} | ^^^ help: use `..=` for an inclusive range @@ -271,7 +271,7 @@ LL | if let X... .0 = 0 {} = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: `...` range patterns are deprecated - --> $DIR/recover-range-pats.rs:138:20 + --> $DIR/recover-range-pats.rs:137:20 | LL | let $e1...$e2; | ^^^ help: use `..=` for an inclusive range @@ -284,7 +284,7 @@ LL | mac2!(0, 1); = note: this error originates in the macro `mac2` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:20:12 + --> $DIR/recover-range-pats.rs:19:12 | LL | if let true..Y = 0 {} | ^^^^ - this is of type `u8` @@ -292,7 +292,7 @@ LL | if let true..Y = 0 {} | this is of type `bool` but it should be `char` or numeric error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:21:15 + --> $DIR/recover-range-pats.rs:20:15 | LL | if let X..true = 0 {} | - ^^^^ this is of type `bool` but it should be `char` or numeric @@ -300,7 +300,7 @@ LL | if let X..true = 0 {} | this is of type `u8` error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:22:12 + --> $DIR/recover-range-pats.rs:21:12 | LL | if let .0..Y = 0 {} | ^^ - - this expression has type `{integer}` @@ -309,7 +309,7 @@ LL | if let .0..Y = 0 {} | expected integer, found floating-point number error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:24:16 + --> $DIR/recover-range-pats.rs:23:16 | LL | if let X.. .0 = 0 {} | - ^^ - this expression has type `u8` @@ -321,7 +321,7 @@ LL | if let X.. .0 = 0 {} found type `{float}` error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:33:12 + --> $DIR/recover-range-pats.rs:32:12 | LL | if let true..=Y = 0 {} | ^^^^ - this is of type `u8` @@ -329,7 +329,7 @@ LL | if let true..=Y = 0 {} | this is of type `bool` but it should be `char` or numeric error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:34:16 + --> $DIR/recover-range-pats.rs:33:16 | LL | if let X..=true = 0 {} | - ^^^^ this is of type `bool` but it should be `char` or numeric @@ -337,7 +337,7 @@ LL | if let X..=true = 0 {} | this is of type `u8` error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:35:12 + --> $DIR/recover-range-pats.rs:34:12 | LL | if let .0..=Y = 0 {} | ^^ - - this expression has type `{integer}` @@ -346,7 +346,7 @@ LL | if let .0..=Y = 0 {} | expected integer, found floating-point number error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:37:16 + --> $DIR/recover-range-pats.rs:36:16 | LL | if let X..=.0 = 0 {} | - ^^ - this expression has type `u8` @@ -358,7 +358,7 @@ LL | if let X..=.0 = 0 {} found type `{float}` error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:54:12 + --> $DIR/recover-range-pats.rs:53:12 | LL | if let true...Y = 0 {} | ^^^^ - this is of type `u8` @@ -366,7 +366,7 @@ LL | if let true...Y = 0 {} | this is of type `bool` but it should be `char` or numeric error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:57:16 + --> $DIR/recover-range-pats.rs:56:16 | LL | if let X...true = 0 {} | - ^^^^ this is of type `bool` but it should be `char` or numeric @@ -374,7 +374,7 @@ LL | if let X...true = 0 {} | this is of type `u8` error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:60:12 + --> $DIR/recover-range-pats.rs:59:12 | LL | if let .0...Y = 0 {} | ^^ - - this expression has type `{integer}` @@ -383,7 +383,7 @@ LL | if let .0...Y = 0 {} | expected integer, found floating-point number error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:64:17 + --> $DIR/recover-range-pats.rs:63:17 | LL | if let X... .0 = 0 {} | - ^^ - this expression has type `u8` @@ -395,13 +395,13 @@ LL | if let X... .0 = 0 {} found type `{float}` error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:73:12 + --> $DIR/recover-range-pats.rs:72:12 | LL | if let true.. = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:75:12 + --> $DIR/recover-range-pats.rs:74:12 | LL | if let .0.. = 0 {} | ^^ - this expression has type `{integer}` @@ -409,13 +409,13 @@ LL | if let .0.. = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:83:12 + --> $DIR/recover-range-pats.rs:82:12 | LL | if let true..= = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:85:12 + --> $DIR/recover-range-pats.rs:84:12 | LL | if let .0..= = 0 {} | ^^ - this expression has type `{integer}` @@ -423,13 +423,13 @@ LL | if let .0..= = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:93:12 + --> $DIR/recover-range-pats.rs:92:12 | LL | if let true... = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:95:12 + --> $DIR/recover-range-pats.rs:94:12 | LL | if let .0... = 0 {} | ^^ - this expression has type `{integer}` @@ -437,13 +437,13 @@ LL | if let .0... = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:103:14 + --> $DIR/recover-range-pats.rs:102:14 | LL | if let ..true = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:105:15 + --> $DIR/recover-range-pats.rs:104:15 | LL | if let .. .0 = 0 {} | ^^ - this expression has type `{integer}` @@ -451,13 +451,13 @@ LL | if let .. .0 = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:113:15 + --> $DIR/recover-range-pats.rs:112:15 | LL | if let ..=true = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:115:15 + --> $DIR/recover-range-pats.rs:114:15 | LL | if let ..=.0 = 0 {} | ^^ - this expression has type `{integer}` @@ -465,13 +465,13 @@ LL | if let ..=.0 = 0 {} | expected integer, found floating-point number error[E0029]: only `char` and numeric types are allowed in range patterns - --> $DIR/recover-range-pats.rs:125:15 + --> $DIR/recover-range-pats.rs:124:15 | LL | if let ...true = 0 {} | ^^^^ this is of type `bool` but it should be `char` or numeric error[E0308]: mismatched types - --> $DIR/recover-range-pats.rs:128:15 + --> $DIR/recover-range-pats.rs:127:15 | LL | if let ....3 = 0 {} | ^^ - this expression has type `{integer}` diff --git a/src/test/ui/parser/recover-struct.stderr b/src/test/ui/parser/recover-struct.stderr index 1b72184b0..9f6fb06ca 100644 --- a/src/test/ui/parser/recover-struct.stderr +++ b/src/test/ui/parser/recover-struct.stderr @@ -1,6 +1,8 @@ error: expected `:`, found `Bad` --> $DIR/recover-struct.rs:4:9 | +LL | struct Test { + | ---- while parsing this struct LL | Very | - expected `:` LL | Bad diff --git a/src/test/ui/parser/recovered-struct-variant.stderr b/src/test/ui/parser/recovered-struct-variant.stderr index 51aaf8bb3..78c67866f 100644 --- a/src/test/ui/parser/recovered-struct-variant.stderr +++ b/src/test/ui/parser/recovered-struct-variant.stderr @@ -2,7 +2,9 @@ error: expected `:`, found `,` --> $DIR/recovered-struct-variant.rs:2:10 | LL | A { a, b: usize } - | ^ expected `:` + | - ^ expected `:` + | | + | while parsing this struct error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-enum-newtype.stderr b/src/test/ui/parser/removed-syntax-enum-newtype.stderr index 2daa6249b..8f7ca3567 100644 --- a/src/test/ui/parser/removed-syntax-enum-newtype.stderr +++ b/src/test/ui/parser/removed-syntax-enum-newtype.stderr @@ -2,7 +2,9 @@ error: expected one of `<`, `where`, or `{`, found `=` --> $DIR/removed-syntax-enum-newtype.rs:1:8 | LL | enum e = isize; - | ^ expected one of `<`, `where`, or `{` + | - ^ expected one of `<`, `where`, or `{` + | | + | while parsing this enum error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-field-let-2.rs b/src/test/ui/parser/removed-syntax-field-let-2.rs new file mode 100644 index 000000000..7ff91b476 --- /dev/null +++ b/src/test/ui/parser/removed-syntax-field-let-2.rs @@ -0,0 +1,12 @@ +struct Foo { + let x: i32, + //~^ ERROR expected identifier, found keyword + let y: i32, + //~^ ERROR expected identifier, found keyword +} + +fn main() { + let _ = Foo { + //~^ ERROR missing fields `x` and `y` in initializer of `Foo` + }; +} diff --git a/src/test/ui/parser/removed-syntax-field-let-2.stderr b/src/test/ui/parser/removed-syntax-field-let-2.stderr new file mode 100644 index 000000000..fda0919b9 --- /dev/null +++ b/src/test/ui/parser/removed-syntax-field-let-2.stderr @@ -0,0 +1,33 @@ +error: expected identifier, found keyword `let` + --> $DIR/removed-syntax-field-let-2.rs:2:5 + | +LL | let x: i32, + | ^^^- + | | + | expected identifier, found keyword + | help: remove this `let` keyword + | + = note: the `let` keyword is not allowed in `struct` fields + = note: see <https://doc.rust-lang.org/book/ch05-01-defining-structs.html> for more information + +error: expected identifier, found keyword `let` + --> $DIR/removed-syntax-field-let-2.rs:4:5 + | +LL | let y: i32, + | ^^^- + | | + | expected identifier, found keyword + | help: remove this `let` keyword + | + = note: the `let` keyword is not allowed in `struct` fields + = note: see <https://doc.rust-lang.org/book/ch05-01-defining-structs.html> for more information + +error[E0063]: missing fields `x` and `y` in initializer of `Foo` + --> $DIR/removed-syntax-field-let-2.rs:9:13 + | +LL | let _ = Foo { + | ^^^ missing `x` and `y` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0063`. diff --git a/src/test/ui/parser/removed-syntax-field-let.stderr b/src/test/ui/parser/removed-syntax-field-let.stderr index 10be2e045..9bc18dabd 100644 --- a/src/test/ui/parser/removed-syntax-field-let.stderr +++ b/src/test/ui/parser/removed-syntax-field-let.stderr @@ -2,7 +2,13 @@ error: expected identifier, found keyword `let` --> $DIR/removed-syntax-field-let.rs:2:5 | LL | let foo: (), - | ^^^ expected identifier, found keyword + | ^^^- + | | + | expected identifier, found keyword + | help: remove this `let` keyword + | + = note: the `let` keyword is not allowed in `struct` fields + = note: see <https://doc.rust-lang.org/book/ch05-01-defining-structs.html> for more information error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-field-semicolon.stderr b/src/test/ui/parser/removed-syntax-field-semicolon.stderr index e4f75f672..532d4fb2b 100644 --- a/src/test/ui/parser/removed-syntax-field-semicolon.stderr +++ b/src/test/ui/parser/removed-syntax-field-semicolon.stderr @@ -1,6 +1,8 @@ error: struct fields are separated by `,` --> $DIR/removed-syntax-field-semicolon.rs:2:12 | +LL | struct S { + | - while parsing this struct LL | bar: (); | ^ help: replace `;` with `,` diff --git a/src/test/ui/parser/require-parens-for-chained-comparison.rs b/src/test/ui/parser/require-parens-for-chained-comparison.rs index f29fd7a54..5b90e905a 100644 --- a/src/test/ui/parser/require-parens-for-chained-comparison.rs +++ b/src/test/ui/parser/require-parens-for-chained-comparison.rs @@ -23,11 +23,13 @@ fn main() { //~^ ERROR expected one of //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments //~| ERROR expected + //~| HELP add `'` to close the char literal f<'_>(); //~^ comparison operators cannot be chained //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments //~| ERROR expected + //~| HELP add `'` to close the char literal let _ = f<u8>; //~^ ERROR comparison operators cannot be chained diff --git a/src/test/ui/parser/require-parens-for-chained-comparison.stderr b/src/test/ui/parser/require-parens-for-chained-comparison.stderr index 0bf52854e..52e201c43 100644 --- a/src/test/ui/parser/require-parens-for-chained-comparison.stderr +++ b/src/test/ui/parser/require-parens-for-chained-comparison.stderr @@ -58,6 +58,11 @@ error: expected `while`, `for`, `loop` or `{` after a label | LL | let _ = f<'_, i8>(); | ^ expected `while`, `for`, `loop` or `{` after a label + | +help: add `'` to close the char literal + | +LL | let _ = f<'_', i8>(); + | + error: expected one of `.`, `:`, `;`, `?`, `else`, `for`, `loop`, `while`, or an operator, found `,` --> $DIR/require-parens-for-chained-comparison.rs:22:17 @@ -71,13 +76,18 @@ LL | let _ = f::<'_, i8>(); | ++ error: expected `while`, `for`, `loop` or `{` after a label - --> $DIR/require-parens-for-chained-comparison.rs:27:9 + --> $DIR/require-parens-for-chained-comparison.rs:28:9 | LL | f<'_>(); | ^ expected `while`, `for`, `loop` or `{` after a label + | +help: add `'` to close the char literal + | +LL | f<'_'>(); + | + error: comparison operators cannot be chained - --> $DIR/require-parens-for-chained-comparison.rs:27:6 + --> $DIR/require-parens-for-chained-comparison.rs:28:6 | LL | f<'_>(); | ^ ^ @@ -88,7 +98,7 @@ LL | f::<'_>(); | ++ error: comparison operators cannot be chained - --> $DIR/require-parens-for-chained-comparison.rs:32:14 + --> $DIR/require-parens-for-chained-comparison.rs:34:14 | LL | let _ = f<u8>; | ^ ^ diff --git a/src/test/ui/parser/semi-after-closure-in-macro.rs b/src/test/ui/parser/semi-after-closure-in-macro.rs new file mode 100644 index 000000000..14efb6100 --- /dev/null +++ b/src/test/ui/parser/semi-after-closure-in-macro.rs @@ -0,0 +1,14 @@ +// check-pass + +// Checks that the fix in #103222 doesn't also disqualify semicolons after +// closures within parentheses *in macros*, where they're totally allowed. + +macro_rules! m { + (($expr:expr ; )) => { + $expr + }; +} + +fn main() { + let x = m!(( ||() ; )); +} diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.rs b/src/test/ui/parser/tag-variant-disr-non-nullary.rs deleted file mode 100644 index a9cfdd549..000000000 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.rs +++ /dev/null @@ -1,12 +0,0 @@ -enum Color { - Red = 0xff0000, - //~^ ERROR custom discriminant values are not allowed in enums with tuple or struct variants - Green = 0x00ff00, - Blue = 0x0000ff, - Black = 0x000000, - White = 0xffffff, - Other(usize), - Other2(usize, usize), -} - -fn main() {} diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr b/src/test/ui/parser/tag-variant-disr-non-nullary.stderr deleted file mode 100644 index 79f044a06..000000000 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0658]: custom discriminant values are not allowed in enums with tuple or struct variants - --> $DIR/tag-variant-disr-non-nullary.rs:2:11 - | -LL | Red = 0xff0000, - | ^^^^^^^^ disallowed custom discriminant -LL | -LL | Green = 0x00ff00, - | ^^^^^^^^ disallowed custom discriminant -LL | Blue = 0x0000ff, - | ^^^^^^^^ disallowed custom discriminant -LL | Black = 0x000000, - | ^^^^^^^^ disallowed custom discriminant -LL | White = 0xffffff, - | ^^^^^^^^ disallowed custom discriminant -LL | Other(usize), - | ------------ tuple variant defined here -LL | Other2(usize, usize), - | -------------------- tuple variant defined here - | - = note: see issue #60553 <https://github.com/rust-lang/rust/issues/60553> for more information - = help: add `#![feature(arbitrary_enum_discriminant)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr b/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr index 76fa86033..be858cd65 100644 --- a/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr +++ b/src/test/ui/parser/trait-item-with-defaultness-fail-semantic.stderr @@ -52,9 +52,9 @@ warning: the feature `specialization` is incomplete and may not be safe to use a LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default error: aborting due to 6 previous errors; 1 warning emitted diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr index 823f75bfa..5e07a3fe6 100644 --- a/src/test/ui/parser/trait-object-trait-parens.stderr +++ b/src/test/ui/parser/trait-object-trait-parens.stderr @@ -22,9 +22,9 @@ warning: trait objects without an explicit `dyn` are deprecated LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(bare_trait_objects)]` on by default = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `#[warn(bare_trait_objects)]` on by default help: use `dyn` | LL | let _: Box<dyn (Obj) + (?Sized) + (for<'a> Trait<'a>)>; diff --git a/src/test/ui/parser/type-alias-where-fixable.stderr b/src/test/ui/parser/type-alias-where-fixable.stderr index 2e516d5c4..f0acb388b 100644 --- a/src/test/ui/parser/type-alias-where-fixable.stderr +++ b/src/test/ui/parser/type-alias-where-fixable.stderr @@ -4,8 +4,8 @@ warning: where clause not allowed here LL | type Assoc where u32: Copy = (); | ^^^^^^^^^^^^^^^ | - = note: `#[warn(deprecated_where_clause_location)]` on by default = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information + = note: `#[warn(deprecated_where_clause_location)]` on by default help: move it to the end of the type declaration | LL - type Assoc where u32: Copy = (); diff --git a/src/test/ui/parser/unicode-control-codepoints.stderr b/src/test/ui/parser/unicode-control-codepoints.stderr index 71509fe41..44548c72f 100644 --- a/src/test/ui/parser/unicode-control-codepoints.stderr +++ b/src/test/ui/parser/unicode-control-codepoints.stderr @@ -92,8 +92,8 @@ LL | // if access_level != "user" { // Check if admin | | '\u{202b}' | this comment contains invisible unicode text flow control codepoints | - = note: `#[deny(text_direction_codepoint_in_comment)]` on by default = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen + = note: `#[deny(text_direction_codepoint_in_comment)]` on by default = help: if their presence wasn't intentional, you can remove them error: unicode codepoint changing visible direction of text present in comment @@ -123,8 +123,8 @@ LL | println!("{:?}", "/* } if isAdmin begin admins only "); | | '\u{202e}' | this literal contains invisible unicode text flow control codepoints | - = note: `#[deny(text_direction_codepoint_in_literal)]` on by default = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen + = note: `#[deny(text_direction_codepoint_in_literal)]` on by default = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | diff --git a/src/test/ui/parser/unmatched-langle-1.stderr b/src/test/ui/parser/unmatched-langle-1.stderr index c8072b4c5..cdf74bded 100644 --- a/src/test/ui/parser/unmatched-langle-1.stderr +++ b/src/test/ui/parser/unmatched-langle-1.stderr @@ -4,18 +4,18 @@ error: unmatched angle brackets LL | foo::<<<<Ty<i32>>(); | ^^^ help: remove extra angle brackets -error[E0425]: cannot find function `foo` in this scope - --> $DIR/unmatched-langle-1.rs:5:5 - | -LL | foo::<<<<Ty<i32>>(); - | ^^^ not found in this scope - error[E0412]: cannot find type `Ty` in this scope --> $DIR/unmatched-langle-1.rs:5:14 | LL | foo::<<<<Ty<i32>>(); | ^^ not found in this scope +error[E0425]: cannot find function `foo` in this scope + --> $DIR/unmatched-langle-1.rs:5:5 + | +LL | foo::<<<<Ty<i32>>(); + | ^^^ not found in this scope + error: aborting due to 3 previous errors Some errors have detailed explanations: E0412, E0425. |