diff options
Diffstat (limited to 'tests/ui/parser')
33 files changed, 480 insertions, 469 deletions
diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.rs b/tests/ui/parser/attr-stmt-expr-attr-bad.rs index c94a32146..d1950087c 100644 --- a/tests/ui/parser/attr-stmt-expr-attr-bad.rs +++ b/tests/ui/parser/attr-stmt-expr-attr-bad.rs @@ -6,6 +6,7 @@ fn main() {} //~^ ERROR expected one of #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } //~^ ERROR an inner attribute is not permitted in this context +//~| ERROR an inner attribute is not permitted in this context //~| ERROR expected expression, found `)` #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } //~^ ERROR an inner attribute is not permitted in this context diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr b/tests/ui/parser/attr-stmt-expr-attr-bad.stderr index a857f11fd..96899fd3f 100644 --- a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr +++ b/tests/ui/parser/attr-stmt-expr-attr-bad.stderr @@ -19,6 +19,15 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files = 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:7:36 + | +LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } + | ^^^^^^^^ + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them + error: expected expression, found `)` --> $DIR/attr-stmt-expr-attr-bad.rs:7:44 | @@ -26,7 +35,7 @@ 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:10:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:11:38 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | ^^^^^^^^ @@ -35,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:10:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:11: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:13:36 + --> $DIR/attr-stmt-expr-attr-bad.rs:14:36 | LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } | ^^^^^^^^ @@ -50,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:15:33 + --> $DIR/attr-stmt-expr-attr-bad.rs:16:33 | LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } | ^^^^^^^^ @@ -59,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:17:33 + --> $DIR/attr-stmt-expr-attr-bad.rs:18:33 | LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } | ^^^^^^^^ @@ -68,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:19:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:20: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:21:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:22:35 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } | ^^^^^^^^ @@ -83,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:23:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:24:40 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } | ^^^^^^^^ @@ -92,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:25:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:26:35 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } | ^^^^^^^^ @@ -101,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:27:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:28:40 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } | ^^^^^^^^ @@ -110,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:29:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:30:40 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; } | ^^ expected expression error: expected expression, found `..` - --> $DIR/attr-stmt-expr-attr-bad.rs:31:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:32: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:33:41 + --> $DIR/attr-stmt-expr-attr-bad.rs:34:41 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } | ^^^^^^^^ @@ -131,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:35:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:36:45 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } | ^^^^^^^^ @@ -140,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:37:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:38:37 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -149,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:39:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:40:38 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } | ^^^^^^^^ @@ -158,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:41:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:42: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:43:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:44:45 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch @@ -173,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:45:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:46:46 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } | ^^^^^^^^ @@ -182,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:47:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:48:45 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | ---- ^^^^^^^ ------- the attributes are attached to this branch @@ -191,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:49:50 + --> $DIR/attr-stmt-expr-attr-bad.rs:50:50 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -200,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:51:51 + --> $DIR/attr-stmt-expr-attr-bad.rs:52:51 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } | ^^^^^^^^ @@ -209,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:53:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:54:45 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -218,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:55:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:56:46 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } | ^^^^^^^^ @@ -227,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:57:48 + --> $DIR/attr-stmt-expr-attr-bad.rs:58: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:59:53 + --> $DIR/attr-stmt-expr-attr-bad.rs:60:53 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch @@ -242,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:61:54 + --> $DIR/attr-stmt-expr-attr-bad.rs:62:54 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } | ^^^^^^^^ @@ -251,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:63:53 + --> $DIR/attr-stmt-expr-attr-bad.rs:64:53 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | ---- ^^^^^^^ --------------- the attributes are attached to this branch @@ -260,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:65:66 + --> $DIR/attr-stmt-expr-attr-bad.rs:66:66 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -269,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:67:67 + --> $DIR/attr-stmt-expr-attr-bad.rs:68:67 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; } | ^^^^^^^^ @@ -278,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:70:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:71:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } | ------- ^^^^^^^^ not permitted following an outer attribute @@ -289,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:72:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:73:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } | ------- ^^^^^^^^ not permitted following an outer attribute @@ -300,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:74:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:75:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation @@ -316,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:76:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:77:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation @@ -332,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:78:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:79:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } | ------- ^^^^^^^^ ------ the inner attribute doesn't annotate this item macro invocation @@ -348,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:84:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:85:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | ^^^ help: use `..` instead @@ -356,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:84:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:85: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:87:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | ^^^ help: use `..` instead @@ -370,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:87:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:88: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:90:39 + --> $DIR/attr-stmt-expr-attr-bad.rs:91: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:92:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:93:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | ^^^ help: use `..` instead @@ -390,47 +399,47 @@ 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:92:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:93: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:96:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:97: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:96:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:97: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:99:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:100: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:99:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:100: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:104:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:105:37 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } } | ^^^^^^^ error: expected statement after outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:106:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:107:37 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } } | ^^^^^^^ -error: aborting due to 52 previous errors +error: aborting due to 53 previous errors For more information about this error, try `rustc --explain E0586`. diff --git a/tests/ui/parser/builtin-syntax.rs b/tests/ui/parser/builtin-syntax.rs new file mode 100644 index 000000000..897dab8ec --- /dev/null +++ b/tests/ui/parser/builtin-syntax.rs @@ -0,0 +1,9 @@ +#![feature(builtin_syntax)] + +fn main() { + builtin # foobar(); //~ ERROR unknown `builtin #` construct +} + +fn not_identifier() { + builtin # {}(); //~ ERROR expected identifier after +} diff --git a/tests/ui/parser/builtin-syntax.stderr b/tests/ui/parser/builtin-syntax.stderr new file mode 100644 index 000000000..ee3764a62 --- /dev/null +++ b/tests/ui/parser/builtin-syntax.stderr @@ -0,0 +1,14 @@ +error: unknown `builtin #` construct `foobar` + --> $DIR/builtin-syntax.rs:4:5 + | +LL | builtin # foobar(); + | ^^^^^^^^^^^^^^^^ + +error: expected identifier after `builtin #` + --> $DIR/builtin-syntax.rs:8:15 + | +LL | builtin # {}(); + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/dyn-trait-compatibility.stderr b/tests/ui/parser/dyn-trait-compatibility.stderr index 653be5b3b..e34d855a9 100644 --- a/tests/ui/parser/dyn-trait-compatibility.stderr +++ b/tests/ui/parser/dyn-trait-compatibility.stderr @@ -1,9 +1,3 @@ -error[E0433]: failed to resolve: use of undeclared crate or module `dyn` - --> $DIR/dyn-trait-compatibility.rs:3:11 - | -LL | type A1 = dyn::dyn; - | ^^^ use of undeclared crate or module `dyn` - error[E0412]: cannot find type `dyn` in this scope --> $DIR/dyn-trait-compatibility.rs:1:11 | @@ -46,6 +40,12 @@ error[E0412]: cannot find type `dyn` in this scope LL | type A3 = dyn<<dyn as dyn>::dyn>; | ^^^ not found in this scope +error[E0433]: failed to resolve: use of undeclared crate or module `dyn` + --> $DIR/dyn-trait-compatibility.rs:3:11 + | +LL | type A1 = dyn::dyn; + | ^^^ use of undeclared crate or module `dyn` + error: aborting due to 8 previous errors Some errors have detailed explanations: E0405, E0412, E0433. diff --git a/tests/ui/parser/eq-less-to-less-eq.rs b/tests/ui/parser/eq-less-to-less-eq.rs new file mode 100644 index 000000000..23c6c59d7 --- /dev/null +++ b/tests/ui/parser/eq-less-to-less-eq.rs @@ -0,0 +1,33 @@ +fn foo() { + let a = 0; + let b = 4; + if a =< b { //~ERROR + println!("yay!"); + } +} + +fn bar() { + let a = 0; + let b = 4; + if a = <b { //~ERROR + println!("yay!"); + } +} + +fn baz() { + let a = 0; + let b = 4; + if a = < b { //~ERROR + println!("yay!"); + } +} + +fn qux() { + let a = 0; + let b = 4; + if a =< i32>::abs(-4) { //~ERROR: mismatched types + println!("yay!"); + } +} + +fn main() {} diff --git a/tests/ui/parser/eq-less-to-less-eq.stderr b/tests/ui/parser/eq-less-to-less-eq.stderr new file mode 100644 index 000000000..4717d8287 --- /dev/null +++ b/tests/ui/parser/eq-less-to-less-eq.stderr @@ -0,0 +1,34 @@ +error: expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `{` + --> $DIR/eq-less-to-less-eq.rs:4:15 + | +LL | if a =< b { + | -- ^ expected one of 7 possible tokens + | | + | help: did you mean: `<=` + +error: expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `{` + --> $DIR/eq-less-to-less-eq.rs:12:15 + | +LL | if a = <b { + | ^ expected one of 7 possible tokens + +error: expected one of `!`, `(`, `+`, `::`, `<`, `>`, or `as`, found `{` + --> $DIR/eq-less-to-less-eq.rs:20:16 + | +LL | if a = < b { + | ^ expected one of 7 possible tokens + +error[E0308]: mismatched types + --> $DIR/eq-less-to-less-eq.rs:28:8 + | +LL | if a =< i32>::abs(-4) { + | ^^^^^^^^^^^^^^^^^^ expected `bool`, found `()` + | +help: you might have meant to compare for equality + | +LL | if a ==< i32>::abs(-4) { + | + + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/impl-on-unsized-typo.rs b/tests/ui/parser/impl-on-unsized-typo.rs new file mode 100644 index 000000000..e09c04630 --- /dev/null +++ b/tests/ui/parser/impl-on-unsized-typo.rs @@ -0,0 +1,6 @@ +trait Tr {} + +impl<T ?Sized> Tr for T {} +//~^ ERROR expected one of `,`, `:`, `=`, or `>`, found `?` + +fn main() {} diff --git a/tests/ui/parser/impl-on-unsized-typo.stderr b/tests/ui/parser/impl-on-unsized-typo.stderr new file mode 100644 index 000000000..23dcc1efd --- /dev/null +++ b/tests/ui/parser/impl-on-unsized-typo.stderr @@ -0,0 +1,8 @@ +error: expected one of `,`, `:`, `=`, or `>`, found `?` + --> $DIR/impl-on-unsized-typo.rs:3:8 + | +LL | impl<T ?Sized> Tr for T {} + | ^ expected one of `,`, `:`, `=`, or `>` + +error: aborting due to previous error + diff --git a/tests/ui/parser/issue-103869.rs b/tests/ui/parser/issue-103869.rs deleted file mode 100644 index 28c442bdd..000000000 --- a/tests/ui/parser/issue-103869.rs +++ /dev/null @@ -1,9 +0,0 @@ -enum VecOrMap{ - vec: Vec<usize>, - //~^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found `:` - //~| HELP: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` - //~| ERROR expected item, found `:` - map: HashMap<String,usize> -} - -fn main() {} diff --git a/tests/ui/parser/issue-103869.stderr b/tests/ui/parser/issue-103869.stderr deleted file mode 100644 index 0b8cd919a..000000000 --- a/tests/ui/parser/issue-103869.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: expected one of `(`, `,`, `=`, `{`, or `}`, found `:` - --> $DIR/issue-103869.rs:2:8 - | -LL | vec: Vec<usize>, - | ^ expected one of `(`, `,`, `=`, `{`, or `}` - | - = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` - -error: expected item, found `:` - --> $DIR/issue-103869.rs:2:8 - | -LL | vec: Vec<usize>, - | ^ expected item - -error: aborting due to 2 previous errors - diff --git a/tests/ui/parser/issues/issue-111148.rs b/tests/ui/parser/issues/issue-111148.rs new file mode 100644 index 000000000..2502beab4 --- /dev/null +++ b/tests/ui/parser/issues/issue-111148.rs @@ -0,0 +1,2 @@ +fn a<<i<Y<w<># +//~^ ERROR expected one of `#`, `>`, `const`, identifier, or lifetime, found `<` diff --git a/tests/ui/parser/issues/issue-111148.stderr b/tests/ui/parser/issues/issue-111148.stderr new file mode 100644 index 000000000..e6595a5cb --- /dev/null +++ b/tests/ui/parser/issues/issue-111148.stderr @@ -0,0 +1,8 @@ +error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `<` + --> $DIR/issue-111148.rs:1:6 + | +LL | fn a<<i<Y<w<># + | ^ expected one of `#`, `>`, `const`, identifier, or lifetime + +error: aborting due to previous error + diff --git a/tests/ui/parser/issues/issue-111416.rs b/tests/ui/parser/issues/issue-111416.rs new file mode 100644 index 000000000..cfd1b6b99 --- /dev/null +++ b/tests/ui/parser/issues/issue-111416.rs @@ -0,0 +1,3 @@ +fn main() { + let my = monad_bind(mx, T: Try); //~ ERROR invalid `struct` delimiters or `fn` call arguments +} diff --git a/tests/ui/parser/issues/issue-111416.stderr b/tests/ui/parser/issues/issue-111416.stderr new file mode 100644 index 000000000..ddacf4d6d --- /dev/null +++ b/tests/ui/parser/issues/issue-111416.stderr @@ -0,0 +1,18 @@ +error: invalid `struct` delimiters or `fn` call arguments + --> $DIR/issue-111416.rs:2:14 + | +LL | let my = monad_bind(mx, T: Try); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +help: if `monad_bind` is a struct, use braces as delimiters + | +LL | let my = monad_bind { mx, T: Try }; + | ~ ~ +help: if `monad_bind` is a function, use the arguments directly + | +LL - let my = monad_bind(mx, T: Try); +LL + let my = monad_bind(mx, Try); + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/issues/issue-33418.fixed b/tests/ui/parser/issues/issue-33418.fixed deleted file mode 100644 index ed885ae14..000000000 --- a/tests/ui/parser/issues/issue-33418.fixed +++ /dev/null @@ -1,19 +0,0 @@ -// run-rustfix - -trait Tr {} -//~^ ERROR negative bounds are not supported -trait Tr2: SuperA {} -//~^ ERROR negative bounds are not supported -trait Tr3: SuperB {} -//~^ ERROR negative bounds are not supported -trait Tr4: SuperB + SuperD {} -//~^ ERROR negative bounds are not supported -trait Tr5 {} -//~^ ERROR negative bounds are not supported - -trait SuperA {} -trait SuperB {} -trait SuperC {} -trait SuperD {} - -fn main() {} diff --git a/tests/ui/parser/issues/issue-33418.rs b/tests/ui/parser/issues/issue-33418.rs index 9934284ab..4ebd5871e 100644 --- a/tests/ui/parser/issues/issue-33418.rs +++ b/tests/ui/parser/issues/issue-33418.rs @@ -1,5 +1,3 @@ -// run-rustfix - trait Tr: !SuperA {} //~^ ERROR negative bounds are not supported trait Tr2: SuperA + !SuperB {} @@ -7,10 +5,12 @@ trait Tr2: SuperA + !SuperB {} trait Tr3: !SuperA + SuperB {} //~^ ERROR negative bounds are not supported trait Tr4: !SuperA + SuperB - + !SuperC + SuperD {} +//~^ ERROR negative bounds are not supported ++ !SuperC + SuperD {} //~^ ERROR negative bounds are not supported trait Tr5: !SuperA - + !SuperB {} +//~^ ERROR negative bounds are not supported ++ !SuperB {} //~^ ERROR negative bounds are not supported trait SuperA {} diff --git a/tests/ui/parser/issues/issue-33418.stderr b/tests/ui/parser/issues/issue-33418.stderr index 9a8733e89..b111bcfd2 100644 --- a/tests/ui/parser/issues/issue-33418.stderr +++ b/tests/ui/parser/issues/issue-33418.stderr @@ -1,36 +1,44 @@ error: negative bounds are not supported - --> $DIR/issue-33418.rs:3:9 + --> $DIR/issue-33418.rs:1:11 | LL | trait Tr: !SuperA {} - | ^^^^^^^^^ negative bounds are not supported + | ^ error: negative bounds are not supported - --> $DIR/issue-33418.rs:5:19 + --> $DIR/issue-33418.rs:3:21 | LL | trait Tr2: SuperA + !SuperB {} - | ^^^^^^^^^ negative bounds are not supported + | ^ error: negative bounds are not supported - --> $DIR/issue-33418.rs:7:10 + --> $DIR/issue-33418.rs:5:12 | LL | trait Tr3: !SuperA + SuperB {} - | ^^^^^^^^^ negative bounds are not supported + | ^ error: negative bounds are not supported - --> $DIR/issue-33418.rs:9:10 + --> $DIR/issue-33418.rs:7:12 | LL | trait Tr4: !SuperA + SuperB - | ^^^^^^^^^ -LL | + !SuperC + SuperD {} - | ^^^^^^^^^ negative bounds are not supported + | ^ error: negative bounds are not supported - --> $DIR/issue-33418.rs:12:10 + --> $DIR/issue-33418.rs:9:3 + | +LL | + !SuperC + SuperD {} + | ^ + +error: negative bounds are not supported + --> $DIR/issue-33418.rs:11:12 | LL | trait Tr5: !SuperA - | ^^^^^^^^^ -LL | + !SuperB {} - | ^^^^^^^^^ negative bounds are not supported + | ^ + +error: negative bounds are not supported + --> $DIR/issue-33418.rs:13:3 + | +LL | + !SuperB {} + | ^ -error: aborting due to 5 previous errors +error: aborting due to 7 previous errors diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs b/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs index 7bd4b3a16..3d110adef 100644 --- a/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs +++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs @@ -10,14 +10,14 @@ pub fn index_after_as_cast() { vec![1, 2, 3] as Vec<i32>[0]; //~^ ERROR: cast cannot be followed by indexing vec![1, 2, 3]: Vec<i32>[0]; - //~^ ERROR: type ascription cannot be followed by indexing + //~^ ERROR: expected one of } pub fn index_after_cast_to_index() { (&[0]) as &[i32][0]; //~^ ERROR: cast cannot be followed by indexing (&[0i32]): &[i32; 1][0]; - //~^ ERROR: type ascription cannot be followed by indexing + //~^ ERROR: expected one of } pub fn cast_after_cast() { @@ -25,7 +25,7 @@ pub fn cast_after_cast() { } if 5u64: u64: u64 == 0u64 { - + //~^ ERROR expected `{`, found `:` } let _ = 5u64: u64: u64 as u8 as i8 == 9i8; let _ = 0i32: i32: i32; @@ -36,26 +36,46 @@ pub fn cast_after_cast() { } pub fn cast_cast_method_call() { - let _ = 0i32: i32: i32.count_ones(); - //~^ ERROR: type ascription cannot be followed by a method call - let _ = 0 as i32: i32.count_ones(); - //~^ ERROR: type ascription cannot be followed by a method call - let _ = 0i32: i32 as i32.count_ones(); - //~^ ERROR: cast cannot be followed by a method call + let _ = 0i32: i32: i32.count_ones(); //~ ERROR expected one of +} + +pub fn cast_cast_method_call_2() { + let _ = 0 as i32: i32.count_ones(); //~ ERROR expected one of +} + +pub fn cast_cast_method_call_3() { + let _ = 0i32: i32 as i32.count_ones(); //~ ERROR expected one of +} + +pub fn cast_cast_method_call_4() { let _ = 0 as i32 as i32.count_ones(); //~^ ERROR: cast cannot be followed by a method call - let _ = 0i32: i32: i32 as u32 as i32.count_ones(); - //~^ ERROR: cast cannot be followed by a method call - let _ = 0i32: i32.count_ones(): u32; - //~^ ERROR: type ascription cannot be followed by a method call - let _ = 0 as i32.count_ones(): u32; +} + +pub fn cast_cast_method_call_5() { + let _ = 0i32: i32: i32 as u32 as i32.count_ones(); //~ ERROR expected one of +} + +pub fn cast_cast_method_call_6() { + let _ = 0i32: i32.count_ones(): u32; //~ ERROR expected one of +} + +pub fn cast_cast_method_call_7() { + let _ = 0 as i32.count_ones(): u32; //~ ERROR expected one of //~^ ERROR: cast cannot be followed by a method call - let _ = 0i32: i32.count_ones() as u32; - //~^ ERROR: type ascription cannot be followed by a method call +} + +pub fn cast_cast_method_call_8() { + let _ = 0i32: i32.count_ones() as u32; //~ ERROR expected one of +} + +pub fn cast_cast_method_call_9() { let _ = 0 as i32.count_ones() as u32; //~^ ERROR: cast cannot be followed by a method call - let _ = 0i32: i32: i32.count_ones() as u32 as i32; - //~^ ERROR: type ascription cannot be followed by a method call +} + +pub fn cast_cast_method_call_10() { + let _ = 0i32: i32: i32.count_ones() as u32 as i32; //~ ERROR expected one of } pub fn multiline_error() { @@ -74,8 +94,7 @@ pub fn precedence() { pub fn method_calls() { 0 as i32.max(0); //~^ ERROR: cast cannot be followed by a method call - 0: i32.max(0); - //~^ ERROR: type ascription cannot be followed by a method call + 0: i32.max(0); //~ ERROR expected one of } pub fn complex() { @@ -84,7 +103,7 @@ pub fn complex() { if true { 33 } else { 44 } as i32.max(0), //~^ ERROR: cast cannot be followed by a method call if true { 33 } else { 44 }: i32.max(0) - //~^ ERROR: type ascription cannot be followed by a method call + //~^ ERROR: expected one of ); } @@ -93,7 +112,7 @@ pub fn in_condition() { //~^ ERROR: cast cannot be followed by a method call } if 5u64: u64.max(0) == 0 { - //~^ ERROR: type ascription cannot be followed by a method call + //~^ ERROR: expected `{`, found `:` } } @@ -104,7 +123,7 @@ pub fn inside_block() { } else { false }; let _ = if true { 5u64: u64.max(0) == 0 - //~^ ERROR: type ascription cannot be followed by a method call + //~^ ERROR: expected one of } else { false }; } @@ -112,14 +131,14 @@ static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); //~^ ERROR: cast cannot be followed by indexing static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); -//~^ ERROR: type ascription cannot be followed by indexing +//~^ ERROR: expected one of pub fn cast_then_try() -> Result<u64,u64> { Err(0u64) as Result<u64,u64>?; //~^ ERROR: cast cannot be followed by `?` Err(0u64): Result<u64,u64>?; - //~^ ERROR: type ascription cannot be followed by `?` + //~^ ERROR: expected one of Ok(1) } @@ -131,13 +150,14 @@ pub fn cast_then_call() { drop as F(); //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214] drop_ptr: F(); - //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214] + //~^ ERROR: expected identifier, found `:` } pub fn cast_to_fn_should_work() { let drop_ptr = drop as fn(u8); drop as fn(u8); drop_ptr: fn(u8); + //~^ ERROR expected one of } pub fn parens_after_cast_error() { @@ -145,7 +165,7 @@ pub fn parens_after_cast_error() { drop as fn(u8)(0); //~^ ERROR: cast cannot be followed by a function call drop_ptr: fn(u8)(0); - //~^ ERROR: type ascription cannot be followed by a function call + //~^ ERROR: expected one of } pub async fn cast_then_await() { @@ -153,7 +173,7 @@ pub async fn cast_then_await() { //~^ ERROR: cast cannot be followed by `.await` Box::pin(noop()): Pin<Box<_>>.await; - //~^ ERROR: type ascription cannot be followed by `.await` + //~^ ERROR: expected one of } pub async fn noop() {} @@ -167,5 +187,5 @@ pub fn struct_field() { Foo::default() as Foo.bar; //~^ ERROR: cannot be followed by a field access Foo::default(): Foo.bar; - //~^ ERROR: type ascription cannot be followed by a field access + //~^ ERROR expected one of } diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr index 0c328bde2..d313c888e 100644 --- a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr +++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr @@ -9,21 +9,11 @@ help: try surrounding the expression in parentheses LL | (vec![1, 2, 3] as Vec<i32>)[0]; | + + -error: type ascription cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:12:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:12:18 | LL | vec![1, 2, 3]: Vec<i32>[0]; - | ^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (vec![1, 2, 3]: Vec<i32>)[0]; - | + + -help: alternatively, remove the type ascription - | -LL - vec![1, 2, 3]: Vec<i32>[0]; -LL + vec![1, 2, 3][0]; - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:17:5 @@ -36,67 +26,50 @@ help: try surrounding the expression in parentheses LL | ((&[0]) as &[i32])[0]; | + + -error: type ascription cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:19:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:19:14 | LL | (&[0i32]): &[i32; 1][0]; - | ^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: expected `{`, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:27:12 | -LL | ((&[0i32]): &[i32; 1])[0]; - | + + -help: alternatively, remove the type ascription +LL | if 5u64: u64: u64 == 0u64 { + | ^ expected `{` | -LL - (&[0i32]): &[i32; 1][0]; -LL + (&[0i32])[0]; +note: the `if` expression is missing a block after this condition + --> $DIR/issue-35813-postfix-after-cast.rs:27:8 | +LL | if 5u64: u64: u64 == 0u64 { + | ^^^^ -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:39:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:39:17 | LL | let _ = 0i32: i32: i32.count_ones(); - | ^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | let _ = (0i32: i32: i32).count_ones(); - | + + -help: alternatively, remove the type ascription - | -LL - let _ = 0i32: i32: i32.count_ones(); -LL + let _ = 0i32: i32.count_ones(); + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:41:13 +error: expected one of `!`, `(`, `.`, `::`, `;`, `<`, `?`, or `else`, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:43:21 | LL | let _ = 0 as i32: i32.count_ones(); - | ^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | let _ = (0 as i32: i32).count_ones(); - | + + -help: alternatively, remove the type ascription - | -LL - let _ = 0 as i32: i32.count_ones(); -LL + let _ = 0 as i32.count_ones(); + | ^ expected one of 8 possible tokens | + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> -error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:43:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:47:17 | LL | let _ = 0i32: i32 as i32.count_ones(); - | ^^^^^^^^^^^^^^^^ + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | -help: try surrounding the expression in parentheses - | -LL | let _ = (0i32: i32 as i32).count_ones(); - | + + + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:45:13 + --> $DIR/issue-35813-postfix-after-cast.rs:51:13 | LL | let _ = 0 as i32 as i32.count_ones(); | ^^^^^^^^^^^^^^^ @@ -106,35 +79,24 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32 as i32).count_ones(); | + + -error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:47:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:56:17 | LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | -LL | let _ = (0i32: i32: i32 as u32 as i32).count_ones(); - | + + + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:49:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:60:17 | LL | let _ = 0i32: i32.count_ones(): u32; - | ^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | let _ = (0i32: i32).count_ones(): u32; - | + + -help: alternatively, remove the type ascription - | -LL - let _ = 0i32: i32.count_ones(): u32; -LL + let _ = 0i32.count_ones(): u32; + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:51:13 + --> $DIR/issue-35813-postfix-after-cast.rs:64:13 | LL | let _ = 0 as i32.count_ones(): u32; | ^^^^^^^^ @@ -144,24 +106,24 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32).count_ones(): u32; | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:53:13 +error: expected one of `.`, `;`, `?`, or `else`, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:64:34 | -LL | let _ = 0i32: i32.count_ones() as u32; - | ^^^^^^^^^ - | -help: try surrounding the expression in parentheses +LL | let _ = 0 as i32.count_ones(): u32; + | ^ expected one of `.`, `;`, `?`, or `else` | -LL | let _ = (0i32: i32).count_ones() as u32; - | + + -help: alternatively, remove the type ascription + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> + +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:69:17 | -LL - let _ = 0i32: i32.count_ones() as u32; -LL + let _ = 0i32.count_ones() as u32; +LL | let _ = 0i32: i32.count_ones() as u32; + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:55:13 + --> $DIR/issue-35813-postfix-after-cast.rs:73:13 | LL | let _ = 0 as i32.count_ones() as u32; | ^^^^^^^^ @@ -171,24 +133,16 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32).count_ones() as u32; | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:57:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:78:17 | LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32; - | ^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | let _ = (0i32: i32: i32).count_ones() as u32 as i32; - | + + -help: alternatively, remove the type ascription - | -LL - let _ = 0i32: i32: i32.count_ones() as u32 as i32; -LL + let _ = 0i32: i32.count_ones() as u32 as i32; + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:62:13 + --> $DIR/issue-35813-postfix-after-cast.rs:82:13 | LL | let _ = 0 | _____________^ @@ -202,7 +156,7 @@ LL ~ as i32) | error: cast cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:70:18 + --> $DIR/issue-35813-postfix-after-cast.rs:90:18 | LL | let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -213,7 +167,7 @@ LL | let x: i32 = (&vec![1, 2, 3] as &Vec<i32>)[0]; | + + error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:75:5 + --> $DIR/issue-35813-postfix-after-cast.rs:95:5 | LL | 0 as i32.max(0); | ^^^^^^^^ @@ -223,24 +177,14 @@ help: try surrounding the expression in parentheses LL | (0 as i32).max(0); | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:77:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:97:6 | LL | 0: i32.max(0); - | ^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (0: i32).max(0); - | + + -help: alternatively, remove the type ascription - | -LL - 0: i32.max(0); -LL + 0.max(0); - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:92:8 + --> $DIR/issue-35813-postfix-after-cast.rs:111:8 | LL | if 5u64 as i32.max(0) == 0 { | ^^^^^^^^^^^ @@ -250,24 +194,20 @@ help: try surrounding the expression in parentheses LL | if (5u64 as i32).max(0) == 0 { | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:95:8 +error: expected `{`, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:114:12 | LL | if 5u64: u64.max(0) == 0 { - | ^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | if (5u64: u64).max(0) == 0 { - | + + -help: alternatively, remove the type ascription + | ^ expected `{` | -LL - if 5u64: u64.max(0) == 0 { -LL + if 5u64.max(0) == 0 { +note: the `if` expression is missing a block after this condition + --> $DIR/issue-35813-postfix-after-cast.rs:114:8 | +LL | if 5u64: u64.max(0) == 0 { + | ^^^^ error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:102:9 + --> $DIR/issue-35813-postfix-after-cast.rs:121:9 | LL | 5u64 as u32.max(0) == 0 | ^^^^^^^^^^^ @@ -277,24 +217,14 @@ help: try surrounding the expression in parentheses LL | (5u64 as u32).max(0) == 0 | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:106:9 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:125:13 | LL | 5u64: u64.max(0) == 0 - | ^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (5u64: u64).max(0) == 0 - | + + -help: alternatively, remove the type ascription - | -LL - 5u64: u64.max(0) == 0 -LL + 5u64.max(0) == 0 - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:111:24 + --> $DIR/issue-35813-postfix-after-cast.rs:130:24 | LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); | ^^^^^^^^^^^^^^^^^^ @@ -304,24 +234,14 @@ help: try surrounding the expression in parentheses LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]); | + + -error: type ascription cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:114:25 +error: expected one of `)`, `,`, `.`, `?`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:133:36 | LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); - | ^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | static bar2: &[i32] = &((&[1i32,2,3]: &[i32; 3])[0..1]); - | + + -help: alternatively, remove the type ascription - | -LL - static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); -LL + static bar2: &[i32] = &(&[1i32,2,3][0..1]); - | + | ^ expected one of `)`, `,`, `.`, `?`, or an operator error: cast cannot be followed by `?` - --> $DIR/issue-35813-postfix-after-cast.rs:119:5 + --> $DIR/issue-35813-postfix-after-cast.rs:138:5 | LL | Err(0u64) as Result<u64,u64>?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -331,24 +251,28 @@ help: try surrounding the expression in parentheses LL | (Err(0u64) as Result<u64,u64>)?; | + + -error: type ascription cannot be followed by `?` - --> $DIR/issue-35813-postfix-after-cast.rs:121:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:140:14 | LL | Err(0u64): Result<u64,u64>?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: expected identifier, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:152:13 | -LL | (Err(0u64): Result<u64,u64>)?; - | + + -help: alternatively, remove the type ascription +LL | drop_ptr: F(); + | ^ expected identifier | -LL - Err(0u64): Result<u64,u64>?; -LL + Err(0u64)?; + = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> + +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:159:13 | +LL | drop_ptr: fn(u8); + | ^ expected one of 8 possible tokens error: cast cannot be followed by a function call - --> $DIR/issue-35813-postfix-after-cast.rs:145:5 + --> $DIR/issue-35813-postfix-after-cast.rs:165:5 | LL | drop as fn(u8)(0); | ^^^^^^^^^^^^^^ @@ -358,24 +282,14 @@ help: try surrounding the expression in parentheses LL | (drop as fn(u8))(0); | + + -error: type ascription cannot be followed by a function call - --> $DIR/issue-35813-postfix-after-cast.rs:147:5 +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:167:13 | LL | drop_ptr: fn(u8)(0); - | ^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (drop_ptr: fn(u8))(0); - | + + -help: alternatively, remove the type ascription - | -LL - drop_ptr: fn(u8)(0); -LL + drop_ptr(0); - | + | ^ expected one of 8 possible tokens error: cast cannot be followed by `.await` - --> $DIR/issue-35813-postfix-after-cast.rs:152:5 + --> $DIR/issue-35813-postfix-after-cast.rs:172:5 | LL | Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -385,24 +299,14 @@ help: try surrounding the expression in parentheses LL | (Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>).await; | + + -error: type ascription cannot be followed by `.await` - --> $DIR/issue-35813-postfix-after-cast.rs:155:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:175:21 | LL | Box::pin(noop()): Pin<Box<_>>.await; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (Box::pin(noop()): Pin<Box<_>>).await; - | + + -help: alternatively, remove the type ascription - | -LL - Box::pin(noop()): Pin<Box<_>>.await; -LL + Box::pin(noop()).await; - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by a field access - --> $DIR/issue-35813-postfix-after-cast.rs:167:5 + --> $DIR/issue-35813-postfix-after-cast.rs:187:5 | LL | Foo::default() as Foo.bar; | ^^^^^^^^^^^^^^^^^^^^^ @@ -412,24 +316,14 @@ help: try surrounding the expression in parentheses LL | (Foo::default() as Foo).bar; | + + -error: type ascription cannot be followed by a field access - --> $DIR/issue-35813-postfix-after-cast.rs:169:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:189:19 | LL | Foo::default(): Foo.bar; - | ^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (Foo::default(): Foo).bar; - | + + -help: alternatively, remove the type ascription - | -LL - Foo::default(): Foo.bar; -LL + Foo::default().bar; - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:84:9 + --> $DIR/issue-35813-postfix-after-cast.rs:103:9 | LL | if true { 33 } else { 44 } as i32.max(0), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -439,34 +333,18 @@ help: try surrounding the expression in parentheses LL | (if true { 33 } else { 44 } as i32).max(0), | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:86:9 +error: expected one of `,`, `.`, `?`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:105:35 | LL | if true { 33 } else { 44 }: i32.max(0) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (if true { 33 } else { 44 }: i32).max(0) - | + + -help: alternatively, remove the type ascription - | -LL - if true { 33 } else { 44 }: i32.max(0) -LL + if true { 33 } else { 44 }.max(0) - | + | ^ expected one of `,`, `.`, `?`, or an operator error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-35813-postfix-after-cast.rs:131:13 + --> $DIR/issue-35813-postfix-after-cast.rs:150:13 | LL | drop as F(); | ^^^ only `Fn` traits may use parentheses -error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-35813-postfix-after-cast.rs:133:15 - | -LL | drop_ptr: F(); - | ^^^ only `Fn` traits may use parentheses - -error: aborting due to 36 previous errors +error: aborting due to 39 previous errors For more information about this error, try `rustc --explain E0214`. diff --git a/tests/ui/parser/issues/issue-44406.rs b/tests/ui/parser/issues/issue-44406.rs index a5b7e83a0..6719e5828 100644 --- a/tests/ui/parser/issues/issue-44406.rs +++ b/tests/ui/parser/issues/issue-44406.rs @@ -6,5 +6,4 @@ macro_rules! foo { fn main() { foo!(true); - //~^ ERROR expected identifier, found keyword } diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr index de02ea85b..69ff64c27 100644 --- a/tests/ui/parser/issues/issue-44406.stderr +++ b/tests/ui/parser/issues/issue-44406.stderr @@ -1,14 +1,3 @@ -error: expected identifier, found keyword `true` - --> $DIR/issue-44406.rs:8:10 - | -LL | foo!(true); - | ^^^^ expected identifier, found keyword - | -help: escape `true` to use it as an identifier - | -LL | foo!(r#true); - | ++ - error: invalid `struct` delimiters or `fn` call arguments --> $DIR/issue-44406.rs:3:9 | @@ -29,5 +18,5 @@ LL - bar(baz: $rest) LL + bar(: $rest) | -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62913.rs b/tests/ui/parser/issues/issue-62913.rs index 0db06f636..a55ef5ac7 100644 --- a/tests/ui/parser/issues/issue-62913.rs +++ b/tests/ui/parser/issues/issue-62913.rs @@ -1,4 +1,4 @@ "\u\\" //~^ ERROR incorrect unicode escape sequence //~| ERROR invalid trailing slash in literal -//~| ERROR expected item, found `"\u\\"` +//~| ERROR expected item, found `"\u\"` diff --git a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed index 95019b278..2c42f9731 100644 --- a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed +++ b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed @@ -6,9 +6,12 @@ fn main() {} -pub fn f1<T>() {} +pub fn f1<T: 'static>() {} //~^ ERROR negative bounds are not supported -pub fn f2<'a, T: Ord>() {} +//~| ERROR `!` may only modify trait bounds, not lifetime bound +pub fn f2<'a, T: Ord + 'a>() {} //~^ ERROR negative bounds are not supported -pub fn f3<'a, T: Ord>() {} +//~| ERROR `!` may only modify trait bounds, not lifetime bound +pub fn f3<'a, T: 'a + Ord>() {} //~^ ERROR negative bounds are not supported +//~| ERROR `!` may only modify trait bounds, not lifetime bound diff --git a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs index 82f54f8fa..e510efaae 100644 --- a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs +++ b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs @@ -8,7 +8,10 @@ fn main() {} pub fn f1<T: !'static>() {} //~^ ERROR negative bounds are not supported +//~| ERROR `!` may only modify trait bounds, not lifetime bound pub fn f2<'a, T: Ord + !'a>() {} //~^ ERROR negative bounds are not supported +//~| ERROR `!` may only modify trait bounds, not lifetime bound pub fn f3<'a, T: !'a + Ord>() {} //~^ ERROR negative bounds are not supported +//~| ERROR `!` may only modify trait bounds, not lifetime bound diff --git a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr index a4a422948..91fe02db3 100644 --- a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr +++ b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr @@ -1,20 +1,38 @@ +error: `!` may only modify trait bounds, not lifetime bounds + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:14 + | +LL | pub fn f1<T: !'static>() {} + | ^ + +error: `!` may only modify trait bounds, not lifetime bounds + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:12:24 + | +LL | pub fn f2<'a, T: Ord + !'a>() {} + | ^ + +error: `!` may only modify trait bounds, not lifetime bounds + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:15:18 + | +LL | pub fn f3<'a, T: !'a + Ord>() {} + | ^ + error: negative bounds are not supported - --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:12 + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:14 | LL | pub fn f1<T: !'static>() {} - | ^^^^^^^^^^ negative bounds are not supported + | ^ error: negative bounds are not supported - --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:22 + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:12:24 | LL | pub fn f2<'a, T: Ord + !'a>() {} - | ^^^^^ negative bounds are not supported + | ^ error: negative bounds are not supported - --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:13:16 + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:15:18 | LL | pub fn f3<'a, T: !'a + Ord>() {} - | ^^^^^ negative bounds are not supported + | ^ -error: aborting due to 3 previous errors +error: aborting due to 6 previous errors diff --git a/tests/ui/parser/issues/issue-91461.rs b/tests/ui/parser/issues/issue-91461.rs index 3e3c411c4..80e0940ad 100644 --- a/tests/ui/parser/issues/issue-91461.rs +++ b/tests/ui/parser/issues/issue-91461.rs @@ -1,6 +1,5 @@ fn main() { a(_:b:,) - //~^ ERROR: expected identifier, found reserved identifier `_` - //~| ERROR: expected type, found `,` - //~| ERROR: expected type, found `,` + //~^ ERROR expected identifier, found reserved identifier + //~| ERROR: expected one of } diff --git a/tests/ui/parser/issues/issue-91461.stderr b/tests/ui/parser/issues/issue-91461.stderr index 94fcf1721..27e1b5cdc 100644 --- a/tests/ui/parser/issues/issue-91461.stderr +++ b/tests/ui/parser/issues/issue-91461.stderr @@ -4,28 +4,11 @@ error: expected identifier, found reserved identifier `_` LL | a(_:b:,) | ^ expected identifier, found reserved identifier -error: expected type, found `,` - --> $DIR/issue-91461.rs:2:11 +error: expected one of `)`, `,`, `.`, `?`, or an operator, found `:` + --> $DIR/issue-91461.rs:2:8 | LL | a(_:b:,) - | - -^ expected type - | | | - | | tried to parse a type due to this type ascription - | while parsing this struct - | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>` - = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information - -error: expected type, found `,` - --> $DIR/issue-91461.rs:2:11 - | -LL | a(_:b:,) - | -^ expected type - | | - | tried to parse a type due to this type ascription - | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>` - = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information + | ^ expected one of `)`, `,`, `.`, `?`, or an operator -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/item-kw-case-mismatch.fixed b/tests/ui/parser/item-kw-case-mismatch.fixed index 1794268f2..4b99537fb 100644 --- a/tests/ui/parser/item-kw-case-mismatch.fixed +++ b/tests/ui/parser/item-kw-case-mismatch.fixed @@ -4,31 +4,31 @@ fn main() {} -use std::ptr::read; //~ ERROR keyword `use` is written in a wrong case -use std::ptr::write; //~ ERROR keyword `use` is written in a wrong case +use std::ptr::read; //~ ERROR keyword `use` is written in the wrong case +use std::ptr::write; //~ ERROR keyword `use` is written in the wrong case async fn _a() {} -//~^ ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `fn` is written in the wrong case fn _b() {} -//~^ ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `fn` is written in the wrong case async fn _c() {} -//~^ ERROR keyword `async` is written in a wrong case -//~| ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `async` is written in the wrong case +//~| ERROR keyword `fn` is written in the wrong case async fn _d() {} -//~^ ERROR keyword `async` is written in a wrong case +//~^ ERROR keyword `async` is written in the wrong case const unsafe fn _e() {} -//~^ ERROR keyword `const` is written in a wrong case -//~| ERROR keyword `unsafe` is written in a wrong case -//~| ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `const` is written in the wrong case +//~| ERROR keyword `unsafe` is written in the wrong case +//~| ERROR keyword `fn` is written in the wrong case unsafe extern fn _f() {} -//~^ ERROR keyword `unsafe` is written in a wrong case -//~| ERROR keyword `extern` is written in a wrong case +//~^ ERROR keyword `unsafe` is written in the wrong case +//~| ERROR keyword `extern` is written in the wrong case extern "C" fn _g() {} -//~^ ERROR keyword `extern` is written in a wrong case -//~| ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `extern` is written in the wrong case +//~| ERROR keyword `fn` is written in the wrong case diff --git a/tests/ui/parser/item-kw-case-mismatch.rs b/tests/ui/parser/item-kw-case-mismatch.rs index ac8390efd..b11ec9375 100644 --- a/tests/ui/parser/item-kw-case-mismatch.rs +++ b/tests/ui/parser/item-kw-case-mismatch.rs @@ -4,31 +4,31 @@ fn main() {} -Use std::ptr::read; //~ ERROR keyword `use` is written in a wrong case -USE std::ptr::write; //~ ERROR keyword `use` is written in a wrong case +Use std::ptr::read; //~ ERROR keyword `use` is written in the wrong case +USE std::ptr::write; //~ ERROR keyword `use` is written in the wrong case async Fn _a() {} -//~^ ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `fn` is written in the wrong case Fn _b() {} -//~^ ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `fn` is written in the wrong case aSYNC fN _c() {} -//~^ ERROR keyword `async` is written in a wrong case -//~| ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `async` is written in the wrong case +//~| ERROR keyword `fn` is written in the wrong case Async fn _d() {} -//~^ ERROR keyword `async` is written in a wrong case +//~^ ERROR keyword `async` is written in the wrong case CONST UNSAFE FN _e() {} -//~^ ERROR keyword `const` is written in a wrong case -//~| ERROR keyword `unsafe` is written in a wrong case -//~| ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `const` is written in the wrong case +//~| ERROR keyword `unsafe` is written in the wrong case +//~| ERROR keyword `fn` is written in the wrong case unSAFE EXTern fn _f() {} -//~^ ERROR keyword `unsafe` is written in a wrong case -//~| ERROR keyword `extern` is written in a wrong case +//~^ ERROR keyword `unsafe` is written in the wrong case +//~| ERROR keyword `extern` is written in the wrong case EXTERN "C" FN _g() {} -//~^ ERROR keyword `extern` is written in a wrong case -//~| ERROR keyword `fn` is written in a wrong case +//~^ ERROR keyword `extern` is written in the wrong case +//~| ERROR keyword `fn` is written in the wrong case diff --git a/tests/ui/parser/item-kw-case-mismatch.stderr b/tests/ui/parser/item-kw-case-mismatch.stderr index e66dae825..ba59ea853 100644 --- a/tests/ui/parser/item-kw-case-mismatch.stderr +++ b/tests/ui/parser/item-kw-case-mismatch.stderr @@ -1,82 +1,82 @@ -error: keyword `use` is written in a wrong case +error: keyword `use` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:7:1 | LL | Use std::ptr::read; | ^^^ help: write it in the correct case (notice the capitalization): `use` -error: keyword `use` is written in a wrong case +error: keyword `use` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:8:1 | LL | USE std::ptr::write; | ^^^ help: write it in the correct case: `use` -error: keyword `fn` is written in a wrong case +error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:10:7 | LL | async Fn _a() {} | ^^ help: write it in the correct case (notice the capitalization): `fn` -error: keyword `fn` is written in a wrong case +error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:13:1 | LL | Fn _b() {} | ^^ help: write it in the correct case (notice the capitalization): `fn` -error: keyword `async` is written in a wrong case +error: keyword `async` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:16:1 | LL | aSYNC fN _c() {} | ^^^^^ help: write it in the correct case: `async` -error: keyword `fn` is written in a wrong case +error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:16:7 | LL | aSYNC fN _c() {} | ^^ help: write it in the correct case: `fn` -error: keyword `async` is written in a wrong case +error: keyword `async` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:20:1 | LL | Async fn _d() {} | ^^^^^ help: write it in the correct case: `async` -error: keyword `const` is written in a wrong case +error: keyword `const` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:1 | LL | CONST UNSAFE FN _e() {} | ^^^^^ help: write it in the correct case: `const` -error: keyword `unsafe` is written in a wrong case +error: keyword `unsafe` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:7 | LL | CONST UNSAFE FN _e() {} | ^^^^^^ help: write it in the correct case: `unsafe` -error: keyword `fn` is written in a wrong case +error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:14 | LL | CONST UNSAFE FN _e() {} | ^^ help: write it in the correct case: `fn` -error: keyword `unsafe` is written in a wrong case +error: keyword `unsafe` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:28:1 | LL | unSAFE EXTern fn _f() {} | ^^^^^^ help: write it in the correct case: `unsafe` -error: keyword `extern` is written in a wrong case +error: keyword `extern` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:28:8 | LL | unSAFE EXTern fn _f() {} | ^^^^^^ help: write it in the correct case: `extern` -error: keyword `extern` is written in a wrong case +error: keyword `extern` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:32:1 | LL | EXTERN "C" FN _g() {} | ^^^^^^ help: write it in the correct case: `extern` -error: keyword `fn` is written in a wrong case +error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:32:12 | LL | EXTERN "C" FN _g() {} diff --git a/tests/ui/parser/recover-unticked-labels.stderr b/tests/ui/parser/recover-unticked-labels.stderr index c115dffb1..fbd108ca6 100644 --- a/tests/ui/parser/recover-unticked-labels.stderr +++ b/tests/ui/parser/recover-unticked-labels.stderr @@ -2,13 +2,17 @@ error: expected a label, found an identifier --> $DIR/recover-unticked-labels.rs:5:26 | LL | 'label: loop { break label 0 }; - | ^^^^^ help: labels start with a tick: `'label` + | -^^^^ + | | + | help: labels start with a tick error: expected a label, found an identifier --> $DIR/recover-unticked-labels.rs:6:29 | LL | 'label: loop { continue label }; - | ^^^^^ help: labels start with a tick: `'label` + | -^^^^ + | | + | help: labels start with a tick error[E0425]: cannot find value `label` in this scope --> $DIR/recover-unticked-labels.rs:4:26 diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index e825dfed1..bfc5374ef 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -11,18 +11,24 @@ error: expected `::`, found `:` | LL | use std:fs::File; | ^ help: use double colon + | + = note: import paths are delimited using `::` error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 | LL | use std:collections:HashMap; | ^ help: use double colon + | + = note: import paths are delimited using `::` error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 | LL | use std:collections:HashMap; | ^ help: use double colon + | + = note: import paths are delimited using `::` error: aborting due to 4 previous errors |