diff options
Diffstat (limited to 'tests/ui/parser')
670 files changed, 3368 insertions, 837 deletions
diff --git a/tests/ui/parser/assoc-const-underscore-semantic-fail.rs b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs index d37ce06c5..d37ce06c5 100644 --- a/tests/ui/parser/assoc-const-underscore-semantic-fail.rs +++ b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.rs diff --git a/tests/ui/parser/assoc-const-underscore-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr index 538bf0ec1..538bf0ec1 100644 --- a/tests/ui/parser/assoc-const-underscore-semantic-fail.stderr +++ b/tests/ui/parser/assoc/assoc-const-underscore-semantic-fail.stderr diff --git a/tests/ui/parser/assoc-const-underscore-syntactic-pass.rs b/tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs index 60da408c8..60da408c8 100644 --- a/tests/ui/parser/assoc-const-underscore-syntactic-pass.rs +++ b/tests/ui/parser/assoc/assoc-const-underscore-syntactic-pass.rs diff --git a/tests/ui/parser/assoc-oddities-1.rs b/tests/ui/parser/assoc/assoc-oddities-1.rs index 5914805e5..5914805e5 100644 --- a/tests/ui/parser/assoc-oddities-1.rs +++ b/tests/ui/parser/assoc/assoc-oddities-1.rs diff --git a/tests/ui/parser/assoc-oddities-1.stderr b/tests/ui/parser/assoc/assoc-oddities-1.stderr index acf71b489..0d49d542f 100644 --- a/tests/ui/parser/assoc-oddities-1.stderr +++ b/tests/ui/parser/assoc/assoc-oddities-1.stderr @@ -4,5 +4,5 @@ error: expected one of `.`, `;`, `?`, or `}`, found `[` LL | ..if c { a } else { b }[n]; | ^ expected one of `.`, `;`, `?`, or `}` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/assoc-oddities-2.rs b/tests/ui/parser/assoc/assoc-oddities-2.rs index 3d35aad74..3d35aad74 100644 --- a/tests/ui/parser/assoc-oddities-2.rs +++ b/tests/ui/parser/assoc/assoc-oddities-2.rs diff --git a/tests/ui/parser/assoc-oddities-2.stderr b/tests/ui/parser/assoc/assoc-oddities-2.stderr index d3b90c34c..5ba8eb51b 100644 --- a/tests/ui/parser/assoc-oddities-2.stderr +++ b/tests/ui/parser/assoc/assoc-oddities-2.stderr @@ -4,5 +4,5 @@ error: expected one of `.`, `;`, `?`, or `}`, found `[` LL | x..if c { a } else { b }[n]; | ^ expected one of `.`, `;`, `?`, or `}` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/assoc-static-semantic-fail.rs b/tests/ui/parser/assoc/assoc-static-semantic-fail.rs index 403160f12..403160f12 100644 --- a/tests/ui/parser/assoc-static-semantic-fail.rs +++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.rs diff --git a/tests/ui/parser/assoc-static-semantic-fail.stderr b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr index 8178bd223..8178bd223 100644 --- a/tests/ui/parser/assoc-static-semantic-fail.stderr +++ b/tests/ui/parser/assoc/assoc-static-semantic-fail.stderr diff --git a/tests/ui/parser/assoc-static-syntactic-fail.rs b/tests/ui/parser/assoc/assoc-static-syntactic-fail.rs index 492f2ea16..492f2ea16 100644 --- a/tests/ui/parser/assoc-static-syntactic-fail.rs +++ b/tests/ui/parser/assoc/assoc-static-syntactic-fail.rs diff --git a/tests/ui/parser/assoc-static-syntactic-fail.stderr b/tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr index e97236145..e97236145 100644 --- a/tests/ui/parser/assoc-static-syntactic-fail.stderr +++ b/tests/ui/parser/assoc/assoc-static-syntactic-fail.stderr diff --git a/tests/ui/parser/assoc-type-in-type-arg.rs b/tests/ui/parser/assoc/assoc-type-in-type-arg.rs index 000956ea2..000956ea2 100644 --- a/tests/ui/parser/assoc-type-in-type-arg.rs +++ b/tests/ui/parser/assoc/assoc-type-in-type-arg.rs diff --git a/tests/ui/parser/assoc-type-in-type-arg.stderr b/tests/ui/parser/assoc/assoc-type-in-type-arg.stderr index b637702f2..259a836d0 100644 --- a/tests/ui/parser/assoc-type-in-type-arg.stderr +++ b/tests/ui/parser/assoc/assoc-type-in-type-arg.stderr @@ -4,5 +4,5 @@ error: bounds on associated types do not belong here LL | struct Bar<'a, Item: Tr, <Item as Tr>::TrSubtype: 'a> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ belongs in `where` clause -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/associated-types-project-from-hrtb-explicit.rs b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs index b238a9ca2..b238a9ca2 100644 --- a/tests/ui/parser/associated-types-project-from-hrtb-explicit.rs +++ b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.rs diff --git a/tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr index aa0fa0e3c..aa0fa0e3c 100644 --- a/tests/ui/parser/associated-types-project-from-hrtb-explicit.stderr +++ b/tests/ui/parser/assoc/associated-types-project-from-hrtb-explicit.stderr diff --git a/tests/ui/parser/async-with-nonterminal-block.rs b/tests/ui/parser/async-with-nonterminal-block.rs new file mode 100644 index 000000000..96015fd5d --- /dev/null +++ b/tests/ui/parser/async-with-nonterminal-block.rs @@ -0,0 +1,16 @@ +// check-pass +// edition:2021 + +macro_rules! create_async { + ($body:block) => { + async $body + }; +} + +async fn other() {} + +fn main() { + let y = create_async! {{ + other().await; + }}; +} diff --git a/tests/ui/parser/attr-bad-meta-2.rs b/tests/ui/parser/attribute/attr-bad-meta-2.rs index db612ed88..db612ed88 100644 --- a/tests/ui/parser/attr-bad-meta-2.rs +++ b/tests/ui/parser/attribute/attr-bad-meta-2.rs diff --git a/tests/ui/parser/attr-bad-meta-2.stderr b/tests/ui/parser/attribute/attr-bad-meta-2.stderr index 6fc6fb665..98321827d 100644 --- a/tests/ui/parser/attr-bad-meta-2.stderr +++ b/tests/ui/parser/attribute/attr-bad-meta-2.stderr @@ -4,5 +4,5 @@ error: expected expression, found `]` LL | #[path =] | ^ expected expression -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attr-bad-meta-3.rs b/tests/ui/parser/attribute/attr-bad-meta-3.rs index b51e9f221..b51e9f221 100644 --- a/tests/ui/parser/attr-bad-meta-3.rs +++ b/tests/ui/parser/attribute/attr-bad-meta-3.rs diff --git a/tests/ui/parser/attr-bad-meta-3.stderr b/tests/ui/parser/attribute/attr-bad-meta-3.stderr index 4fa420c79..13eed2e1d 100644 --- a/tests/ui/parser/attr-bad-meta-3.stderr +++ b/tests/ui/parser/attribute/attr-bad-meta-3.stderr @@ -4,5 +4,5 @@ error: expected `]`, found `token` LL | #[path() token] | ^^^^^ expected `]` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attr-bad-meta.rs b/tests/ui/parser/attribute/attr-bad-meta.rs index 8001977f5..8001977f5 100644 --- a/tests/ui/parser/attr-bad-meta.rs +++ b/tests/ui/parser/attribute/attr-bad-meta.rs diff --git a/tests/ui/parser/attr-bad-meta.stderr b/tests/ui/parser/attribute/attr-bad-meta.stderr index 8d65c423c..4ca7d6d9f 100644 --- a/tests/ui/parser/attr-bad-meta.stderr +++ b/tests/ui/parser/attribute/attr-bad-meta.stderr @@ -4,5 +4,5 @@ error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` LL | #[path*] | ^ expected one of `(`, `::`, `=`, `[`, `]`, or `{` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attr-before-eof.rs b/tests/ui/parser/attribute/attr-before-eof.rs index 6af1783e6..6af1783e6 100644 --- a/tests/ui/parser/attr-before-eof.rs +++ b/tests/ui/parser/attribute/attr-before-eof.rs diff --git a/tests/ui/parser/attr-before-eof.stderr b/tests/ui/parser/attribute/attr-before-eof.stderr index a2acb9437..18a9d77bf 100644 --- a/tests/ui/parser/attr-before-eof.stderr +++ b/tests/ui/parser/attribute/attr-before-eof.stderr @@ -4,5 +4,5 @@ error: expected item after attributes LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attr-dangling-in-fn.rs b/tests/ui/parser/attribute/attr-dangling-in-fn.rs index c7c45bafb..c7c45bafb 100644 --- a/tests/ui/parser/attr-dangling-in-fn.rs +++ b/tests/ui/parser/attribute/attr-dangling-in-fn.rs diff --git a/tests/ui/parser/attr-dangling-in-fn.stderr b/tests/ui/parser/attribute/attr-dangling-in-fn.stderr index b1bb3ab3b..c7b948ea8 100644 --- a/tests/ui/parser/attr-dangling-in-fn.stderr +++ b/tests/ui/parser/attribute/attr-dangling-in-fn.stderr @@ -4,5 +4,5 @@ error: expected statement after outer attribute LL | #[foo = "bar"] | ^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attr-dangling-in-mod.rs b/tests/ui/parser/attribute/attr-dangling-in-mod.rs index 261ed3913..261ed3913 100644 --- a/tests/ui/parser/attr-dangling-in-mod.rs +++ b/tests/ui/parser/attribute/attr-dangling-in-mod.rs diff --git a/tests/ui/parser/attr-dangling-in-mod.stderr b/tests/ui/parser/attribute/attr-dangling-in-mod.stderr index 1c892eac0..882400c1d 100644 --- a/tests/ui/parser/attr-dangling-in-mod.stderr +++ b/tests/ui/parser/attribute/attr-dangling-in-mod.stderr @@ -4,5 +4,5 @@ error: expected item after attributes LL | #[foo = "bar"] | ^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.rs b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs index d1950087c..2c402e4c6 100644 --- a/tests/ui/parser/attr-stmt-expr-attr-bad.rs +++ b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.rs @@ -84,15 +84,15 @@ fn main() {} #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } //~^ ERROR inclusive range with no end -//~| ERROR expected one of `=>`, `if`, or `|`, found `#` +//~| ERROR expected one of `,`, `=>`, `if`, `|`, or `}`, found `#` #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } //~^ ERROR inclusive range with no end -//~| ERROR expected one of `=>`, `if`, or `|`, found `#` +//~| ERROR expected one of `,`, `=>`, `if`, `|`, or `}`, found `#` #[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } } //~^ ERROR unexpected token: `#` #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } //~^ ERROR inclusive range with no end -//~| ERROR expected one of `=>`, `if`, or `|`, found `#` +//~| ERROR expected one of `,`, `=>`, `if`, `|`, or `}`, found `#` #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } //~^ ERROR unexpected token: `#` diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr index 96899fd3f..a0e95c5c1 100644 --- a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr +++ b/tests/ui/parser/attribute/attr-stmt-expr-attr-bad.stderr @@ -27,6 +27,7 @@ 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 + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: expected expression, found `)` --> $DIR/attr-stmt-expr-attr-bad.rs:7:44 @@ -364,11 +365,11 @@ 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 `#` +error: expected one of `,`, `=>`, `if`, `|`, or `}`, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:85:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } - | ^ expected one of `=>`, `if`, or `|` + | ^ expected one of `,`, `=>`, `if`, `|`, or `}` error[E0586]: inclusive range with no end --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 @@ -378,11 +379,11 @@ 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 `#` +error: expected one of `,`, `=>`, `if`, `|`, or `}`, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:88:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } - | ^ expected one of `=>`, `if`, or `|` + | ^ expected one of `,`, `=>`, `if`, `|`, or `}` error: unexpected token: `#` --> $DIR/attr-stmt-expr-attr-bad.rs:91:39 @@ -398,11 +399,11 @@ 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 `#` +error: expected one of `,`, `=>`, `if`, `|`, or `}`, found `#` --> $DIR/attr-stmt-expr-attr-bad.rs:93:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } - | ^ expected one of `=>`, `if`, or `|` + | ^ expected one of `,`, `=>`, `if`, `|`, or `}` error: unexpected token: `#` --> $DIR/attr-stmt-expr-attr-bad.rs:97:34 diff --git a/tests/ui/parser/attr-with-a-semicolon.rs b/tests/ui/parser/attribute/attr-with-a-semicolon.rs index 56fe40b91..56fe40b91 100644 --- a/tests/ui/parser/attr-with-a-semicolon.rs +++ b/tests/ui/parser/attribute/attr-with-a-semicolon.rs diff --git a/tests/ui/parser/attr-with-a-semicolon.stderr b/tests/ui/parser/attribute/attr-with-a-semicolon.stderr index 0de3490b8..b77f30fdb 100644 --- a/tests/ui/parser/attr-with-a-semicolon.stderr +++ b/tests/ui/parser/attribute/attr-with-a-semicolon.stderr @@ -10,5 +10,5 @@ LL - #[derive(Debug, Clone)]; LL + #[derive(Debug, Clone)] | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attr.rs b/tests/ui/parser/attribute/attr.rs index 42b2dfde8..42b2dfde8 100644 --- a/tests/ui/parser/attr.rs +++ b/tests/ui/parser/attribute/attr.rs diff --git a/tests/ui/parser/attr.stderr b/tests/ui/parser/attribute/attr.stderr index 7cd0ac224..2e0b16efb 100644 --- a/tests/ui/parser/attr.stderr +++ b/tests/ui/parser/attribute/attr.stderr @@ -13,5 +13,5 @@ LL - #![lang = "foo"] LL + #[lang = "foo"] | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.rs b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.rs index c2cc91d8f..c2cc91d8f 100644 --- a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.rs +++ b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.rs diff --git a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.stderr b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.stderr index 4c5964715..3279e4e59 100644 --- a/tests/ui/parser/attribute-with-no-generics-in-parameter-list.stderr +++ b/tests/ui/parser/attribute/attribute-with-no-generics-in-parameter-list.stderr @@ -4,5 +4,5 @@ error: attribute without generic parameters LL | fn foo<#[attr]>() {} | ^^^^^^^ attributes are only permitted when preceding parameters -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attrs-after-extern-mod.rs b/tests/ui/parser/attribute/attrs-after-extern-mod.rs index e3f0fa0fc..e3f0fa0fc 100644 --- a/tests/ui/parser/attrs-after-extern-mod.rs +++ b/tests/ui/parser/attribute/attrs-after-extern-mod.rs diff --git a/tests/ui/parser/attrs-after-extern-mod.stderr b/tests/ui/parser/attribute/attrs-after-extern-mod.stderr index 135d98457..f2bafa54f 100644 --- a/tests/ui/parser/attrs-after-extern-mod.stderr +++ b/tests/ui/parser/attribute/attrs-after-extern-mod.stderr @@ -8,5 +8,5 @@ LL | #[cfg(stage37)] LL | } | - the item list ends here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.rs b/tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.rs new file mode 100644 index 000000000..d97f24a3d --- /dev/null +++ b/tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.rs @@ -0,0 +1,19 @@ +#![feature(stmt_expr_attributes)] + +fn foo() -> String { + #[cfg(feature = "validation")] + [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() //~ ERROR expected `;`, found `#` + #[cfg(not(feature = "validation"))] + String::new() +} + +fn bar() -> String { + #[attr] + [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() //~ ERROR expected `;`, found `#` + #[attr] //~ ERROR cannot find attribute `attr` in this scope + String::new() +} + +fn main() { + println!("{}", foo()); +} diff --git a/tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.stderr b/tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.stderr new file mode 100644 index 000000000..a71253a5e --- /dev/null +++ b/tests/ui/parser/attribute/multiple-tail-expr-behind-cfg.stderr @@ -0,0 +1,54 @@ +error: expected `;`, found `#` + --> $DIR/multiple-tail-expr-behind-cfg.rs:5:64 + | +LL | #[cfg(feature = "validation")] + | ------------------------------ only `;` terminated statements or tail expressions are allowed after this attribute +LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() + | ^ expected `;` here +LL | #[cfg(not(feature = "validation"))] + | - unexpected token + | +help: add `;` here + | +LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>(); + | + +help: alternatively, consider surrounding the expression with a block + | +LL | { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() } + | + + +help: it seems like you are trying to provide different expressions depending on `cfg`, consider using `if cfg!(..)` + | +LL ~ if cfg!(feature = "validation") { +LL ~ [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() +LL ~ } else if cfg!(not(feature = "validation")) { +LL ~ String::new() +LL + } + | + +error: expected `;`, found `#` + --> $DIR/multiple-tail-expr-behind-cfg.rs:12:64 + | +LL | #[attr] + | ------- only `;` terminated statements or tail expressions are allowed after this attribute +LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() + | ^ expected `;` here +LL | #[attr] + | - unexpected token + | +help: add `;` here + | +LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>(); + | + +help: alternatively, consider surrounding the expression with a block + | +LL | { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() } + | + + + +error: cannot find attribute `attr` in this scope + --> $DIR/multiple-tail-expr-behind-cfg.rs:13:7 + | +LL | #[attr] + | ^^^^ + +error: aborting due to 3 previous errors + diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.rs b/tests/ui/parser/bad-escape-suggest-raw-string.rs index 978b92cbc..06df82d28 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.rs +++ b/tests/ui/parser/bad-escape-suggest-raw-string.rs @@ -2,6 +2,6 @@ fn main() { let ok = r"ab\[c"; let bad = "ab\[c"; //~^ ERROR unknown character escape: `[` - //~| HELP for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals> + //~| HELP for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> //~| HELP if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal } diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index fc34bd328..6dd4ad512 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -4,11 +4,11 @@ error: unknown character escape: `[` LL | let bad = "ab\[c"; | ^ unknown character escape | - = help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals> + = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | LL | let bad = r"ab\[c"; | ~~~~~~~~ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-interpolated-block.stderr b/tests/ui/parser/bad-interpolated-block.stderr index 2a0999afd..651036c51 100644 --- a/tests/ui/parser/bad-interpolated-block.stderr +++ b/tests/ui/parser/bad-interpolated-block.stderr @@ -10,6 +10,10 @@ LL | m!({}); | ------ in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: wrap this in another block + | +LL | 'lab: { $b }; + | + + error: cannot use a `block` macro fragment here --> $DIR/bad-interpolated-block.rs:6:16 @@ -23,6 +27,10 @@ LL | m!({}); | ------ in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: wrap this in another block + | +LL | unsafe { $b }; + | + + error: cannot use a `block` macro fragment here --> $DIR/bad-interpolated-block.rs:7:23 @@ -34,6 +42,10 @@ LL | m!({}); | ------ in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: wrap this in another block + | +LL | |x: u8| -> () { $b }; + | + + error: aborting due to 3 previous errors diff --git a/tests/ui/parser/bad-let-as-field.stderr b/tests/ui/parser/bad-let-as-field.stderr index 57def42b1..8568036d0 100644 --- a/tests/ui/parser/bad-let-as-field.stderr +++ b/tests/ui/parser/bad-let-as-field.stderr @@ -11,5 +11,5 @@ help: escape `let` to use it as an identifier LL | r#let: i32, | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-let-else-statement.rs b/tests/ui/parser/bad-let-else-statement.rs new file mode 100644 index 000000000..7b927c89b --- /dev/null +++ b/tests/ui/parser/bad-let-else-statement.rs @@ -0,0 +1,164 @@ +#![feature(inline_const)] +#![feature(yeet_expr)] +#![allow(incomplete_features)] // Necessary for now, while explicit_tail_calls is incomplete +#![feature(explicit_tail_calls)] + +fn a() { + let foo = { + 1 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn b() { + let foo = for i in 1..2 { + break; + } else { + //~^ ERROR `for...else` loops are not supported + return; + }; +} + +fn c() { + let foo = if true { + 1 + } else { + 0 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn d() { + let foo = loop { + break; + } else { + //~^ ERROR loop...else` loops are not supported + return; + }; +} + +fn e() { + let foo = match true { + true => 1, + false => 0 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +struct X {a: i32} +fn f() { + let foo = X { + a: 1 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn g() { + let foo = while false { + break; + } else { + //~^ ERROR `while...else` loops are not supported + return; + }; +} + +fn h() { + let foo = const { + 1 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn i() { + let foo = &{ + 1 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn j() { + let bar = 0; + let foo = bar = { + 1 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn k() { + let foo = 1 + { + 1 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn l() { + let foo = 1..{ + 1 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn m() { + let foo = return { + () + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn n() { + let foo = -{ + 1 + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn o() -> Result<(), ()> { + let foo = do yeet { + () + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return Ok(()); + }; +} + +fn p() { + let foo = become { + () + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn q() { + let foo = |x: i32| { + x + } else { + //~^ ERROR right curly brace `}` before `else` in a `let...else` statement not allowed + return; + }; +} + +fn main() {} diff --git a/tests/ui/parser/bad-let-else-statement.stderr b/tests/ui/parser/bad-let-else-statement.stderr new file mode 100644 index 000000000..7cbda25e4 --- /dev/null +++ b/tests/ui/parser/bad-let-else-statement.stderr @@ -0,0 +1,232 @@ +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:9:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = ({ +LL | 1 +LL ~ }) else { + | + +error: `for...else` loops are not supported + --> $DIR/bad-let-else-statement.rs:18:7 + | +LL | let foo = for i in 1..2 { + | --- `else` is attached to this loop +LL | break; +LL | } else { + | _______^ +LL | | +LL | | return; +LL | | }; + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:29:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = (if true { +LL | 1 +LL | } else { +LL | 0 +LL ~ }) else { + | + +error: `loop...else` loops are not supported + --> $DIR/bad-let-else-statement.rs:38:7 + | +LL | let foo = loop { + | ---- `else` is attached to this loop +LL | break; +LL | } else { + | _______^ +LL | | +LL | | return; +LL | | }; + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:48:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = (match true { +LL | true => 1, +LL | false => 0 +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:58:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = (X { +LL | a: 1 +LL ~ }) else { + | + +error: `while...else` loops are not supported + --> $DIR/bad-let-else-statement.rs:67:7 + | +LL | let foo = while false { + | ----- `else` is attached to this loop +LL | break; +LL | } else { + | _______^ +LL | | +LL | | return; +LL | | }; + | |_____^ + | + = note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:76:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = (const { +LL | 1 +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:85:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = &({ +LL | 1 +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:95:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = bar = ({ +LL | 1 +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:104:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = 1 + ({ +LL | 1 +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:113:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = 1..({ +LL | 1 +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:122:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = return ({ +LL | () +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:131:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = -({ +LL | 1 +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:140:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = do yeet ({ +LL | () +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:149:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = become ({ +LL | () +LL ~ }) else { + | + +error: right curly brace `}` before `else` in a `let...else` statement not allowed + --> $DIR/bad-let-else-statement.rs:158:5 + | +LL | } else { + | ^ + | +help: wrap the expression in parentheses + | +LL ~ let foo = |x: i32| ({ +LL | x +LL ~ }) else { + | + +error: aborting due to 17 previous errors + diff --git a/tests/ui/parser/bad-lit-suffixes.rs b/tests/ui/parser/bad-lit-suffixes.rs index 8cb9ef7e0..c614f4938 100644 --- a/tests/ui/parser/bad-lit-suffixes.rs +++ b/tests/ui/parser/bad-lit-suffixes.rs @@ -28,11 +28,12 @@ fn main() { } #[rustc_dummy = "string"suffix] -//~^ ERROR unexpected expression: `"string"suffix` +//~^ ERROR suffixes on string literals are invalid fn f() {} #[must_use = "string"suffix] -//~^ ERROR unexpected expression: `"string"suffix` +//~^ ERROR suffixes on string literals are invalid +//~| ERROR malformed `must_use` attribute input fn g() {} #[link(name = "string"suffix)] diff --git a/tests/ui/parser/bad-lit-suffixes.stderr b/tests/ui/parser/bad-lit-suffixes.stderr index 756f99ab1..b5dacdf7d 100644 --- a/tests/ui/parser/bad-lit-suffixes.stderr +++ b/tests/ui/parser/bad-lit-suffixes.stderr @@ -10,26 +10,39 @@ error: suffixes on string literals are invalid LL | "C"suffix | ^^^^^^^^^ invalid suffix `suffix` -error: unexpected expression: `"string"suffix` +error: suffixes on string literals are invalid --> $DIR/bad-lit-suffixes.rs:30:17 | LL | #[rustc_dummy = "string"suffix] - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ invalid suffix `suffix` -error: unexpected expression: `"string"suffix` +error: suffixes on string literals are invalid --> $DIR/bad-lit-suffixes.rs:34:14 | LL | #[must_use = "string"suffix] - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ invalid suffix `suffix` + +error: malformed `must_use` attribute input + --> $DIR/bad-lit-suffixes.rs:34:1 + | +LL | #[must_use = "string"suffix] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: the following are the possible correct uses + | +LL | #[must_use = "reason"] + | +LL | #[must_use] + | error: suffixes on string literals are invalid - --> $DIR/bad-lit-suffixes.rs:38:15 + --> $DIR/bad-lit-suffixes.rs:39:15 | LL | #[link(name = "string"suffix)] | ^^^^^^^^^^^^^^ invalid suffix `suffix` error: invalid suffix `suffix` for number literal - --> $DIR/bad-lit-suffixes.rs:42:41 + --> $DIR/bad-lit-suffixes.rs:43:41 | LL | #[rustc_layout_scalar_valid_range_start(0suffix)] | ^^^^^^^ invalid suffix `suffix` @@ -136,5 +149,5 @@ LL | 1.0e10suffix; | = help: valid suffixes are `f32` and `f64` -error: aborting due to 20 previous errors +error: aborting due to 21 previous errors diff --git a/tests/ui/parser/bad-match.stderr b/tests/ui/parser/bad-match.stderr index 13784c409..8e7878c2b 100644 --- a/tests/ui/parser/bad-match.stderr +++ b/tests/ui/parser/bad-match.stderr @@ -4,5 +4,5 @@ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `x` LL | let isize x = 5; | ^ expected one of `:`, `;`, `=`, `@`, or `|` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-name.stderr b/tests/ui/parser/bad-name.stderr index a36b67794..e133d4e48 100644 --- a/tests/ui/parser/bad-name.stderr +++ b/tests/ui/parser/bad-name.stderr @@ -4,5 +4,5 @@ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `.` LL | let x.y::<isize>.z foo; | ^ expected one of `:`, `;`, `=`, `@`, or `|` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-pointer-type.stderr b/tests/ui/parser/bad-pointer-type.stderr index b7225ca88..f409d4d99 100644 --- a/tests/ui/parser/bad-pointer-type.stderr +++ b/tests/ui/parser/bad-pointer-type.stderr @@ -6,10 +6,10 @@ LL | fn foo(_: *()) { | help: add `mut` or `const` here | -LL | fn foo(_: *const ()) { - | +++++ LL | fn foo(_: *mut ()) { | +++ +LL | fn foo(_: *const ()) { + | +++++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-struct-following-where.stderr b/tests/ui/parser/bad-struct-following-where.stderr index bb79776dc..f27efc95f 100644 --- a/tests/ui/parser/bad-struct-following-where.stderr +++ b/tests/ui/parser/bad-struct-following-where.stderr @@ -4,5 +4,5 @@ error: expected `{` after struct name, found `!` LL | struct A where T: Sized ! | ^ expected `{` after struct name -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-value-ident-false.stderr b/tests/ui/parser/bad-value-ident-false.stderr index 30c05ecf3..971219496 100644 --- a/tests/ui/parser/bad-value-ident-false.stderr +++ b/tests/ui/parser/bad-value-ident-false.stderr @@ -9,5 +9,5 @@ help: escape `false` to use it as an identifier LL | fn r#false() { } | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-value-ident-true.stderr b/tests/ui/parser/bad-value-ident-true.stderr index 74137fa70..b7b73e5f8 100644 --- a/tests/ui/parser/bad-value-ident-true.stderr +++ b/tests/ui/parser/bad-value-ident-true.stderr @@ -9,5 +9,5 @@ help: escape `true` to use it as an identifier LL | fn r#true() { } | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/better-expected.stderr b/tests/ui/parser/better-expected.stderr index 21bf8d19a..6cb9a4960 100644 --- a/tests/ui/parser/better-expected.stderr +++ b/tests/ui/parser/better-expected.stderr @@ -6,5 +6,5 @@ LL | let x: [isize 3]; | | | while parsing the type for `x` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bind-struct-early-modifiers.stderr b/tests/ui/parser/bind-struct-early-modifiers.stderr index b35762a88..6b366a995 100644 --- a/tests/ui/parser/bind-struct-early-modifiers.stderr +++ b/tests/ui/parser/bind-struct-early-modifiers.stderr @@ -6,5 +6,5 @@ LL | Foo { ref x: ref x } => {}, | | | while parsing the fields for this pattern -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bound-single-question-mark.stderr b/tests/ui/parser/bound-single-question-mark.stderr index 82937a517..f339c2022 100644 --- a/tests/ui/parser/bound-single-question-mark.stderr +++ b/tests/ui/parser/bound-single-question-mark.stderr @@ -4,5 +4,5 @@ error: expected identifier, found `>` LL | fn f<T: ?>() {} | ^ expected identifier -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bounds-lifetime-1.stderr b/tests/ui/parser/bounds-lifetime-1.stderr index 000e84f63..101704f64 100644 --- a/tests/ui/parser/bounds-lifetime-1.stderr +++ b/tests/ui/parser/bounds-lifetime-1.stderr @@ -4,5 +4,5 @@ error: expected one of `,`, `:`, or `>`, found `'b` LL | type A = for<'a 'b> fn(); | ^^ expected one of `,`, `:`, or `>` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bounds-lifetime-2.stderr b/tests/ui/parser/bounds-lifetime-2.stderr index dd3e69c11..f39cc604e 100644 --- a/tests/ui/parser/bounds-lifetime-2.stderr +++ b/tests/ui/parser/bounds-lifetime-2.stderr @@ -4,5 +4,5 @@ error: expected one of `,`, `:`, or `>`, found `+` LL | type A = for<'a + 'b> fn(); | ^ expected one of `,`, `:`, or `>` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bounds-lifetime-where-1.stderr b/tests/ui/parser/bounds-lifetime-where-1.stderr index b6bd86693..f79b4fa03 100644 --- a/tests/ui/parser/bounds-lifetime-where-1.stderr +++ b/tests/ui/parser/bounds-lifetime-where-1.stderr @@ -4,5 +4,5 @@ error: expected `:`, found `;` LL | type A where 'a; | ^ expected `:` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bounds-lifetime-where.stderr b/tests/ui/parser/bounds-lifetime-where.stderr index 785a1fb67..9dd963afc 100644 --- a/tests/ui/parser/bounds-lifetime-where.stderr +++ b/tests/ui/parser/bounds-lifetime-where.stderr @@ -4,5 +4,5 @@ error: expected one of `;`, `=`, `where`, lifetime, or type, found `,` LL | type A where , = u8; | ^ expected one of `;`, `=`, `where`, lifetime, or type -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bounds-lifetime.stderr b/tests/ui/parser/bounds-lifetime.stderr index e47a21d89..26a3e7863 100644 --- a/tests/ui/parser/bounds-lifetime.stderr +++ b/tests/ui/parser/bounds-lifetime.stderr @@ -4,5 +4,5 @@ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,` LL | type A = for<,> fn(); | ^ expected one of `#`, `>`, `const`, identifier, or lifetime -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/bounds-type-where.stderr b/tests/ui/parser/bounds-type-where.stderr index 5636ee75c..709d31430 100644 --- a/tests/ui/parser/bounds-type-where.stderr +++ b/tests/ui/parser/bounds-type-where.stderr @@ -4,5 +4,5 @@ error: expected one of `!`, `(`, `+`, `::`, `:`, `<`, `==`, or `=`, found `,` LL | type A where T, = u8; | ^ expected one of 8 possible tokens -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/brace-in-let-chain.rs b/tests/ui/parser/brace-in-let-chain.rs new file mode 100644 index 000000000..1f34c73a2 --- /dev/null +++ b/tests/ui/parser/brace-in-let-chain.rs @@ -0,0 +1,58 @@ +// issue #117766 + +#![feature(let_chains)] +fn main() { + if let () = () + && let () = () { //~ERROR: found a `{` in the middle of a let-chain + && let () = () + { + } +} + +fn quux() { + while let () = () + && let () = () { //~ERROR: found a `{` in the middle of a let-chain + && let () = () + { + } +} + +fn foobar() { + while false {} + { + && let () = () +} + +fn fubar() { + while false { + { + && let () = () + } +} + +fn qux() { + let foo = false; + match foo { + _ if foo => { + && let () = () + _ => {} + } +} + +fn foo() { + { + && let () = () +} + +fn bar() { + if false {} + { + && let () = () +} + +fn baz() { + if false { + { + && let () = () + } +} //~ERROR: this file contains an unclosed delimiter diff --git a/tests/ui/parser/brace-in-let-chain.stderr b/tests/ui/parser/brace-in-let-chain.stderr new file mode 100644 index 000000000..7182d86d0 --- /dev/null +++ b/tests/ui/parser/brace-in-let-chain.stderr @@ -0,0 +1,65 @@ +error: this file contains an unclosed delimiter + --> $DIR/brace-in-let-chain.rs:58:54 + | +LL | fn main() { + | - unclosed delimiter +... +LL | fn quux() { + | - unclosed delimiter +... +LL | fn foobar() { + | - unclosed delimiter +... +LL | fn fubar() { + | - unclosed delimiter +... +LL | fn qux() { + | - unclosed delimiter +... +LL | fn foo() { + | - unclosed delimiter +... +LL | fn bar() { + | - unclosed delimiter +... +LL | fn baz() { + | - unclosed delimiter +LL | if false { +LL | { + | - this delimiter might not be properly closed... +LL | && let () = () +LL | } + | - ...as it matches this but it has different indentation +LL | } + | ^ + +error: found a `{` in the middle of a let-chain + --> $DIR/brace-in-let-chain.rs:14:24 + | +LL | && let () = () { + | ^ +LL | && let () = () + | ------ you might have meant to continue the let-chain here + | +help: consider removing this brace to parse the `let` as part of the same chain + | +LL - && let () = () { +LL + && let () = () + | + +error: found a `{` in the middle of a let-chain + --> $DIR/brace-in-let-chain.rs:6:24 + | +LL | && let () = () { + | ^ +LL | && let () = () + | ------ you might have meant to continue the let-chain here + | +help: consider removing this brace to parse the `let` as part of the same chain + | +LL - && let () = () { +LL + && let () = () + | + +error: aborting due to 3 previous errors + diff --git a/tests/ui/parser/break-in-unlabeled-block-in-macro.rs b/tests/ui/parser/break-in-unlabeled-block-in-macro.rs new file mode 100644 index 000000000..eecc0026b --- /dev/null +++ b/tests/ui/parser/break-in-unlabeled-block-in-macro.rs @@ -0,0 +1,43 @@ +macro_rules! foo { + () => { + break (); //~ ERROR `break` outside of a loop or labeled block + }; + ($e: expr) => { + break $e; //~ ERROR `break` outside of a loop or labeled block + }; + (stmt $s: stmt) => { + $s + }; + (@ $e: expr) => { + { break $e; } //~ ERROR `break` outside of a loop or labeled block + }; + (=> $s: stmt) => { + { $s } + }; +} + +fn main() { + { + foo!(); + } + { + foo!(()); + } + { + foo!(stmt break ()); //~ ERROR `break` outside of a loop or labeled block + } + { + foo!(@ ()); + } + { + foo!(=> break ()); //~ ERROR `break` outside of a loop or labeled block + } + { + macro_rules! bar { + () => { + break () //~ ERROR `break` outside of a loop or labeled block + }; + } + bar!() + } +} diff --git a/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr b/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr new file mode 100644 index 000000000..9407e8ac0 --- /dev/null +++ b/tests/ui/parser/break-in-unlabeled-block-in-macro.stderr @@ -0,0 +1,69 @@ +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-in-unlabeled-block-in-macro.rs:3:9 + | +LL | break (); + | ^^^^^^^^ cannot `break` outside of a loop or labeled block +... +LL | foo!(); + | ------ in this macro invocation + | + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-in-unlabeled-block-in-macro.rs:6:9 + | +LL | break $e; + | ^^^^^^^^ cannot `break` outside of a loop or labeled block +... +LL | foo!(()); + | -------- in this macro invocation + | + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-in-unlabeled-block-in-macro.rs:27:19 + | +LL | foo!(stmt break ()); + | ^^^^^^^^ cannot `break` outside of a loop or labeled block + | +help: consider labeling this block to be able to break within it + | +LL ~ 'block: { +LL ~ foo!(stmt break 'block ()); + | + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-in-unlabeled-block-in-macro.rs:12:11 + | +LL | { break $e; } + | ^^^^^^^^ cannot `break` outside of a loop or labeled block +... +LL | foo!(@ ()); + | ---------- in this macro invocation + | + = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider labeling this block to be able to break within it + | +LL | 'block: { break 'block $e; } + | +++++++ ++++++ + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-in-unlabeled-block-in-macro.rs:33:17 + | +LL | foo!(=> break ()); + | ^^^^^^^^ cannot `break` outside of a loop or labeled block + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-in-unlabeled-block-in-macro.rs:38:17 + | +LL | break () + | ^^^^^^^^ cannot `break` outside of a loop or labeled block +... +LL | bar!() + | ------ in this macro invocation + | + = note: this error originates in the macro `bar` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/parser/break-in-unlabeled-block.fixed b/tests/ui/parser/break-in-unlabeled-block.fixed new file mode 100644 index 000000000..088562325 --- /dev/null +++ b/tests/ui/parser/break-in-unlabeled-block.fixed @@ -0,0 +1,11 @@ +// run-rustfix +fn main() { + 'block: { + break 'block (); //~ ERROR `break` outside of a loop or labeled block + } + { + 'block: { + break 'block (); //~ ERROR `break` outside of a loop or labeled block + } + } +} diff --git a/tests/ui/parser/break-in-unlabeled-block.rs b/tests/ui/parser/break-in-unlabeled-block.rs new file mode 100644 index 000000000..3e5587e9f --- /dev/null +++ b/tests/ui/parser/break-in-unlabeled-block.rs @@ -0,0 +1,11 @@ +// run-rustfix +fn main() { + { + break (); //~ ERROR `break` outside of a loop or labeled block + } + { + { + break (); //~ ERROR `break` outside of a loop or labeled block + } + } +} diff --git a/tests/ui/parser/break-in-unlabeled-block.stderr b/tests/ui/parser/break-in-unlabeled-block.stderr new file mode 100644 index 000000000..632cca80d --- /dev/null +++ b/tests/ui/parser/break-in-unlabeled-block.stderr @@ -0,0 +1,27 @@ +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-in-unlabeled-block.rs:4:9 + | +LL | break (); + | ^^^^^^^^ cannot `break` outside of a loop or labeled block + | +help: consider labeling this block to be able to break within it + | +LL ~ 'block: { +LL ~ break 'block (); + | + +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-in-unlabeled-block.rs:8:13 + | +LL | break (); + | ^^^^^^^^ cannot `break` outside of a loop or labeled block + | +help: consider labeling this block to be able to break within it + | +LL ~ 'block: { +LL ~ break 'block (); + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index efa55ae05..5b414c892 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -4,7 +4,7 @@ error: unknown byte escape: `f` LL | static FOO: u8 = b'\f'; | ^ unknown byte escape | - = help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals> + = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> error: unknown byte escape: `f` --> $DIR/byte-literals.rs:6:8 @@ -12,7 +12,7 @@ error: unknown byte escape: `f` LL | b'\f'; | ^ unknown byte escape | - = help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals> + = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> error: invalid character in numeric character escape: `Z` --> $DIR/byte-literals.rs:7:10 diff --git a/tests/ui/parser/byte-string-literals.stderr b/tests/ui/parser/byte-string-literals.stderr index 5b96cc3d1..655b6998e 100644 --- a/tests/ui/parser/byte-string-literals.stderr +++ b/tests/ui/parser/byte-string-literals.stderr @@ -4,7 +4,7 @@ error: unknown byte escape: `f` LL | static FOO: &'static [u8] = b"\f"; | ^ unknown byte escape | - = help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals> + = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> error: unknown byte escape: `f` --> $DIR/byte-string-literals.rs:4:8 @@ -12,7 +12,7 @@ error: unknown byte escape: `f` LL | b"\f"; | ^ unknown byte escape | - = help: for more information, visit <https://static.rust-lang.org/doc/master/reference.html#literals> + = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> error: invalid character in numeric character escape: `Z` --> $DIR/byte-string-literals.rs:5:10 diff --git a/tests/ui/parser/can-begin-expr-check.stderr b/tests/ui/parser/can-begin-expr-check.stderr index 9569ababa..247009be0 100644 --- a/tests/ui/parser/can-begin-expr-check.stderr +++ b/tests/ui/parser/can-begin-expr-check.stderr @@ -4,5 +4,5 @@ error: expected one of `;`, `}`, or an operator, found keyword `enum` LL | return enum; | ^^^^ expected one of `;`, `}`, or an operator -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/char/whitespace-character-literal.stderr b/tests/ui/parser/char/whitespace-character-literal.stderr index d73de41a8..3bd048f8f 100644 --- a/tests/ui/parser/char/whitespace-character-literal.stderr +++ b/tests/ui/parser/char/whitespace-character-literal.stderr @@ -12,5 +12,5 @@ note: there are non-printing characters, the full sequence is `\u{200a}x\u{200b} LL | let _hair_space_around = ' x​'; | ^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/class-implements-bad-trait.stderr b/tests/ui/parser/class-implements-bad-trait.stderr index 3a4dea95d..5290e3594 100644 --- a/tests/ui/parser/class-implements-bad-trait.stderr +++ b/tests/ui/parser/class-implements-bad-trait.stderr @@ -4,5 +4,5 @@ error: expected one of `!` or `::`, found `cat` LL | class cat : nonexistent { | ^^^ expected one of `!` or `::` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/closure-return-syntax.stderr b/tests/ui/parser/closure-return-syntax.stderr index 3d16a2067..eb8428854 100644 --- a/tests/ui/parser/closure-return-syntax.stderr +++ b/tests/ui/parser/closure-return-syntax.stderr @@ -9,5 +9,5 @@ help: try placing this code inside a block LL | let x = || -> i32 { 22 }; | + + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/column-offset-1-based.stderr b/tests/ui/parser/column-offset-1-based.stderr index 766d72a0a..d837466d9 100644 --- a/tests/ui/parser/column-offset-1-based.stderr +++ b/tests/ui/parser/column-offset-1-based.stderr @@ -4,5 +4,5 @@ error: expected one of `!` or `[`, found `<eof>` LL | # | ^ expected one of `!` or `[` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/deep-unmatched-angle-brackets.rs b/tests/ui/parser/deep-unmatched-angle-brackets.rs new file mode 100644 index 000000000..f8d490e1c --- /dev/null +++ b/tests/ui/parser/deep-unmatched-angle-brackets.rs @@ -0,0 +1,17 @@ +trait Mul<T> { + type Output; +} +trait Matrix: Mul<<Self as Matrix>::Row, Output = ()> { + type Row; + type Transpose: Matrix<Row = Self::Row>; +} +fn is_mul<S, T: Mul<S, Output = ()>>() {} +fn f<T: Matrix>() { + is_mul::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::< + f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::< + f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::< + f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f:: + <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>(); + //~^ ERROR expected one of `!`, `+`, `,`, `::`, or `>`, found `(` +} +fn main() {} diff --git a/tests/ui/parser/deep-unmatched-angle-brackets.stderr b/tests/ui/parser/deep-unmatched-angle-brackets.stderr new file mode 100644 index 000000000..7c9033f2f --- /dev/null +++ b/tests/ui/parser/deep-unmatched-angle-brackets.stderr @@ -0,0 +1,13 @@ +error: expected one of `!`, `+`, `,`, `::`, or `>`, found `(` + --> $DIR/deep-unmatched-angle-brackets.rs:14:63 + | +LL | <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>(); + | ^ expected one of `!`, `+`, `,`, `::`, or `>` + | +help: you might have meant to end the type parameters here + | +LL | <f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<f::<>>(); + | + + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/default-unmatched.stderr b/tests/ui/parser/default-unmatched.stderr index 331e003f6..de142411d 100644 --- a/tests/ui/parser/default-unmatched.stderr +++ b/tests/ui/parser/default-unmatched.stderr @@ -11,6 +11,8 @@ error: expected item, found reserved keyword `do` | LL | default do | ^^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 2 previous errors diff --git a/tests/ui/parser/trait-item-with-defaultness-fail-semantic.rs b/tests/ui/parser/defaultness-invalid-places-fail-semantic.rs index f2d97b7ba..bff53f66e 100644 --- a/tests/ui/parser/trait-item-with-defaultness-fail-semantic.rs +++ b/tests/ui/parser/defaultness-invalid-places-fail-semantic.rs @@ -10,3 +10,7 @@ trait X { default fn f1(); //~ ERROR `default` is only allowed on items in trait impls default fn f2() {} //~ ERROR `default` is only allowed on items in trait impls } + +default const E: u8 = 0; //~ ERROR `default` is only allowed on items in trait impls +default type F = (); //~ ERROR `default` is only allowed on items in trait impls +default fn h() {} //~ ERROR `default` is only allowed on items in trait impls diff --git a/tests/ui/parser/trait-item-with-defaultness-fail-semantic.stderr b/tests/ui/parser/defaultness-invalid-places-fail-semantic.stderr index be858cd65..41fad3a5d 100644 --- a/tests/ui/parser/trait-item-with-defaultness-fail-semantic.stderr +++ b/tests/ui/parser/defaultness-invalid-places-fail-semantic.stderr @@ -1,5 +1,5 @@ error: `default` is only allowed on items in trait impls - --> $DIR/trait-item-with-defaultness-fail-semantic.rs:6:5 + --> $DIR/defaultness-invalid-places-fail-semantic.rs:6:5 | LL | default const A: u8; | -------^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | default const A: u8; | `default` because of this error: `default` is only allowed on items in trait impls - --> $DIR/trait-item-with-defaultness-fail-semantic.rs:7:5 + --> $DIR/defaultness-invalid-places-fail-semantic.rs:7:5 | LL | default const B: u8 = 0; | -------^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | default const B: u8 = 0; | `default` because of this error: `default` is only allowed on items in trait impls - --> $DIR/trait-item-with-defaultness-fail-semantic.rs:8:5 + --> $DIR/defaultness-invalid-places-fail-semantic.rs:8:5 | LL | default type D; | -------^^^^^^^^ @@ -23,7 +23,7 @@ LL | default type D; | `default` because of this error: `default` is only allowed on items in trait impls - --> $DIR/trait-item-with-defaultness-fail-semantic.rs:9:5 + --> $DIR/defaultness-invalid-places-fail-semantic.rs:9:5 | LL | default type C: Ord; | -------^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | default type C: Ord; | `default` because of this error: `default` is only allowed on items in trait impls - --> $DIR/trait-item-with-defaultness-fail-semantic.rs:10:5 + --> $DIR/defaultness-invalid-places-fail-semantic.rs:10:5 | LL | default fn f1(); | -------^^^^^^^^^ @@ -39,15 +39,39 @@ LL | default fn f1(); | `default` because of this error: `default` is only allowed on items in trait impls - --> $DIR/trait-item-with-defaultness-fail-semantic.rs:11:5 + --> $DIR/defaultness-invalid-places-fail-semantic.rs:11:5 | LL | default fn f2() {} | -------^^^^^^^^ | | | `default` because of this +error: `default` is only allowed on items in trait impls + --> $DIR/defaultness-invalid-places-fail-semantic.rs:14:1 + | +LL | default const E: u8 = 0; + | -------^^^^^^^^^^^^^^^^^ + | | + | `default` because of this + +error: `default` is only allowed on items in trait impls + --> $DIR/defaultness-invalid-places-fail-semantic.rs:15:1 + | +LL | default type F = (); + | -------^^^^^^^^^^^^^ + | | + | `default` because of this + +error: `default` is only allowed on items in trait impls + --> $DIR/defaultness-invalid-places-fail-semantic.rs:16:1 + | +LL | default fn h() {} + | -------^^^^^^^ + | | + | `default` because of this + warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/trait-item-with-defaultness-fail-semantic.rs:1:12 + --> $DIR/defaultness-invalid-places-fail-semantic.rs:1:12 | LL | #![feature(specialization)] | ^^^^^^^^^^^^^^ @@ -56,5 +80,5 @@ LL | #![feature(specialization)] = 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 +error: aborting due to 9 previous errors; 1 warning emitted diff --git a/tests/ui/parser/deli-ident-issue-1.stderr b/tests/ui/parser/deli-ident-issue-1.stderr index eb5073e14..78f5d7b63 100644 --- a/tests/ui/parser/deli-ident-issue-1.stderr +++ b/tests/ui/parser/deli-ident-issue-1.stderr @@ -13,5 +13,5 @@ LL | } LL | fn main() { } | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/enum-2.stderr b/tests/ui/parser/diff-markers/enum-2.stderr index 63da5c2a6..20e551c2f 100644 --- a/tests/ui/parser/diff-markers/enum-2.stderr +++ b/tests/ui/parser/diff-markers/enum-2.stderr @@ -17,5 +17,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/enum.stderr b/tests/ui/parser/diff-markers/enum.stderr index abbf3fb41..be94331dc 100644 --- a/tests/ui/parser/diff-markers/enum.stderr +++ b/tests/ui/parser/diff-markers/enum.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/fn-arg.stderr b/tests/ui/parser/diff-markers/fn-arg.stderr index 933a20641..aabcb826c 100644 --- a/tests/ui/parser/diff-markers/fn-arg.stderr +++ b/tests/ui/parser/diff-markers/fn-arg.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/item-with-attr.stderr b/tests/ui/parser/diff-markers/item-with-attr.stderr index 850e2368e..eefb2792e 100644 --- a/tests/ui/parser/diff-markers/item-with-attr.stderr +++ b/tests/ui/parser/diff-markers/item-with-attr.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/item.stderr b/tests/ui/parser/diff-markers/item.stderr index 9ab3631a6..a3092ebfc 100644 --- a/tests/ui/parser/diff-markers/item.stderr +++ b/tests/ui/parser/diff-markers/item.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/statement.stderr b/tests/ui/parser/diff-markers/statement.stderr index 7ca2495b8..c6c6cae87 100644 --- a/tests/ui/parser/diff-markers/statement.stderr +++ b/tests/ui/parser/diff-markers/statement.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/struct-expr.stderr b/tests/ui/parser/diff-markers/struct-expr.stderr index d70476a98..bdea8c841 100644 --- a/tests/ui/parser/diff-markers/struct-expr.stderr +++ b/tests/ui/parser/diff-markers/struct-expr.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/struct.stderr b/tests/ui/parser/diff-markers/struct.stderr index cc0b3da66..749941290 100644 --- a/tests/ui/parser/diff-markers/struct.stderr +++ b/tests/ui/parser/diff-markers/struct.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/trait-item.stderr b/tests/ui/parser/diff-markers/trait-item.stderr index cdc19f8e0..f01bbe8ba 100644 --- a/tests/ui/parser/diff-markers/trait-item.stderr +++ b/tests/ui/parser/diff-markers/trait-item.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/tuple-struct.stderr b/tests/ui/parser/diff-markers/tuple-struct.stderr index d673db898..8dae123c9 100644 --- a/tests/ui/parser/diff-markers/tuple-struct.stderr +++ b/tests/ui/parser/diff-markers/tuple-struct.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs new file mode 100644 index 000000000..da1774ace --- /dev/null +++ b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.rs @@ -0,0 +1,9 @@ +macro_rules! foo { +<<<<<<< HEAD + //~^ ERROR encountered diff marker + () { +======= + () { // +>>>>>>> 7a4f13c blah blah blah + } +} diff --git a/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr new file mode 100644 index 000000000..6995b8e6f --- /dev/null +++ b/tests/ui/parser/diff-markers/unclosed-delims-in-macro.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/unclosed-delims-in-macro.rs:2:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +... +LL | ======= + | ------- +LL | () { // +LL | >>>>>>> 7a4f13c blah blah blah + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/diff-markers/unclosed-delims.rs b/tests/ui/parser/diff-markers/unclosed-delims.rs new file mode 100644 index 000000000..653a605c2 --- /dev/null +++ b/tests/ui/parser/diff-markers/unclosed-delims.rs @@ -0,0 +1,14 @@ +mod tests { + #[test] +<<<<<<< HEAD +//~^ ERROR encountered diff marker +//~| NOTE after this is the code before the merge +//~| NOTE for an explanation on these markers + fn test1() { +======= +//~^ NOTE + fn test2() { +>>>>>>> 7a4f13c blah blah blah +//~^ NOTE above this are the incoming code changes + } +} diff --git a/tests/ui/parser/diff-markers/unclosed-delims.stderr b/tests/ui/parser/diff-markers/unclosed-delims.stderr new file mode 100644 index 000000000..d4636150e --- /dev/null +++ b/tests/ui/parser/diff-markers/unclosed-delims.stderr @@ -0,0 +1,18 @@ +error: encountered diff marker + --> $DIR/unclosed-delims.rs:3:1 + | +LL | <<<<<<< HEAD + | ^^^^^^^ after this is the code before the merge +... +LL | ======= + | ------- +... +LL | >>>>>>> 7a4f13c blah blah blah + | ^^^^^^^ above this are the incoming code changes + | + = help: if you're having merge conflicts after pulling new code, the top section is the code you already had and the bottom section is the remote code + = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased + = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/diff-markers/use-statement.stderr b/tests/ui/parser/diff-markers/use-statement.stderr index 12e6f57dd..6d376166a 100644 --- a/tests/ui/parser/diff-markers/use-statement.stderr +++ b/tests/ui/parser/diff-markers/use-statement.stderr @@ -14,5 +14,5 @@ LL | >>>>>>> branch = help: if you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased = note: for an explanation on these markers from the `git` documentation, visit <https://git-scm.com/book/en/v2/Git-Tools-Advanced-Merging#_checking_out_conflicts> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr b/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr index 7b43c7700..0227439ce 100644 --- a/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr +++ b/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr @@ -6,5 +6,5 @@ LL | [1, 3) | | | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr b/tests/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr index 2fe6a28ee..2796312f4 100644 --- a/tests/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr +++ b/tests/ui/parser/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.stderr @@ -4,5 +4,5 @@ error: expected one of `.`, `?`, `]`, or an operator, found `,` LL | let _x = vec[1, 2, 3]; | ^ expected one of `.`, `?`, `]`, or an operator -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/doc-before-attr.stderr b/tests/ui/parser/doc-before-attr.stderr index 14fd01af2..0298b9b60 100644 --- a/tests/ui/parser/doc-before-attr.stderr +++ b/tests/ui/parser/doc-before-attr.stderr @@ -6,5 +6,5 @@ LL | /// hi LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/doc-before-eof.stderr b/tests/ui/parser/doc-before-eof.stderr index 827566267..e41d02f0e 100644 --- a/tests/ui/parser/doc-before-eof.stderr +++ b/tests/ui/parser/doc-before-eof.stderr @@ -4,5 +4,5 @@ error: expected item after doc comment LL | /// hi | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment doesn't document anything -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/doc-before-extern-rbrace.stderr b/tests/ui/parser/doc-before-extern-rbrace.stderr index 8fa12ec26..4d952e294 100644 --- a/tests/ui/parser/doc-before-extern-rbrace.stderr +++ b/tests/ui/parser/doc-before-extern-rbrace.stderr @@ -6,6 +6,6 @@ LL | /// hi | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0584`. diff --git a/tests/ui/parser/doc-before-fn-rbrace.stderr b/tests/ui/parser/doc-before-fn-rbrace.stderr index 6ea68e42b..bbe6b7144 100644 --- a/tests/ui/parser/doc-before-fn-rbrace.stderr +++ b/tests/ui/parser/doc-before-fn-rbrace.stderr @@ -6,6 +6,6 @@ LL | /// document | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0585`. diff --git a/tests/ui/parser/doc-before-identifier.stderr b/tests/ui/parser/doc-before-identifier.stderr index 940d293b6..501b05c5a 100644 --- a/tests/ui/parser/doc-before-identifier.stderr +++ b/tests/ui/parser/doc-before-identifier.stderr @@ -4,5 +4,5 @@ error: expected identifier, found doc comment `/// document` LL | fn /// document | ^^^^^^^^^^^^ expected identifier, found doc comment -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/doc-before-mod-rbrace.stderr b/tests/ui/parser/doc-before-mod-rbrace.stderr index d5749c66c..00aa40b62 100644 --- a/tests/ui/parser/doc-before-mod-rbrace.stderr +++ b/tests/ui/parser/doc-before-mod-rbrace.stderr @@ -4,5 +4,5 @@ error: expected item after doc comment LL | /// document | ^^^^^^^^^^^^ this doc comment doesn't document anything -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/doc-before-rbrace.stderr b/tests/ui/parser/doc-before-rbrace.stderr index 4d4741dfe..3c4ea5375 100644 --- a/tests/ui/parser/doc-before-rbrace.stderr +++ b/tests/ui/parser/doc-before-rbrace.stderr @@ -6,6 +6,6 @@ LL | println!("Hi"); /// hi | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0585`. diff --git a/tests/ui/parser/doc-before-semi.stderr b/tests/ui/parser/doc-before-semi.stderr index a879e13ff..f3454d30d 100644 --- a/tests/ui/parser/doc-before-semi.stderr +++ b/tests/ui/parser/doc-before-semi.stderr @@ -6,6 +6,6 @@ LL | /// hi | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0585`. diff --git a/tests/ui/parser/doc-before-struct-rbrace-1.stderr b/tests/ui/parser/doc-before-struct-rbrace-1.stderr index 94934f734..62a27740f 100644 --- a/tests/ui/parser/doc-before-struct-rbrace-1.stderr +++ b/tests/ui/parser/doc-before-struct-rbrace-1.stderr @@ -9,6 +9,6 @@ LL | /// document | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0585`. diff --git a/tests/ui/parser/doc-before-struct-rbrace-2.stderr b/tests/ui/parser/doc-before-struct-rbrace-2.stderr index 6b5c8c1f8..66c6ce894 100644 --- a/tests/ui/parser/doc-before-struct-rbrace-2.stderr +++ b/tests/ui/parser/doc-before-struct-rbrace-2.stderr @@ -6,6 +6,6 @@ LL | a: u8 /// document | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0585`. diff --git a/tests/ui/parser/doc-comment-in-stmt.fixed b/tests/ui/parser/doc-comment-in-stmt.fixed new file mode 100644 index 000000000..4b3ecccf6 --- /dev/null +++ b/tests/ui/parser/doc-comment-in-stmt.fixed @@ -0,0 +1,27 @@ +// run-rustfix +#![allow(unused)] +fn foo() -> bool { + false + // !self.allow_ty_infer() + //~^ ERROR found doc comment +} + +fn bar() -> bool { + false + /* ! bar */ //~ ERROR found doc comment +} + +fn baz() -> i32 { + 1 /* * baz */ //~ ERROR found doc comment +} + +fn quux() -> i32 { + 2 // / quux + //~^ ERROR found doc comment +} + +fn main() { + let x = 0; + let y = x.max(1) // !foo //~ ERROR found doc comment + .min(2); +} diff --git a/tests/ui/parser/doc-comment-in-stmt.rs b/tests/ui/parser/doc-comment-in-stmt.rs index b02df1321..73d08f51c 100644 --- a/tests/ui/parser/doc-comment-in-stmt.rs +++ b/tests/ui/parser/doc-comment-in-stmt.rs @@ -1,3 +1,5 @@ +// run-rustfix +#![allow(unused)] fn foo() -> bool { false //!self.allow_ty_infer() @@ -14,7 +16,12 @@ fn baz() -> i32 { } fn quux() -> i32 { - 2 /*! quux */ //~ ERROR found doc comment + 2 /// quux + //~^ ERROR found doc comment } -fn main() {} +fn main() { + let x = 0; + let y = x.max(1) //!foo //~ ERROR found doc comment + .min(2); +} diff --git a/tests/ui/parser/doc-comment-in-stmt.stderr b/tests/ui/parser/doc-comment-in-stmt.stderr index febfb600c..7aefd5c99 100644 --- a/tests/ui/parser/doc-comment-in-stmt.stderr +++ b/tests/ui/parser/doc-comment-in-stmt.stderr @@ -1,50 +1,61 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `//!self.allow_ty_infer()` - --> $DIR/doc-comment-in-stmt.rs:3:5 + --> $DIR/doc-comment-in-stmt.rs:5:5 | LL | false | - expected one of `.`, `;`, `?`, `}`, or an operator LL | //!self.allow_ty_infer() | ^^^^^^^^^^^^^^^^^^^^^^^^ unexpected token | -help: add a space before `!` to use a regular comment +help: add a space before `!` to write a regular comment | LL | // !self.allow_ty_infer() - | ~~~~ + | + error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/*! bar */` - --> $DIR/doc-comment-in-stmt.rs:9:5 + --> $DIR/doc-comment-in-stmt.rs:11:5 | LL | false | - expected one of `.`, `;`, `?`, `}`, or an operator LL | /*! bar */ | ^^^^^^^^^^ unexpected token | -help: add a space before `!` to use a regular comment +help: add a space before `!` to write a regular comment | LL | /* ! bar */ - | ~~~~ + | + error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/** baz */` - --> $DIR/doc-comment-in-stmt.rs:13:7 + --> $DIR/doc-comment-in-stmt.rs:15:7 | LL | 1 /** baz */ | ^^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator | -help: add a space before `*` to use a regular comment +help: add a space before the last `*` to write a regular comment | LL | 1 /* * baz */ - | ~~~~ + | + -error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/*! quux */` - --> $DIR/doc-comment-in-stmt.rs:17:7 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found doc comment `/// quux` + --> $DIR/doc-comment-in-stmt.rs:19:7 | -LL | 2 /*! quux */ - | ^^^^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator +LL | 2 /// quux + | ^^^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator | -help: add a space before `!` to use a regular comment +help: add a space before the last `/` to write a regular comment | -LL | 2 /* ! quux */ - | ~~~~ +LL | 2 // / quux + | + -error: aborting due to 4 previous errors +error: expected one of `.`, `;`, `?`, `else`, or an operator, found doc comment `//!foo + --> $DIR/doc-comment-in-stmt.rs:25:22 + | +LL | let y = x.max(1) //!foo + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected one of `.`, `;`, `?`, `else`, or an operator + | +help: add a space before `!` to write a regular comment + | +LL | let y = x.max(1) // !foo + | + + +error: aborting due to 5 previous errors diff --git a/tests/ui/parser/doc-inside-trait-item.stderr b/tests/ui/parser/doc-inside-trait-item.stderr index 900124adc..df1ebc110 100644 --- a/tests/ui/parser/doc-inside-trait-item.stderr +++ b/tests/ui/parser/doc-inside-trait-item.stderr @@ -6,6 +6,6 @@ LL | /// empty doc | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0584`. diff --git a/tests/ui/parser/dotdotdot-expr.stderr b/tests/ui/parser/dotdotdot-expr.stderr index e7203f24d..208c04bd3 100644 --- a/tests/ui/parser/dotdotdot-expr.stderr +++ b/tests/ui/parser/dotdotdot-expr.stderr @@ -13,5 +13,5 @@ help: or `..=` for an inclusive range LL | let _redemptive = 1..=21; | ~~~ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/double-pointer.stderr b/tests/ui/parser/double-pointer.stderr index 28037f932..25403c5b0 100644 --- a/tests/ui/parser/double-pointer.stderr +++ b/tests/ui/parser/double-pointer.stderr @@ -6,10 +6,10 @@ 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; | +++ +LL | let dptr: *const *const i32 = &ptr; + | +++++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/duplicate-visibility.stderr b/tests/ui/parser/duplicate-visibility.stderr index 8ecebf01f..b578b1fe2 100644 --- a/tests/ui/parser/duplicate-visibility.stderr +++ b/tests/ui/parser/duplicate-visibility.stderr @@ -18,5 +18,5 @@ note: explicit visibility first seen here LL | pub pub fn foo(); | ^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr index e645b68ba..8250dd1ea 100644 --- a/tests/ui/parser/emoji-identifiers.stderr +++ b/tests/ui/parser/emoji-identifiers.stderr @@ -75,6 +75,12 @@ LL | 👀::full_of✨() | | | function or associated item not found in `👀` | help: there is an associated function with a similar name: `full_of_✨` + | +note: if you're trying to build a new `👀`, consider using `👀::full_of_✨` which returns `👀` + --> $DIR/emoji-identifiers.rs:4:5 + | +LL | fn full_of_✨() -> 👀 { + | ^^^^^^^^^^^^^^^^^^^^^ error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope --> $DIR/emoji-identifiers.rs:13:13 diff --git a/tests/ui/parser/empty-impl-semicolon.stderr b/tests/ui/parser/empty-impl-semicolon.stderr index 6ed309eba..cb15c36e6 100644 --- a/tests/ui/parser/empty-impl-semicolon.stderr +++ b/tests/ui/parser/empty-impl-semicolon.stderr @@ -6,5 +6,5 @@ LL | impl Foo; | = help: try using `{}` instead -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/expr-as-stmt.stderr b/tests/ui/parser/expr-as-stmt.stderr index 18c8b0b7c..76a83aa01 100644 --- a/tests/ui/parser/expr-as-stmt.stderr +++ b/tests/ui/parser/expr-as-stmt.stderr @@ -217,7 +217,7 @@ LL | { true } || { true } | ^^^^^^^^^^^ expected `bool`, found closure | = note: expected type `bool` - found closure `[closure@$DIR/expr-as-stmt.rs:51:14: 51:16]` + found closure `{closure@$DIR/expr-as-stmt.rs:51:14: 51:16}` help: parentheses are required to parse this as an expression | LL | ({ true }) || { true } diff --git a/tests/ui/parser/extern-crate-unexpected-token.stderr b/tests/ui/parser/extern-crate-unexpected-token.stderr index e9d287ac0..f83bb3e3e 100644 --- a/tests/ui/parser/extern-crate-unexpected-token.stderr +++ b/tests/ui/parser/extern-crate-unexpected-token.stderr @@ -4,5 +4,5 @@ error: expected one of `crate` or `{`, found `crte` LL | extern crte foo; | ^^^^ expected one of `crate` or `{` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/extern-expected-fn-or-brace.stderr b/tests/ui/parser/extern-expected-fn-or-brace.stderr index 258a2c268..c2200e037 100644 --- a/tests/ui/parser/extern-expected-fn-or-brace.stderr +++ b/tests/ui/parser/extern-expected-fn-or-brace.stderr @@ -4,5 +4,5 @@ error: expected `{`, found keyword `mod` LL | extern "C" mod foo; | ^^^ expected `{` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/extern-foreign-crate.stderr b/tests/ui/parser/extern-foreign-crate.stderr index eb75c0fc9..10c58aeb5 100644 --- a/tests/ui/parser/extern-foreign-crate.stderr +++ b/tests/ui/parser/extern-foreign-crate.stderr @@ -4,5 +4,5 @@ error: expected one of `;` or `as`, found `{` LL | extern crate foo {} | ^ expected one of `;` or `as` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/extern-no-fn.stderr b/tests/ui/parser/extern-no-fn.stderr index d9183d564..2e434afb2 100644 --- a/tests/ui/parser/extern-no-fn.stderr +++ b/tests/ui/parser/extern-no-fn.stderr @@ -8,5 +8,5 @@ LL | f(); LL | } | - the item list ends here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/float-field-interpolated.rs b/tests/ui/parser/float-field-interpolated.rs index a30532035..990f2926d 100644 --- a/tests/ui/parser/float-field-interpolated.rs +++ b/tests/ui/parser/float-field-interpolated.rs @@ -6,9 +6,9 @@ macro_rules! generate_field_accesses { s.$a; // OK { s.$b; } //~ ERROR unexpected token: `1.1` - //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1` + //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found literal `1.1` { s.$c; } //~ ERROR unexpected token: `1.1` - //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1` + //~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found expression `1.1` }; } diff --git a/tests/ui/parser/float-field-interpolated.stderr b/tests/ui/parser/float-field-interpolated.stderr index 664adb358..2a1a4926c 100644 --- a/tests/ui/parser/float-field-interpolated.stderr +++ b/tests/ui/parser/float-field-interpolated.stderr @@ -9,7 +9,7 @@ LL | generate_field_accesses!(1.1, 1.1, 1.1); | = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info) -error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1` +error: expected one of `.`, `;`, `?`, `}`, or an operator, found literal `1.1` --> $DIR/float-field-interpolated.rs:8:13 | LL | { s.$b; } @@ -31,7 +31,7 @@ LL | generate_field_accesses!(1.1, 1.1, 1.1); | = note: this error originates in the macro `generate_field_accesses` (in Nightly builds, run with -Z macro-backtrace for more info) -error: expected one of `.`, `;`, `?`, `}`, or an operator, found `1.1` +error: expected one of `.`, `;`, `?`, `}`, or an operator, found expression `1.1` --> $DIR/float-field-interpolated.rs:10:13 | LL | { s.$c; } diff --git a/tests/ui/parser/float-field.stderr b/tests/ui/parser/float-field.stderr index 7090efc50..d67d270ef 100644 --- a/tests/ui/parser/float-field.stderr +++ b/tests/ui/parser/float-field.stderr @@ -274,7 +274,7 @@ error[E0609]: no field `1e1` on type `(u8, u8)` --> $DIR/float-field.rs:9:9 | LL | s.1.1e1; - | ^^^ + | ^^^ unknown field error[E0609]: no field `0x1e1` on type `S` --> $DIR/float-field.rs:24:7 @@ -336,13 +336,13 @@ error[E0609]: no field `f32` on type `(u8, u8)` --> $DIR/float-field.rs:44:9 | LL | s.1.f32; - | ^^^ + | ^^^ unknown field error[E0609]: no field `1e1` on type `(u8, u8)` --> $DIR/float-field.rs:46:7 | LL | s.1.1e1f32; - | ^^^^^^^^ + | ^^^^^^^^ unknown field error: aborting due to 55 previous errors diff --git a/tests/ui/parser/fn-colon-return-type.stderr b/tests/ui/parser/fn-colon-return-type.stderr index 1de918782..b61a62a17 100644 --- a/tests/ui/parser/fn-colon-return-type.stderr +++ b/tests/ui/parser/fn-colon-return-type.stderr @@ -4,5 +4,5 @@ error: return types are denoted using `->` LL | fn foo(x: i32): i32 { | ^ help: use `->` instead -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-defined-using-def.stderr b/tests/ui/parser/fn-defined-using-def.stderr index f34329012..972c861c7 100644 --- a/tests/ui/parser/fn-defined-using-def.stderr +++ b/tests/ui/parser/fn-defined-using-def.stderr @@ -6,5 +6,5 @@ LL | def foo() {} | | | help: write `fn` instead of `def` to declare a function -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-defined-using-fun.stderr b/tests/ui/parser/fn-defined-using-fun.stderr index 2f6cfff35..3c8e586c0 100644 --- a/tests/ui/parser/fn-defined-using-fun.stderr +++ b/tests/ui/parser/fn-defined-using-fun.stderr @@ -6,5 +6,5 @@ LL | fun foo() {} | | | help: write `fn` instead of `fun` to declare a function -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-defined-using-func.stderr b/tests/ui/parser/fn-defined-using-func.stderr index 355741e89..9dd90798d 100644 --- a/tests/ui/parser/fn-defined-using-func.stderr +++ b/tests/ui/parser/fn-defined-using-func.stderr @@ -6,5 +6,5 @@ LL | func foo() {} | | | help: write `fn` instead of `func` to declare a function -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-defined-using-function.stderr b/tests/ui/parser/fn-defined-using-function.stderr index 43c33a2cd..504ab1bb9 100644 --- a/tests/ui/parser/fn-defined-using-function.stderr +++ b/tests/ui/parser/fn-defined-using-function.stderr @@ -6,5 +6,5 @@ LL | function foo() {} | | | help: write `fn` instead of `function` to declare a function -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-header-semantic-fail.rs b/tests/ui/parser/fn-header-semantic-fail.rs index 71f18a27e..f8b58cad7 100644 --- a/tests/ui/parser/fn-header-semantic-fail.rs +++ b/tests/ui/parser/fn-header-semantic-fail.rs @@ -13,25 +13,23 @@ fn main() { //~^ ERROR functions cannot be both `const` and `async` trait X { - async fn ft1(); //~ ERROR functions in traits cannot be declared `async` + async fn ft1(); // OK. unsafe fn ft2(); // OK. const fn ft3(); //~ ERROR functions in traits cannot be declared const extern "C" fn ft4(); // OK. const async unsafe extern "C" fn ft5(); - //~^ ERROR functions in traits cannot be declared `async` - //~| ERROR functions in traits cannot be declared const + //~^ ERROR functions in traits cannot be declared const //~| ERROR functions cannot be both `const` and `async` } struct Y; impl X for Y { - async fn ft1() {} //~ ERROR functions in traits cannot be declared `async` + async fn ft1() {} // OK. unsafe fn ft2() {} // OK. const fn ft3() {} //~ ERROR functions in traits cannot be declared const extern "C" fn ft4() {} const async unsafe extern "C" fn ft5() {} - //~^ ERROR functions in traits cannot be declared `async` - //~| ERROR functions in traits cannot be declared const + //~^ ERROR functions in traits cannot be declared const //~| ERROR functions cannot be both `const` and `async` } diff --git a/tests/ui/parser/fn-header-semantic-fail.stderr b/tests/ui/parser/fn-header-semantic-fail.stderr index 7f7b7e835..cdf01e0c5 100644 --- a/tests/ui/parser/fn-header-semantic-fail.stderr +++ b/tests/ui/parser/fn-header-semantic-fail.stderr @@ -29,19 +29,19 @@ LL | const async unsafe extern "C" fn ft5(); | `const` because of this error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:30:9 + --> $DIR/fn-header-semantic-fail.rs:29:9 | LL | const fn ft3() {} | ^^^^^ functions in traits cannot be const error[E0379]: functions in traits cannot be declared const - --> $DIR/fn-header-semantic-fail.rs:32:9 + --> $DIR/fn-header-semantic-fail.rs:31:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^ functions in traits cannot be const error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:32:9 + --> $DIR/fn-header-semantic-fail.rs:31:9 | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^-^^^^^------------------------------ @@ -50,7 +50,7 @@ LL | const async unsafe extern "C" fn ft5() {} | `const` because of this error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:43:9 + --> $DIR/fn-header-semantic-fail.rs:41:9 | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^-^^^^^------------------------------ @@ -59,7 +59,7 @@ LL | const async unsafe extern "C" fn fi5() {} | `const` because of this error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:48:18 + --> $DIR/fn-header-semantic-fail.rs:46:18 | LL | extern "C" { | ---------- in this `extern` block @@ -72,7 +72,7 @@ LL | fn fe1(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:49:19 + --> $DIR/fn-header-semantic-fail.rs:47:19 | LL | extern "C" { | ---------- in this `extern` block @@ -86,7 +86,7 @@ LL | fn fe2(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:50:18 + --> $DIR/fn-header-semantic-fail.rs:48:18 | LL | extern "C" { | ---------- in this `extern` block @@ -100,7 +100,7 @@ LL | fn fe3(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:51:23 + --> $DIR/fn-header-semantic-fail.rs:49:23 | LL | extern "C" { | ---------- in this `extern` block @@ -114,7 +114,7 @@ LL | fn fe4(); | ~~ error: functions in `extern` blocks cannot have qualifiers - --> $DIR/fn-header-semantic-fail.rs:52:42 + --> $DIR/fn-header-semantic-fail.rs:50:42 | LL | extern "C" { | ---------- in this `extern` block @@ -128,7 +128,7 @@ LL | fn fe5(); | ~~ error: functions cannot be both `const` and `async` - --> $DIR/fn-header-semantic-fail.rs:52:9 + --> $DIR/fn-header-semantic-fail.rs:50:9 | LL | const async unsafe extern "C" fn fe5(); | ^^^^^-^^^^^---------------------------- @@ -136,59 +136,6 @@ LL | const async unsafe extern "C" fn fe5(); | | `async` because of this | `const` because of this -error[E0706]: functions in traits cannot be declared `async` - --> $DIR/fn-header-semantic-fail.rs:16:9 - | -LL | async fn ft1(); - | -----^^^^^^^^^^ - | | - | `async` because of this - | - = 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(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:20:9 - | -LL | const async unsafe extern "C" fn ft5(); - | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = 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(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:28:9 - | -LL | async fn ft1() {} - | -----^^^^^^^^^ - | | - | `async` because of this - | - = 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(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:32:9 - | -LL | const async unsafe extern "C" fn ft5() {} - | ^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `async` because of this - | - = 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(async_fn_in_trait)]` to the crate attributes to enable - -error: aborting due to 18 previous errors +error: aborting due to 14 previous errors -Some errors have detailed explanations: E0379, E0706. -For more information about an error, try `rustc --explain E0379`. +For more information about this error, try `rustc --explain E0379`. diff --git a/tests/ui/parser/foreign-ty-semantic-fail.rs b/tests/ui/parser/foreign-ty-semantic-fail.rs index 96b15232b..4d30086e7 100644 --- a/tests/ui/parser/foreign-ty-semantic-fail.rs +++ b/tests/ui/parser/foreign-ty-semantic-fail.rs @@ -15,4 +15,5 @@ extern "C" { //~^ ERROR incorrect `type` inside `extern` block type E: where; + //~^ ERROR `type`s inside `extern` blocks cannot have `where` clauses } diff --git a/tests/ui/parser/foreign-ty-semantic-fail.stderr b/tests/ui/parser/foreign-ty-semantic-fail.stderr index 588e4966a..2b400dfea 100644 --- a/tests/ui/parser/foreign-ty-semantic-fail.stderr +++ b/tests/ui/parser/foreign-ty-semantic-fail.stderr @@ -61,5 +61,16 @@ LL | type D = u8; | = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html -error: aborting due to 6 previous errors +error: `type`s inside `extern` blocks cannot have `where` clauses + --> $DIR/foreign-ty-semantic-fail.rs:17:13 + | +LL | extern "C" { + | ---------- `extern` block begins here +... +LL | type E: where; + | ^^^^^ help: remove the `where` clause + | + = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html + +error: aborting due to 7 previous errors diff --git a/tests/ui/parser/generic-statics.rs b/tests/ui/parser/generic-statics.rs new file mode 100644 index 000000000..2fb8781fd --- /dev/null +++ b/tests/ui/parser/generic-statics.rs @@ -0,0 +1,4 @@ +static S<T>: i32 = 0; +//~^ ERROR static items may not have generic parameters + +fn main() {} diff --git a/tests/ui/parser/generic-statics.stderr b/tests/ui/parser/generic-statics.stderr new file mode 100644 index 000000000..eb2e27360 --- /dev/null +++ b/tests/ui/parser/generic-statics.stderr @@ -0,0 +1,8 @@ +error: static items may not have generic parameters + --> $DIR/generic-statics.rs:1:9 + | +LL | static S<T>: i32 = 0; + | ^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/if-in-in.stderr b/tests/ui/parser/if-in-in.stderr index 0e69bc4b2..6117370c0 100644 --- a/tests/ui/parser/if-in-in.stderr +++ b/tests/ui/parser/if-in-in.stderr @@ -6,5 +6,5 @@ LL | for i in in 1..2 { | | | help: remove the duplicated `in` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/impl-item-const-semantic-fail.stderr b/tests/ui/parser/impl-item-const-semantic-fail.stderr index ec3bee0ce..579f4c29c 100644 --- a/tests/ui/parser/impl-item-const-semantic-fail.stderr +++ b/tests/ui/parser/impl-item-const-semantic-fail.stderr @@ -6,5 +6,5 @@ LL | const Y: u8; | | | help: provide a definition for the constant: `= <expr>;` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/impl-item-fn-no-body-semantic-fail.stderr b/tests/ui/parser/impl-item-fn-no-body-semantic-fail.stderr index 1acb72736..1704d99cf 100644 --- a/tests/ui/parser/impl-item-fn-no-body-semantic-fail.stderr +++ b/tests/ui/parser/impl-item-fn-no-body-semantic-fail.stderr @@ -6,5 +6,5 @@ LL | fn f(); | | | help: provide a definition for the function: `{ <body> }` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/impl-on-unsized-typo.stderr b/tests/ui/parser/impl-on-unsized-typo.stderr index 23dcc1efd..62e0d085e 100644 --- a/tests/ui/parser/impl-on-unsized-typo.stderr +++ b/tests/ui/parser/impl-on-unsized-typo.stderr @@ -4,5 +4,5 @@ error: expected one of `,`, `:`, `=`, or `>`, found `?` LL | impl<T ?Sized> Tr for T {} | ^ expected one of `,`, `:`, `=`, or `>` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/impl-parsing.stderr b/tests/ui/parser/impl-parsing.stderr index 755addf14..a57cc075c 100644 --- a/tests/ui/parser/impl-parsing.stderr +++ b/tests/ui/parser/impl-parsing.stderr @@ -35,6 +35,8 @@ error: expected item, found keyword `unsafe` | LL | default unsafe FAIL | ^^^^^^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 6 previous errors diff --git a/tests/ui/parser/import-from-path.stderr b/tests/ui/parser/import-from-path.stderr index 93bdf82d0..b63e48d66 100644 --- a/tests/ui/parser/import-from-path.stderr +++ b/tests/ui/parser/import-from-path.stderr @@ -6,5 +6,5 @@ LL | use foo::{bar}::baz | = note: glob-like brace syntax must be last on the path -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/import-from-rename.stderr b/tests/ui/parser/import-from-rename.stderr index d78f6de92..2f267a8d0 100644 --- a/tests/ui/parser/import-from-rename.stderr +++ b/tests/ui/parser/import-from-rename.stderr @@ -6,5 +6,5 @@ LL | use foo::{bar} as baz; | = note: glob-like brace syntax must be last on the path -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/import-glob-path.stderr b/tests/ui/parser/import-glob-path.stderr index a93ef255c..3bde32d1e 100644 --- a/tests/ui/parser/import-glob-path.stderr +++ b/tests/ui/parser/import-glob-path.stderr @@ -6,5 +6,5 @@ LL | use foo::*::bar | = note: the wildcard token must be last on the path -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/import-glob-rename.stderr b/tests/ui/parser/import-glob-rename.stderr index e1a026b63..24e6c3f00 100644 --- a/tests/ui/parser/import-glob-rename.stderr +++ b/tests/ui/parser/import-glob-rename.stderr @@ -6,5 +6,5 @@ LL | use foo::* as baz; | = note: the wildcard token must be last on the path -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/inner-attr-after-doc-comment.stderr b/tests/ui/parser/inner-attr-after-doc-comment.stderr index 3ec3ad8e9..6dbc0fd93 100644 --- a/tests/ui/parser/inner-attr-after-doc-comment.stderr +++ b/tests/ui/parser/inner-attr-after-doc-comment.stderr @@ -19,5 +19,5 @@ LL - #![recursion_limit="100"] LL + #[recursion_limit="100"] | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/inner-attr.stderr b/tests/ui/parser/inner-attr.stderr index 331c254a5..57ca164fc 100644 --- a/tests/ui/parser/inner-attr.stderr +++ b/tests/ui/parser/inner-attr.stderr @@ -16,5 +16,5 @@ LL - #![recursion_limit="100"] LL + #[recursion_limit="100"] | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/int-literal-too-large-span.stderr b/tests/ui/parser/int-literal-too-large-span.stderr index 49d6aa5ef..d65a3052b 100644 --- a/tests/ui/parser/int-literal-too-large-span.stderr +++ b/tests/ui/parser/int-literal-too-large-span.stderr @@ -6,5 +6,5 @@ LL | 99999999999999999999999999999999999999999999999999999999999999999999999 | = note: value exceeds limit of `340282366920938463463374607431768211455` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/integer-literal-start-ident.stderr b/tests/ui/parser/integer-literal-start-ident.stderr index b2c661296..27f0baec8 100644 --- a/tests/ui/parser/integer-literal-start-ident.stderr +++ b/tests/ui/parser/integer-literal-start-ident.stderr @@ -10,5 +10,5 @@ help: identifiers cannot start with a number LL | fn 1main() {} | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/intersection-patterns-2.stderr b/tests/ui/parser/intersection-patterns-2.stderr index f7e78814c..df34e2a42 100644 --- a/tests/ui/parser/intersection-patterns-2.stderr +++ b/tests/ui/parser/intersection-patterns-2.stderr @@ -9,5 +9,5 @@ LL | Some(x) @ Some(y) => {} | = note: bindings are `x`, `mut x`, `ref x`, and `ref mut x` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-104620.rs b/tests/ui/parser/issue-104620.rs deleted file mode 100644 index f49476c44..000000000 --- a/tests/ui/parser/issue-104620.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![feature(rustc_attrs)] - -#![rustc_dummy=5z] //~ ERROR unexpected expression: `5z` -fn main() {} diff --git a/tests/ui/parser/issue-104620.stderr b/tests/ui/parser/issue-104620.stderr deleted file mode 100644 index d06a6b255..000000000 --- a/tests/ui/parser/issue-104620.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: unexpected expression: `5z` - --> $DIR/issue-104620.rs:3:16 - | -LL | #![rustc_dummy=5z] - | ^^ - -error: aborting due to previous error - diff --git a/tests/ui/parser/issue-116781.rs b/tests/ui/parser/issue-116781.rs new file mode 100644 index 000000000..0e951d2ea --- /dev/null +++ b/tests/ui/parser/issue-116781.rs @@ -0,0 +1,8 @@ +#[derive(Debug)] +struct Foo { + #[cfg(all())] + field: fn(($),), //~ ERROR expected pattern, found `$` + //~^ ERROR expected pattern, found `$` +} + +fn main() {} diff --git a/tests/ui/parser/issue-116781.stderr b/tests/ui/parser/issue-116781.stderr new file mode 100644 index 000000000..1a77b60a5 --- /dev/null +++ b/tests/ui/parser/issue-116781.stderr @@ -0,0 +1,16 @@ +error: expected pattern, found `$` + --> $DIR/issue-116781.rs:4:16 + | +LL | field: fn(($),), + | ^ expected pattern + +error: expected pattern, found `$` + --> $DIR/issue-116781.rs:4:16 + | +LL | field: fn(($),), + | ^ expected pattern + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issue-100197-mut-let.fixed b/tests/ui/parser/issues/issue-100197-mut-let.fixed index 5a8956222..5a8956222 100644 --- a/tests/ui/parser/issue-100197-mut-let.fixed +++ b/tests/ui/parser/issues/issue-100197-mut-let.fixed diff --git a/tests/ui/parser/issue-100197-mut-let.rs b/tests/ui/parser/issues/issue-100197-mut-let.rs index 71103813a..71103813a 100644 --- a/tests/ui/parser/issue-100197-mut-let.rs +++ b/tests/ui/parser/issues/issue-100197-mut-let.rs diff --git a/tests/ui/parser/issue-100197-mut-let.stderr b/tests/ui/parser/issues/issue-100197-mut-let.stderr index 86658e4f3..07d136881 100644 --- a/tests/ui/parser/issue-100197-mut-let.stderr +++ b/tests/ui/parser/issues/issue-100197-mut-let.stderr @@ -4,5 +4,5 @@ error: invalid variable declaration LL | mut let _x = 123; | ^^^^^^^ help: switch the order of `mut` and `let`: `let mut` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-101477-enum.fixed b/tests/ui/parser/issues/issue-101477-enum.fixed index 1dfeae22a..1dfeae22a 100644 --- a/tests/ui/parser/issue-101477-enum.fixed +++ b/tests/ui/parser/issues/issue-101477-enum.fixed diff --git a/tests/ui/parser/issue-101477-enum.rs b/tests/ui/parser/issues/issue-101477-enum.rs index ea7051d69..ea7051d69 100644 --- a/tests/ui/parser/issue-101477-enum.rs +++ b/tests/ui/parser/issues/issue-101477-enum.rs diff --git a/tests/ui/parser/issue-101477-enum.stderr b/tests/ui/parser/issues/issue-101477-enum.stderr index 1edca391e..94130671f 100644 --- a/tests/ui/parser/issue-101477-enum.stderr +++ b/tests/ui/parser/issues/issue-101477-enum.stderr @@ -11,6 +11,8 @@ error: expected item, found `==` | LL | B == 2 | ^^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issue-101477-let.fixed b/tests/ui/parser/issues/issue-101477-let.fixed index 9989ad815..9989ad815 100644 --- a/tests/ui/parser/issue-101477-let.fixed +++ b/tests/ui/parser/issues/issue-101477-let.fixed diff --git a/tests/ui/parser/issue-101477-let.rs b/tests/ui/parser/issues/issue-101477-let.rs index 8b0e8bee1..8b0e8bee1 100644 --- a/tests/ui/parser/issue-101477-let.rs +++ b/tests/ui/parser/issues/issue-101477-let.rs diff --git a/tests/ui/parser/issue-101477-let.stderr b/tests/ui/parser/issues/issue-101477-let.stderr index 1b30d4b17..563483573 100644 --- a/tests/ui/parser/issue-101477-let.stderr +++ b/tests/ui/parser/issues/issue-101477-let.stderr @@ -4,5 +4,5 @@ error: unexpected `==` LL | let x == 2; | ^^ help: try using `=` instead -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-101540.stderr b/tests/ui/parser/issues/issue-101540.stderr index 8af887050..40f1d339a 100644 --- a/tests/ui/parser/issues/issue-101540.stderr +++ b/tests/ui/parser/issues/issue-101540.stderr @@ -8,5 +8,5 @@ LL | struct S2 { | = help: consider creating a new `struct` definition instead of nesting -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-102182-impl-trait-recover.stderr b/tests/ui/parser/issues/issue-102182-impl-trait-recover.stderr index 52b6ae5df..cf05337f2 100644 --- a/tests/ui/parser/issues/issue-102182-impl-trait-recover.stderr +++ b/tests/ui/parser/issues/issue-102182-impl-trait-recover.stderr @@ -10,5 +10,5 @@ LL - fn foo<T: impl Trait>() {} LL + fn foo<T: Trait>() {} | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-102806.rs b/tests/ui/parser/issues/issue-102806.rs index ba297bdc9..ba297bdc9 100644 --- a/tests/ui/parser/issue-102806.rs +++ b/tests/ui/parser/issues/issue-102806.rs diff --git a/tests/ui/parser/issue-102806.stderr b/tests/ui/parser/issues/issue-102806.stderr index ba8174a82..ba8174a82 100644 --- a/tests/ui/parser/issue-102806.stderr +++ b/tests/ui/parser/issues/issue-102806.stderr diff --git a/tests/ui/parser/issue-103143.rs b/tests/ui/parser/issues/issue-103143.rs index a584274c4..a584274c4 100644 --- a/tests/ui/parser/issue-103143.rs +++ b/tests/ui/parser/issues/issue-103143.rs diff --git a/tests/ui/parser/issue-103143.stderr b/tests/ui/parser/issues/issue-103143.stderr index 4035c69af..4035c69af 100644 --- a/tests/ui/parser/issue-103143.stderr +++ b/tests/ui/parser/issues/issue-103143.stderr diff --git a/tests/ui/parser/issue-103381.fixed b/tests/ui/parser/issues/issue-103381.fixed index 6a9fb9910..6a9fb9910 100644 --- a/tests/ui/parser/issue-103381.fixed +++ b/tests/ui/parser/issues/issue-103381.fixed diff --git a/tests/ui/parser/issue-103381.rs b/tests/ui/parser/issues/issue-103381.rs index bf79e1010..bf79e1010 100644 --- a/tests/ui/parser/issue-103381.rs +++ b/tests/ui/parser/issues/issue-103381.rs diff --git a/tests/ui/parser/issue-103381.stderr b/tests/ui/parser/issues/issue-103381.stderr index 85fcc18e7..85fcc18e7 100644 --- a/tests/ui/parser/issue-103381.stderr +++ b/tests/ui/parser/issues/issue-103381.stderr diff --git a/tests/ui/parser/issue-103425.rs b/tests/ui/parser/issues/issue-103425.rs index c2f8123ca..c2f8123ca 100644 --- a/tests/ui/parser/issue-103425.rs +++ b/tests/ui/parser/issues/issue-103425.rs diff --git a/tests/ui/parser/issue-103425.stderr b/tests/ui/parser/issues/issue-103425.stderr index 0efe3e3ca..0efe3e3ca 100644 --- a/tests/ui/parser/issue-103425.stderr +++ b/tests/ui/parser/issues/issue-103425.stderr diff --git a/tests/ui/parser/issue-103451.rs b/tests/ui/parser/issues/issue-103451.rs index be33213f3..be33213f3 100644 --- a/tests/ui/parser/issue-103451.rs +++ b/tests/ui/parser/issues/issue-103451.rs diff --git a/tests/ui/parser/issue-103451.stderr b/tests/ui/parser/issues/issue-103451.stderr index 6aacd5012..7ad816e45 100644 --- a/tests/ui/parser/issue-103451.stderr +++ b/tests/ui/parser/issues/issue-103451.stderr @@ -8,5 +8,5 @@ LL | x: [u8; R | | | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-103748-ICE-wrong-braces.rs b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs index 8012cb652..8012cb652 100644 --- a/tests/ui/parser/issue-103748-ICE-wrong-braces.rs +++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.rs diff --git a/tests/ui/parser/issue-103748-ICE-wrong-braces.stderr b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr index b0d8b03ae..b0d8b03ae 100644 --- a/tests/ui/parser/issue-103748-ICE-wrong-braces.stderr +++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr diff --git a/tests/ui/parser/issues/issue-10392-2.stderr b/tests/ui/parser/issues/issue-10392-2.stderr index 4154ecfeb..3e5d5062b 100644 --- a/tests/ui/parser/issues/issue-10392-2.stderr +++ b/tests/ui/parser/issues/issue-10392-2.stderr @@ -8,5 +8,5 @@ LL | let A { .., } = a(); | | help: remove this comma | `..` must be at the end and cannot have a trailing comma -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-10392.stderr b/tests/ui/parser/issues/issue-10392.stderr index 438ea67d3..85090d054 100644 --- a/tests/ui/parser/issues/issue-10392.stderr +++ b/tests/ui/parser/issues/issue-10392.stderr @@ -6,5 +6,5 @@ LL | let A { , } = a(); | | | while parsing the fields for this pattern -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-104620.rs b/tests/ui/parser/issues/issue-104620.rs new file mode 100644 index 000000000..fd0916b44 --- /dev/null +++ b/tests/ui/parser/issues/issue-104620.rs @@ -0,0 +1,4 @@ +#![feature(rustc_attrs)] + +#![rustc_dummy=5z] //~ ERROR invalid suffix `z` for number literal +fn main() {} diff --git a/tests/ui/parser/issues/issue-104620.stderr b/tests/ui/parser/issues/issue-104620.stderr new file mode 100644 index 000000000..040c63a5f --- /dev/null +++ b/tests/ui/parser/issues/issue-104620.stderr @@ -0,0 +1,10 @@ +error: invalid suffix `z` for number literal + --> $DIR/issue-104620.rs:3:16 + | +LL | #![rustc_dummy=5z] + | ^^ invalid suffix `z` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issue-104867-inc-dec-2.rs b/tests/ui/parser/issues/issue-104867-inc-dec-2.rs index a006421a9..a006421a9 100644 --- a/tests/ui/parser/issue-104867-inc-dec-2.rs +++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.rs diff --git a/tests/ui/parser/issue-104867-inc-dec-2.stderr b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr index 4e2d05468..4e2d05468 100644 --- a/tests/ui/parser/issue-104867-inc-dec-2.stderr +++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr diff --git a/tests/ui/parser/issue-104867-inc-dec.rs b/tests/ui/parser/issues/issue-104867-inc-dec.rs index 760c67b4b..760c67b4b 100644 --- a/tests/ui/parser/issue-104867-inc-dec.rs +++ b/tests/ui/parser/issues/issue-104867-inc-dec.rs diff --git a/tests/ui/parser/issue-104867-inc-dec.stderr b/tests/ui/parser/issues/issue-104867-inc-dec.stderr index 78bfd3e82..78bfd3e82 100644 --- a/tests/ui/parser/issue-104867-inc-dec.stderr +++ b/tests/ui/parser/issues/issue-104867-inc-dec.stderr diff --git a/tests/ui/parser/issue-105366.fixed b/tests/ui/parser/issues/issue-105366.fixed index ad26643c3..ad26643c3 100644 --- a/tests/ui/parser/issue-105366.fixed +++ b/tests/ui/parser/issues/issue-105366.fixed diff --git a/tests/ui/parser/issue-105366.rs b/tests/ui/parser/issues/issue-105366.rs index 311b6a60f..311b6a60f 100644 --- a/tests/ui/parser/issue-105366.rs +++ b/tests/ui/parser/issues/issue-105366.rs diff --git a/tests/ui/parser/issue-105366.stderr b/tests/ui/parser/issues/issue-105366.stderr index 0a7408e2c..18c04dfaf 100644 --- a/tests/ui/parser/issue-105366.stderr +++ b/tests/ui/parser/issues/issue-105366.stderr @@ -9,5 +9,5 @@ help: replace `fn` with `impl` here LL | impl From<i32> for Foo { | ~~~~ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-105634.rs b/tests/ui/parser/issues/issue-105634.rs index 579aa6e5b..579aa6e5b 100644 --- a/tests/ui/parser/issue-105634.rs +++ b/tests/ui/parser/issues/issue-105634.rs diff --git a/tests/ui/parser/issues/issue-10636-1.stderr b/tests/ui/parser/issues/issue-10636-1.stderr index 1e6294ebe..a7402e071 100644 --- a/tests/ui/parser/issues/issue-10636-1.stderr +++ b/tests/ui/parser/issues/issue-10636-1.stderr @@ -7,5 +7,5 @@ LL | struct Obj { LL | ) | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-10636-2.stderr b/tests/ui/parser/issues/issue-10636-2.stderr index 4cd4be180..2dc615246 100644 --- a/tests/ui/parser/issues/issue-10636-2.stderr +++ b/tests/ui/parser/issues/issue-10636-2.stderr @@ -9,5 +9,5 @@ LL | option.map(|some| 42; LL | } | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-107705.rs b/tests/ui/parser/issues/issue-107705.rs index b80984fcd..b80984fcd 100644 --- a/tests/ui/parser/issue-107705.rs +++ b/tests/ui/parser/issues/issue-107705.rs diff --git a/tests/ui/parser/issue-107705.stderr b/tests/ui/parser/issues/issue-107705.stderr index d2d613461..2d0c3e0e6 100644 --- a/tests/ui/parser/issue-107705.stderr +++ b/tests/ui/parser/issues/issue-107705.stderr @@ -6,5 +6,5 @@ LL | fn f() {a(b:&, | | | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed b/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed new file mode 100644 index 000000000..b819aa810 --- /dev/null +++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.fixed @@ -0,0 +1,9 @@ +// run-rustfix + +pub fn missing() -> () {} +//~^ ERROR missing parameters for function definition + +pub fn missing2() {} +//~^ ERROR missing parameters for function definition + +fn main() {} diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.rs b/tests/ui/parser/issues/issue-108109-fn-missing-params.rs new file mode 100644 index 000000000..01efe7280 --- /dev/null +++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.rs @@ -0,0 +1,9 @@ +// run-rustfix + +pub fn missing -> () {} +//~^ ERROR missing parameters for function definition + +pub fn missing2 {} +//~^ ERROR missing parameters for function definition + +fn main() {} diff --git a/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr new file mode 100644 index 000000000..86d3449cc --- /dev/null +++ b/tests/ui/parser/issues/issue-108109-fn-missing-params.stderr @@ -0,0 +1,14 @@ +error: missing parameters for function definition + --> $DIR/issue-108109-fn-missing-params.rs:3:15 + | +LL | pub fn missing -> () {} + | ^ help: add a parameter list + +error: missing parameters for function definition + --> $DIR/issue-108109-fn-missing-params.rs:6:16 + | +LL | pub fn missing2 {} + | ^ help: add a parameter list + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed new file mode 100644 index 000000000..eaae28886 --- /dev/null +++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.fixed @@ -0,0 +1,8 @@ +// run-rustfix + +pub fn func<F>() where F: FnOnce() -> () {} +//~^ ERROR expected one of +//~| NOTE expected one of +//~| NOTE `Fn` bounds require arguments in parentheses + +fn main() {} diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs new file mode 100644 index 000000000..ea5c71150 --- /dev/null +++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.rs @@ -0,0 +1,8 @@ +// run-rustfix + +pub fn func<F>() where F: FnOnce -> () {} +//~^ ERROR expected one of +//~| NOTE expected one of +//~| NOTE `Fn` bounds require arguments in parentheses + +fn main() {} diff --git a/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr new file mode 100644 index 000000000..78017babb --- /dev/null +++ b/tests/ui/parser/issues/issue-108109-fn-trait-missing-paren.stderr @@ -0,0 +1,11 @@ +error: expected one of `(`, `+`, `,`, `::`, `<`, or `{`, found `->` + --> $DIR/issue-108109-fn-trait-missing-paren.rs:3:34 + | +LL | pub fn func<F>() where F: FnOnce -> () {} + | -------^^ expected one of `(`, `+`, `,`, `::`, `<`, or `{` + | | | + | | help: try adding parentheses + | `Fn` bounds require arguments in parentheses + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issues/issue-108242-semicolon-recovery.stderr b/tests/ui/parser/issues/issue-108242-semicolon-recovery.stderr index f68d6d501..e12283b25 100644 --- a/tests/ui/parser/issues/issue-108242-semicolon-recovery.stderr +++ b/tests/ui/parser/issues/issue-108242-semicolon-recovery.stderr @@ -9,5 +9,5 @@ LL | foo(; LL | } | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-108495-dec.rs b/tests/ui/parser/issues/issue-108495-dec.rs index e0816f84e..e0816f84e 100644 --- a/tests/ui/parser/issue-108495-dec.rs +++ b/tests/ui/parser/issues/issue-108495-dec.rs diff --git a/tests/ui/parser/issue-108495-dec.stderr b/tests/ui/parser/issues/issue-108495-dec.stderr index 85b29038f..85b29038f 100644 --- a/tests/ui/parser/issue-108495-dec.stderr +++ b/tests/ui/parser/issues/issue-108495-dec.stderr diff --git a/tests/ui/parser/issues/issue-111148.stderr b/tests/ui/parser/issues/issue-111148.stderr index e6595a5cb..bcfca981d 100644 --- a/tests/ui/parser/issues/issue-111148.stderr +++ b/tests/ui/parser/issues/issue-111148.stderr @@ -4,5 +4,5 @@ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `<` LL | fn a<<i<Y<w<># | ^ expected one of `#`, `>`, `const`, identifier, or lifetime -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-111416.stderr b/tests/ui/parser/issues/issue-111416.stderr index ddacf4d6d..36f6c5b01 100644 --- a/tests/ui/parser/issues/issue-111416.stderr +++ b/tests/ui/parser/issues/issue-111416.stderr @@ -14,5 +14,5 @@ LL - let my = monad_bind(mx, T: Try); LL + let my = monad_bind(mx, Try); | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-111692.rs b/tests/ui/parser/issues/issue-111692.rs new file mode 100644 index 000000000..56096f706 --- /dev/null +++ b/tests/ui/parser/issues/issue-111692.rs @@ -0,0 +1,32 @@ +mod module { + #[derive(Eq, PartialEq)] + pub struct Type { + pub x: u8, + pub y: u8, + } + + pub const C: u8 = 32u8; +} + +fn test(x: module::Type) { + if x == module::Type { x: module::C, y: 1 } { //~ ERROR invalid struct literal + } +} + +fn test2(x: module::Type) { + if x ==module::Type { x: module::C, y: 1 } { //~ ERROR invalid struct literal + } +} + + +fn test3(x: module::Type) { + if x == Type { x: module::C, y: 1 } { //~ ERROR invalid struct literal + } +} + +fn test4(x: module::Type) { + if x == demo_module::Type { x: module::C, y: 1 } { //~ ERROR invalid struct literal + } +} + +fn main() { } diff --git a/tests/ui/parser/issues/issue-111692.stderr b/tests/ui/parser/issues/issue-111692.stderr new file mode 100644 index 000000000..068b0483b --- /dev/null +++ b/tests/ui/parser/issues/issue-111692.stderr @@ -0,0 +1,46 @@ +error: invalid struct literal + --> $DIR/issue-111692.rs:12:21 + | +LL | if x == module::Type { x: module::C, y: 1 } { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you might need to surround the struct literal with parentheses + | +LL | if x == (module::Type { x: module::C, y: 1 }) { + | + + + +error: invalid struct literal + --> $DIR/issue-111692.rs:17:20 + | +LL | if x ==module::Type { x: module::C, y: 1 } { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you might need to surround the struct literal with parentheses + | +LL | if x ==(module::Type { x: module::C, y: 1 }) { + | + + + +error: invalid struct literal + --> $DIR/issue-111692.rs:23:13 + | +LL | if x == Type { x: module::C, y: 1 } { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you might need to surround the struct literal with parentheses + | +LL | if x == (Type { x: module::C, y: 1 }) { + | + + + +error: invalid struct literal + --> $DIR/issue-111692.rs:28:26 + | +LL | if x == demo_module::Type { x: module::C, y: 1 } { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: you might need to surround the struct literal with parentheses + | +LL | if x == (demo_module::Type { x: module::C, y: 1 }) { + | + + + +error: aborting due to 4 previous errors + diff --git a/tests/ui/parser/issues/issue-112188.fixed b/tests/ui/parser/issues/issue-112188.fixed new file mode 100644 index 000000000..5e73d8e38 --- /dev/null +++ b/tests/ui/parser/issues/issue-112188.fixed @@ -0,0 +1,14 @@ +// run-rustfix + +#![allow(unused)] + +struct Foo { x: i32 } + +fn main() { + let f = Foo { x: 0 }; + let Foo { .. } = f; + let Foo { .. } = f; //~ ERROR expected `}`, found `,` + let Foo { x, .. } = f; + let Foo { x, .. } = f; //~ ERROR expected `}`, found `,` + let Foo { x, .. } = f; //~ ERROR expected `}`, found `,` +} diff --git a/tests/ui/parser/issues/issue-112188.rs b/tests/ui/parser/issues/issue-112188.rs new file mode 100644 index 000000000..27ca192e5 --- /dev/null +++ b/tests/ui/parser/issues/issue-112188.rs @@ -0,0 +1,14 @@ +// run-rustfix + +#![allow(unused)] + +struct Foo { x: i32 } + +fn main() { + let f = Foo { x: 0 }; + let Foo { .. } = f; + let Foo { .., } = f; //~ ERROR expected `}`, found `,` + let Foo { x, .. } = f; + let Foo { .., x } = f; //~ ERROR expected `}`, found `,` + let Foo { .., x, .. } = f; //~ ERROR expected `}`, found `,` +} diff --git a/tests/ui/parser/issues/issue-112188.stderr b/tests/ui/parser/issues/issue-112188.stderr new file mode 100644 index 000000000..6d2d8e6a3 --- /dev/null +++ b/tests/ui/parser/issues/issue-112188.stderr @@ -0,0 +1,37 @@ +error: expected `}`, found `,` + --> $DIR/issue-112188.rs:10:17 + | +LL | let Foo { .., } = f; + | --^ + | | | + | | expected `}` + | | help: remove this comma + | `..` must be at the end and cannot have a trailing comma + +error: expected `}`, found `,` + --> $DIR/issue-112188.rs:12:17 + | +LL | let Foo { .., x } = f; + | --^ + | | | + | | expected `}` + | `..` must be at the end and cannot have a trailing comma + | +help: move the `..` to the end of the field list + | +LL - let Foo { .., x } = f; +LL + let Foo { x, .. } = f; + | + +error: expected `}`, found `,` + --> $DIR/issue-112188.rs:13:17 + | +LL | let Foo { .., x, .. } = f; + | --^- + | | | + | | expected `}` + | `..` must be at the end and cannot have a trailing comma + | help: remove the starting `..` + +error: aborting due to 3 previous errors + diff --git a/tests/ui/parser/issues/issue-112458.rs b/tests/ui/parser/issues/issue-112458.rs new file mode 100644 index 000000000..36895450c --- /dev/null +++ b/tests/ui/parser/issues/issue-112458.rs @@ -0,0 +1,4 @@ +fn main() { + println!("{}", x.); //~ ERROR unexpected token: `)` + //~^ ERROR cannot find value `x` in this scope +} diff --git a/tests/ui/parser/issues/issue-112458.stderr b/tests/ui/parser/issues/issue-112458.stderr new file mode 100644 index 000000000..54a8f1d03 --- /dev/null +++ b/tests/ui/parser/issues/issue-112458.stderr @@ -0,0 +1,15 @@ +error: unexpected token: `)` + --> $DIR/issue-112458.rs:2:22 + | +LL | println!("{}", x.); + | ^ + +error[E0425]: cannot find value `x` in this scope + --> $DIR/issue-112458.rs:2:20 + | +LL | println!("{}", x.); + | ^ 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/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs new file mode 100644 index 000000000..3b6f43043 --- /dev/null +++ b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.rs @@ -0,0 +1 @@ + 5 //~ ERROR expected item, found `5` diff --git a/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr new file mode 100644 index 000000000..a47dd4103 --- /dev/null +++ b/tests/ui/parser/issues/issue-113110-non-item-at-module-root.stderr @@ -0,0 +1,10 @@ +error: expected item, found `5` + --> $DIR/issue-113110-non-item-at-module-root.rs:1:2 + | +LL | 5 + | ^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issues/issue-113203.rs b/tests/ui/parser/issues/issue-113203.rs new file mode 100644 index 000000000..1103251c1 --- /dev/null +++ b/tests/ui/parser/issues/issue-113203.rs @@ -0,0 +1,7 @@ +// Checks what happens when we attempt to use the await keyword as a prefix. Span +// incorrectly emitted an `.await` in E0277 which does not exist +// edition:2018 +fn main() { + await {}() + //~^ ERROR incorrect use of `await` +} diff --git a/tests/ui/parser/issues/issue-113203.stderr b/tests/ui/parser/issues/issue-113203.stderr new file mode 100644 index 000000000..5db628d59 --- /dev/null +++ b/tests/ui/parser/issues/issue-113203.stderr @@ -0,0 +1,8 @@ +error: incorrect use of `await` + --> $DIR/issue-113203.rs:5:5 + | +LL | await {}() + | ^^^^^^^^ help: `await` is a postfix operation: `{}.await` + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issues/issue-113342.rs b/tests/ui/parser/issues/issue-113342.rs new file mode 100644 index 000000000..18b502736 --- /dev/null +++ b/tests/ui/parser/issues/issue-113342.rs @@ -0,0 +1,9 @@ +#[link(name = "my_c_library")] +extern "C" { + fn my_c_function(x: i32) -> bool; +} + +#[no_mangle] +extern "C" pub fn id(x: i32) -> i32 { x } //~ ERROR expected `fn`, found keyword `pub` + +fn main() {} diff --git a/tests/ui/parser/issues/issue-113342.stderr b/tests/ui/parser/issues/issue-113342.stderr new file mode 100644 index 000000000..6d9f22f6a --- /dev/null +++ b/tests/ui/parser/issues/issue-113342.stderr @@ -0,0 +1,11 @@ +error: expected `fn`, found keyword `pub` + --> $DIR/issue-113342.rs:7:12 + | +LL | extern "C" pub fn id(x: i32) -> i32 { x } + | -----------^^^ + | | | + | | expected `fn` + | help: visibility `pub` must come before `extern "C"`: `pub extern "C"` + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issues/issue-114219.rs b/tests/ui/parser/issues/issue-114219.rs new file mode 100644 index 000000000..332258b62 --- /dev/null +++ b/tests/ui/parser/issues/issue-114219.rs @@ -0,0 +1,4 @@ +fn main() { + async move {}; + //~^ ERROR `async move` blocks are only allowed in Rust 2018 or later +} diff --git a/tests/ui/parser/issues/issue-114219.stderr b/tests/ui/parser/issues/issue-114219.stderr new file mode 100644 index 000000000..02323cb99 --- /dev/null +++ b/tests/ui/parser/issues/issue-114219.stderr @@ -0,0 +1,8 @@ +error: `async move` blocks are only allowed in Rust 2018 or later + --> $DIR/issue-114219.rs:2:5 + | +LL | async move {}; + | ^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs b/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs new file mode 100644 index 000000000..3421333b8 --- /dev/null +++ b/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs @@ -0,0 +1,21 @@ +// Regression test for issue #115780. +// Ensure that we don't emit a parse error for the token sequence `Ident "<" Ty` in pattern position +// if we are inside a macro call since it can be valid input for a subsequent macro rule. +// See also #103534. + +// check-pass + +macro_rules! mdo { + ($p: pat =<< $e: expr ; $( $t: tt )*) => { + $e.and_then(|$p| mdo! { $( $t )* }) + }; + (ret<$ty: ty> $e: expr;) => { Some::<$ty>($e) }; +} + +fn main() { + mdo! { + x_val =<< Some(0); + y_val =<< Some(1); + ret<(i32, i32)> (x_val, y_val); + }; +} diff --git a/tests/ui/parser/issues/issue-118530-ice.rs b/tests/ui/parser/issues/issue-118530-ice.rs new file mode 100644 index 000000000..e758e5af4 --- /dev/null +++ b/tests/ui/parser/issues/issue-118530-ice.rs @@ -0,0 +1,15 @@ +fn bar() -> String { + #[cfg] + [1, 2, 3].iter() //~ ERROR expected `;`, found `#` + #[feature] + attr::fn bar() -> String { //~ ERROR expected identifier, found keyword `fn` + //~^ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `->` + //~| ERROR expected `;`, found `bar` + #[attr] + [1, 2, 3].iter().map().collect::<String>() + #[attr] + +}() +} + +fn main() { } diff --git a/tests/ui/parser/issues/issue-118530-ice.stderr b/tests/ui/parser/issues/issue-118530-ice.stderr new file mode 100644 index 000000000..ef573fb7b --- /dev/null +++ b/tests/ui/parser/issues/issue-118530-ice.stderr @@ -0,0 +1,43 @@ +error: expected `;`, found `#` + --> $DIR/issue-118530-ice.rs:3:21 + | +LL | #[cfg] + | ------ only `;` terminated statements or tail expressions are allowed after this attribute +LL | [1, 2, 3].iter() + | ^ expected `;` here +LL | #[feature] + | - unexpected token + | +help: add `;` here + | +LL | [1, 2, 3].iter(); + | + +help: alternatively, consider surrounding the expression with a block + | +LL | { [1, 2, 3].iter() } + | + + + +error: expected identifier, found keyword `fn` + --> $DIR/issue-118530-ice.rs:5:11 + | +LL | attr::fn bar() -> String { + | ^^ expected identifier, found keyword + +error: expected `;`, found `bar` + --> $DIR/issue-118530-ice.rs:5:13 + | +LL | #[feature] + | ---------- only `;` terminated statements or tail expressions are allowed after this attribute +LL | attr::fn bar() -> String { + | ^--- unexpected token + | | + | help: add `;` here + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `->` + --> $DIR/issue-118530-ice.rs:5:20 + | +LL | attr::fn bar() -> String { + | ^^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: aborting due to 4 previous errors + diff --git a/tests/ui/parser/issues/issue-118531-ice.rs b/tests/ui/parser/issues/issue-118531-ice.rs new file mode 100644 index 000000000..24794f060 --- /dev/null +++ b/tests/ui/parser/issues/issue-118531-ice.rs @@ -0,0 +1,10 @@ +fn bar() -> String { + #[cfg(feature = )] + [1, 2, 3].iter().map().collect::<String>() //~ ERROR expected `;`, found `#` + + #[attr] //~ ERROR attributes on expressions are experimental [E0658] + //~^ ERROR cannot find attribute `attr` in this scope + String::new() +} + +fn main() { } diff --git a/tests/ui/parser/issues/issue-118531-ice.stderr b/tests/ui/parser/issues/issue-118531-ice.stderr new file mode 100644 index 000000000..a32292dcb --- /dev/null +++ b/tests/ui/parser/issues/issue-118531-ice.stderr @@ -0,0 +1,38 @@ +error: expected `;`, found `#` + --> $DIR/issue-118531-ice.rs:3:47 + | +LL | #[cfg(feature = )] + | ------------------ only `;` terminated statements or tail expressions are allowed after this attribute +LL | [1, 2, 3].iter().map().collect::<String>() + | ^ expected `;` here +LL | +LL | #[attr] + | - unexpected token + | +help: add `;` here + | +LL | [1, 2, 3].iter().map().collect::<String>(); + | + +help: alternatively, consider surrounding the expression with a block + | +LL | { [1, 2, 3].iter().map().collect::<String>() } + | + + + +error[E0658]: attributes on expressions are experimental + --> $DIR/issue-118531-ice.rs:5:5 + | +LL | #[attr] + | ^^^^^^^ + | + = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information + = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable + +error: cannot find attribute `attr` in this scope + --> $DIR/issue-118531-ice.rs:5:7 + | +LL | #[attr] + | ^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/parser/issues/issue-14303-fncall.full.stderr b/tests/ui/parser/issues/issue-14303-fncall.full.stderr index 0c152516a..1986f70bf 100644 --- a/tests/ui/parser/issues/issue-14303-fncall.full.stderr +++ b/tests/ui/parser/issues/issue-14303-fncall.full.stderr @@ -4,6 +4,6 @@ error[E0747]: type provided when a lifetime was expected LL | .collect::<Vec<S<_, 'a>>>(); | ^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0747`. diff --git a/tests/ui/parser/issues/issue-14303-fncall.generic_arg.stderr b/tests/ui/parser/issues/issue-14303-fncall.generic_arg.stderr index 571815776..2de59b8c7 100644 --- a/tests/ui/parser/issues/issue-14303-fncall.generic_arg.stderr +++ b/tests/ui/parser/issues/issue-14303-fncall.generic_arg.stderr @@ -4,6 +4,6 @@ error[E0747]: inferred provided when a lifetime was expected LL | .collect::<Vec<S<_, 'a>>>(); | ^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0747`. diff --git a/tests/ui/parser/issues/issue-15914.stderr b/tests/ui/parser/issues/issue-15914.stderr index ea26453f8..c88fd4e55 100644 --- a/tests/ui/parser/issues/issue-15914.stderr +++ b/tests/ui/parser/issues/issue-15914.stderr @@ -4,5 +4,5 @@ error: expected identifier, found `(` LL | (); | ^ expected identifier -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-15980.rs b/tests/ui/parser/issues/issue-15980.rs index 87faa7d5f..eb7b6ca82 100644 --- a/tests/ui/parser/issues/issue-15980.rs +++ b/tests/ui/parser/issues/issue-15980.rs @@ -9,9 +9,6 @@ fn main(){ //~^ ERROR expected identifier, found keyword `return` //~| NOTE expected identifier, found keyword } - //~^ NOTE expected one of `.`, `=>`, `?`, or an operator _ => {} - //~^ ERROR expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_` - //~| NOTE unexpected token } } diff --git a/tests/ui/parser/issues/issue-15980.stderr b/tests/ui/parser/issues/issue-15980.stderr index c59c81119..c3c56c46a 100644 --- a/tests/ui/parser/issues/issue-15980.stderr +++ b/tests/ui/parser/issues/issue-15980.stderr @@ -11,15 +11,10 @@ help: escape `return` to use it as an identifier | LL | r#return | ++ - -error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_` - --> $DIR/issue-15980.rs:13:9 +help: you might have meant to start a match arm after the match guard | -LL | } - | - expected one of `.`, `=>`, `?`, or an operator -LL | -LL | _ => {} - | ^ unexpected token +LL | Err(ref e) if e.kind == io::EndOfFile => { + | ++ -error: aborting due to 2 previous errors +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-1655.stderr b/tests/ui/parser/issues/issue-1655.stderr index 0c390a0ec..536b583aa 100644 --- a/tests/ui/parser/issues/issue-1655.stderr +++ b/tests/ui/parser/issues/issue-1655.stderr @@ -4,5 +4,5 @@ error: expected one of `!` or `[`, found `vec` LL | #vec[doc( | ^^^ expected one of `!` or `[` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-17718-const-mut.stderr b/tests/ui/parser/issues/issue-17718-const-mut.stderr index 8251ce999..a27f51708 100644 --- a/tests/ui/parser/issues/issue-17718-const-mut.stderr +++ b/tests/ui/parser/issues/issue-17718-const-mut.stderr @@ -6,5 +6,5 @@ LL | const LL | mut | ^^^ cannot be mutable -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-17718-parse-const.rs b/tests/ui/parser/issues/issue-17718-parse-const.rs index d5a5f445d..d5a5f445d 100644 --- a/tests/ui/parser/issue-17718-parse-const.rs +++ b/tests/ui/parser/issues/issue-17718-parse-const.rs diff --git a/tests/ui/parser/issues/issue-17904-2.stderr b/tests/ui/parser/issues/issue-17904-2.stderr index 9c7fdf6cc..211ffcedd 100644 --- a/tests/ui/parser/issues/issue-17904-2.stderr +++ b/tests/ui/parser/issues/issue-17904-2.stderr @@ -3,6 +3,8 @@ error: expected item, found keyword `where` | LL | struct Bar<T> { x: T } where T: Copy | ^^^^^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-17904.stderr b/tests/ui/parser/issues/issue-17904.stderr index aa343975d..81c6e3bed 100644 --- a/tests/ui/parser/issues/issue-17904.stderr +++ b/tests/ui/parser/issues/issue-17904.stderr @@ -13,5 +13,5 @@ LL - struct Foo<T> where T: Copy, (T); LL + struct Foo<T>(T) where T: Copy; | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-1802-1.stderr b/tests/ui/parser/issues/issue-1802-1.stderr index 954cc0bee..5ddc5ae58 100644 --- a/tests/ui/parser/issues/issue-1802-1.stderr +++ b/tests/ui/parser/issues/issue-1802-1.stderr @@ -4,6 +4,6 @@ error[E0768]: no valid digits found for number LL | log(error, 0b); | ^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0768`. diff --git a/tests/ui/parser/issues/issue-1802-2.stderr b/tests/ui/parser/issues/issue-1802-2.stderr index 49043d07b..7c802e4bd 100644 --- a/tests/ui/parser/issues/issue-1802-2.stderr +++ b/tests/ui/parser/issues/issue-1802-2.stderr @@ -4,6 +4,6 @@ error[E0768]: no valid digits found for number LL | log(error, 0b); | ^^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0768`. diff --git a/tests/ui/parser/issues/issue-19398.stderr b/tests/ui/parser/issues/issue-19398.stderr index 1da00960a..236fac673 100644 --- a/tests/ui/parser/issues/issue-19398.stderr +++ b/tests/ui/parser/issues/issue-19398.stderr @@ -9,5 +9,5 @@ LL | LL | } | - the item list ends here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-1.stderr b/tests/ui/parser/issues/issue-20616-1.stderr index 816046237..b7a8d22d8 100644 --- a/tests/ui/parser/issues/issue-20616-1.stderr +++ b/tests/ui/parser/issues/issue-20616-1.stderr @@ -4,5 +4,5 @@ error: expected one of `,`, `:`, or `>`, found `T` LL | type Type_1<'a T> = &'a T; | ^ expected one of `,`, `:`, or `>` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-2.stderr b/tests/ui/parser/issues/issue-20616-2.stderr index 42059685c..038b2ffc7 100644 --- a/tests/ui/parser/issues/issue-20616-2.stderr +++ b/tests/ui/parser/issues/issue-20616-2.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | type Type_2 = Type_1_<'static> ()>; | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-3.stderr b/tests/ui/parser/issues/issue-20616-3.stderr index dbff116e5..10e5befe2 100644 --- a/tests/ui/parser/issues/issue-20616-3.stderr +++ b/tests/ui/parser/issues/issue-20616-3.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | type Type_3<T> = Box<T>,,>; | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-4.stderr b/tests/ui/parser/issues/issue-20616-4.stderr index 48a06e00b..df619b4c7 100644 --- a/tests/ui/parser/issues/issue-20616-4.stderr +++ b/tests/ui/parser/issues/issue-20616-4.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | type Type_4<T> = Type_1_<'static>,, T>; | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-5.stderr b/tests/ui/parser/issues/issue-20616-5.stderr index 84bee2ad1..709a5467d 100644 --- a/tests/ui/parser/issues/issue-20616-5.stderr +++ b/tests/ui/parser/issues/issue-20616-5.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | type Type_5<'a> = Type_1_<'a, ()>,,>; | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-6.stderr b/tests/ui/parser/issues/issue-20616-6.stderr index 67de41b97..7fe1f1c45 100644 --- a/tests/ui/parser/issues/issue-20616-6.stderr +++ b/tests/ui/parser/issues/issue-20616-6.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | type Type_6 = Type_5_<'a>,,>; | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-7.stderr b/tests/ui/parser/issues/issue-20616-7.stderr index 3b8e07fa0..d9e97301f 100644 --- a/tests/ui/parser/issues/issue-20616-7.stderr +++ b/tests/ui/parser/issues/issue-20616-7.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | type Type_7 = Box<()>,,>; | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-8.stderr b/tests/ui/parser/issues/issue-20616-8.stderr index e9f37e50f..f8d7dc63c 100644 --- a/tests/ui/parser/issues/issue-20616-8.stderr +++ b/tests/ui/parser/issues/issue-20616-8.stderr @@ -4,5 +4,5 @@ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,` LL | type Type_8<'a,,> = &'a (); | ^ expected one of `#`, `>`, `const`, identifier, or lifetime -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20616-9.stderr b/tests/ui/parser/issues/issue-20616-9.stderr index dc309d1bc..5dccacdb6 100644 --- a/tests/ui/parser/issues/issue-20616-9.stderr +++ b/tests/ui/parser/issues/issue-20616-9.stderr @@ -4,5 +4,5 @@ error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `,` LL | type Type_9<T,,> = Box<T>; | ^ expected one of `#`, `>`, `const`, identifier, or lifetime -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20711-2.stderr b/tests/ui/parser/issues/issue-20711-2.stderr index 12b18bbc5..9fb729895 100644 --- a/tests/ui/parser/issues/issue-20711-2.stderr +++ b/tests/ui/parser/issues/issue-20711-2.stderr @@ -10,5 +10,5 @@ LL | LL | } | - the item list ends here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-20711.stderr b/tests/ui/parser/issues/issue-20711.stderr index 4af4b22be..256fb0ade 100644 --- a/tests/ui/parser/issues/issue-20711.stderr +++ b/tests/ui/parser/issues/issue-20711.stderr @@ -9,5 +9,5 @@ LL | LL | } | - the item list ends here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-21146.stderr b/tests/ui/parser/issues/issue-21146.stderr index c71fda3d6..e83c62afe 100644 --- a/tests/ui/parser/issues/issue-21146.stderr +++ b/tests/ui/parser/issues/issue-21146.stderr @@ -4,5 +4,5 @@ error: expected one of `!` or `::`, found `<eof>` LL | parse_error | ^^^^^^^^^^^ expected one of `!` or `::` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-21153.stderr b/tests/ui/parser/issues/issue-21153.stderr index cbfa9ded3..8839eed84 100644 --- a/tests/ui/parser/issues/issue-21153.stderr +++ b/tests/ui/parser/issues/issue-21153.stderr @@ -9,5 +9,5 @@ LL | LL | } | - the item list ends here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-22647.rs b/tests/ui/parser/issues/issue-22647.rs index a68614106..163cbc69d 100644 --- a/tests/ui/parser/issues/issue-22647.rs +++ b/tests/ui/parser/issues/issue-22647.rs @@ -1,5 +1,5 @@ fn main() { - let caller<F> = |f: F| //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<` + let caller<F> = |f: F| //~ ERROR generic args in patterns require the turbofish syntax where F: Fn() -> i32 { let x = f(); diff --git a/tests/ui/parser/issues/issue-22647.stderr b/tests/ui/parser/issues/issue-22647.stderr index 89b454d19..bdf74af63 100644 --- a/tests/ui/parser/issues/issue-22647.stderr +++ b/tests/ui/parser/issues/issue-22647.stderr @@ -1,8 +1,13 @@ -error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<` +error: generic args in patterns require the turbofish syntax --> $DIR/issue-22647.rs:2:15 | LL | let caller<F> = |f: F| - | ^ expected one of `:`, `;`, `=`, `@`, or `|` + | ^ + | +help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + | +LL | let caller::<F> = |f: F| + | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-22712.rs b/tests/ui/parser/issues/issue-22712.rs index 774de9c7e..92b12b8e1 100644 --- a/tests/ui/parser/issues/issue-22712.rs +++ b/tests/ui/parser/issues/issue-22712.rs @@ -3,7 +3,7 @@ struct Foo<B> { } fn bar() { - let Foo<Vec<u8>> //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<` + let Foo<Vec<u8>> //~ ERROR generic args in patterns require the turbofish syntax } fn main() {} diff --git a/tests/ui/parser/issues/issue-22712.stderr b/tests/ui/parser/issues/issue-22712.stderr index 30fabac65..aeca95ed6 100644 --- a/tests/ui/parser/issues/issue-22712.stderr +++ b/tests/ui/parser/issues/issue-22712.stderr @@ -1,8 +1,13 @@ -error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<` +error: generic args in patterns require the turbofish syntax --> $DIR/issue-22712.rs:6:12 | LL | let Foo<Vec<u8>> - | ^ expected one of `:`, `;`, `=`, `@`, or `|` + | ^ + | +help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + | +LL | let Foo::<Vec<u8>> + | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-2354-1.stderr b/tests/ui/parser/issues/issue-2354-1.stderr index 7ea0f2a98..edd64ecf3 100644 --- a/tests/ui/parser/issues/issue-2354-1.stderr +++ b/tests/ui/parser/issues/issue-2354-1.stderr @@ -4,5 +4,5 @@ error: unexpected closing delimiter: `}` LL | static foo: isize = 2; } | ^ unexpected closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-2354.stderr b/tests/ui/parser/issues/issue-2354.stderr index b89ed3958..fd649a575 100644 --- a/tests/ui/parser/issues/issue-2354.stderr +++ b/tests/ui/parser/issues/issue-2354.stderr @@ -12,5 +12,5 @@ LL | } LL | | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-24197.stderr b/tests/ui/parser/issues/issue-24197.stderr index fd7015ccd..3ef707f39 100644 --- a/tests/ui/parser/issues/issue-24197.stderr +++ b/tests/ui/parser/issues/issue-24197.stderr @@ -4,5 +4,5 @@ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[` LL | let buf[0] = 0; | ^ expected one of `:`, `;`, `=`, `@`, or `|` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-24375.rs b/tests/ui/parser/issues/issue-24375.rs index 1d128d33e..8d1bc579e 100644 --- a/tests/ui/parser/issues/issue-24375.rs +++ b/tests/ui/parser/issues/issue-24375.rs @@ -3,7 +3,7 @@ static tmp : [&'static str; 2] = ["hello", "he"]; fn main() { let z = "hello"; match z { - tmp[0] => {} //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `[` + tmp[0] => {} //~ ERROR expected one of `,`, `=>`, `@`, `if`, `|`, or `}`, found `[` _ => {} } } diff --git a/tests/ui/parser/issues/issue-24375.stderr b/tests/ui/parser/issues/issue-24375.stderr index 7aed88768..2b980a552 100644 --- a/tests/ui/parser/issues/issue-24375.stderr +++ b/tests/ui/parser/issues/issue-24375.stderr @@ -1,8 +1,8 @@ -error: expected one of `=>`, `@`, `if`, or `|`, found `[` +error: expected one of `,`, `=>`, `@`, `if`, `|`, or `}`, found `[` --> $DIR/issue-24375.rs:6:12 | LL | tmp[0] => {} - | ^ expected one of `=>`, `@`, `if`, or `|` + | ^ expected one of `,`, `=>`, `@`, `if`, `|`, or `}` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-24780.stderr b/tests/ui/parser/issues/issue-24780.stderr index d9470191b..43e200102 100644 --- a/tests/ui/parser/issues/issue-24780.stderr +++ b/tests/ui/parser/issues/issue-24780.stderr @@ -4,5 +4,5 @@ error: expected one of `!`, `+`, `::`, `where`, or `{`, found `>` LL | fn foo() -> Vec<usize>> { | ^ expected one of `!`, `+`, `::`, `where`, or `{` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-3036.stderr b/tests/ui/parser/issues/issue-3036.stderr index e02223931..3dd89b7e8 100644 --- a/tests/ui/parser/issues/issue-3036.stderr +++ b/tests/ui/parser/issues/issue-3036.stderr @@ -6,5 +6,5 @@ LL | let _x = 3 LL | } | - unexpected token -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-31804.stderr b/tests/ui/parser/issues/issue-31804.stderr index 76e68b0b3..d3d2c2a0f 100644 --- a/tests/ui/parser/issues/issue-31804.stderr +++ b/tests/ui/parser/issues/issue-31804.stderr @@ -4,5 +4,5 @@ error: expected pattern, found `}` LL | } | ^ expected pattern -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-32214.stderr b/tests/ui/parser/issues/issue-32214.stderr index d0a9b5299..2ef4305df 100644 --- a/tests/ui/parser/issues/issue-32214.stderr +++ b/tests/ui/parser/issues/issue-32214.stderr @@ -11,5 +11,5 @@ help: move the constraint after the generic argument LL | pub fn test<W, I: Trait<W, Item = ()> >() {} | ~~~~~~~~~~~~~~ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-32446.stderr b/tests/ui/parser/issues/issue-32446.stderr index 7515369aa..7319e839b 100644 --- a/tests/ui/parser/issues/issue-32446.stderr +++ b/tests/ui/parser/issues/issue-32446.stderr @@ -7,5 +7,5 @@ LL | trait T { ... } | | non-item starts here | item list starts here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-32501.stderr b/tests/ui/parser/issues/issue-32501.stderr index d53302449..c0513a640 100644 --- a/tests/ui/parser/issues/issue-32501.stderr +++ b/tests/ui/parser/issues/issue-32501.stderr @@ -2,9 +2,9 @@ error: `mut` must be followed by a named binding --> $DIR/issue-32501.rs:7:9 | LL | let mut _ = 0; - | ^^^^^ help: remove the `mut` prefix: `_` + | ^^^^ help: remove the `mut` prefix | = note: `mut` may be followed by `variable` and `variable @ pattern` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-32505.rs b/tests/ui/parser/issues/issue-32505.rs index f31c00e5c..d95e7dc7d 100644 --- a/tests/ui/parser/issues/issue-32505.rs +++ b/tests/ui/parser/issues/issue-32505.rs @@ -1,5 +1,6 @@ pub fn test() { foo(|_|) //~ ERROR expected expression, found `)` + //~^ ERROR cannot find function `foo` in this scope } fn main() { } diff --git a/tests/ui/parser/issues/issue-32505.stderr b/tests/ui/parser/issues/issue-32505.stderr index cdd779a93..27ad2c3e5 100644 --- a/tests/ui/parser/issues/issue-32505.stderr +++ b/tests/ui/parser/issues/issue-32505.stderr @@ -2,7 +2,21 @@ error: expected expression, found `)` --> $DIR/issue-32505.rs:2:12 | LL | foo(|_|) - | ^ expected expression + | ---^ expected expression + | | + | while parsing the body of this closure + | +help: you might have meant to open the body of the closure + | +LL | foo(|_| {}) + | ++ + +error[E0425]: cannot find function `foo` in this scope + --> $DIR/issue-32505.rs:2:5 + | +LL | foo(|_|) + | ^^^ not found in this scope -error: aborting due to previous error +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/parser/issues/issue-33262.stderr b/tests/ui/parser/issues/issue-33262.stderr index 2aff32839..ec4934eb7 100644 --- a/tests/ui/parser/issues/issue-33262.stderr +++ b/tests/ui/parser/issues/issue-33262.stderr @@ -4,5 +4,5 @@ error: expected type, found `{` LL | for i in 0..a as { } | ^ expected type -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-33455.stderr b/tests/ui/parser/issues/issue-33455.stderr index c535ef23b..573614a5e 100644 --- a/tests/ui/parser/issues/issue-33455.stderr +++ b/tests/ui/parser/issues/issue-33455.stderr @@ -4,5 +4,5 @@ error: expected one of `::`, `;`, or `as`, found `.` LL | use foo.bar; | ^ expected one of `::`, `;`, or `as` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-34222-1.stderr b/tests/ui/parser/issues/issue-34222-1.stderr index b451484ba..b2a6ae93a 100644 --- a/tests/ui/parser/issues/issue-34222-1.stderr +++ b/tests/ui/parser/issues/issue-34222-1.stderr @@ -6,6 +6,6 @@ LL | /// comment | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0585`. diff --git a/tests/ui/parser/issues/issue-34255-1.stderr b/tests/ui/parser/issues/issue-34255-1.stderr index 0e2b0d62e..1e72f040b 100644 --- a/tests/ui/parser/issues/issue-34255-1.stderr +++ b/tests/ui/parser/issues/issue-34255-1.stderr @@ -14,5 +14,5 @@ LL - Test::Drill(field: 42); LL + Test::Drill(42); | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-39616.rs b/tests/ui/parser/issues/issue-39616.rs index 46b5aa334..46b5aa334 100644 --- a/tests/ui/parser/issue-39616.rs +++ b/tests/ui/parser/issues/issue-39616.rs diff --git a/tests/ui/parser/issue-39616.stderr b/tests/ui/parser/issues/issue-39616.stderr index 393d1f2e2..da85bcb44 100644 --- a/tests/ui/parser/issue-39616.stderr +++ b/tests/ui/parser/issues/issue-39616.stderr @@ -4,5 +4,5 @@ error: expected type, found `0` LL | fn foo(a: [0; 1]) {} | ^ expected type -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-43196.stderr b/tests/ui/parser/issues/issue-43196.stderr index 4f7ed5cc6..15bbb158c 100644 --- a/tests/ui/parser/issues/issue-43196.stderr +++ b/tests/ui/parser/issues/issue-43196.stderr @@ -11,6 +11,8 @@ error: expected item, found `|` | LL | | | ^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-43692.stderr b/tests/ui/parser/issues/issue-43692.stderr index baf998035..1ce3aa671 100644 --- a/tests/ui/parser/issues/issue-43692.stderr +++ b/tests/ui/parser/issues/issue-43692.stderr @@ -4,5 +4,5 @@ error: invalid start of unicode escape: `_` LL | '\u{_10FFFF}'; | ^ invalid start of unicode escape -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-44021.stderr b/tests/ui/parser/issues/issue-44021.stderr index b888cd989..8a9326f90 100644 --- a/tests/ui/parser/issues/issue-44021.stderr +++ b/tests/ui/parser/issues/issue-44021.stderr @@ -4,5 +4,5 @@ error: expected one of `:`, `@`, or `|`, found `}` LL | fn f() {|x, y} | ^ expected one of `:`, `@`, or `|` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr index 69ff64c27..d005f116e 100644 --- a/tests/ui/parser/issues/issue-44406.stderr +++ b/tests/ui/parser/issues/issue-44406.stderr @@ -18,5 +18,5 @@ LL - bar(baz: $rest) LL + bar(: $rest) | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-45296.stderr b/tests/ui/parser/issues/issue-45296.stderr index 081a72054..1d2281df1 100644 --- a/tests/ui/parser/issues/issue-45296.stderr +++ b/tests/ui/parser/issues/issue-45296.stderr @@ -13,5 +13,5 @@ LL - #![allow(unused_variables)] LL + #[allow(unused_variables)] | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-46186.stderr b/tests/ui/parser/issues/issue-46186.stderr index 0766c8a33..c67c271e1 100644 --- a/tests/ui/parser/issues/issue-46186.stderr +++ b/tests/ui/parser/issues/issue-46186.stderr @@ -6,5 +6,5 @@ LL | }; | = help: braced struct declarations are not followed by a semicolon -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-48508.rs b/tests/ui/parser/issues/issue-48508.rs index 1e7db9df8..b66e09620 100644 --- a/tests/ui/parser/issues/issue-48508.rs +++ b/tests/ui/parser/issues/issue-48508.rs @@ -7,7 +7,6 @@ // issue-48508-aux.rs // compile-flags:-g -// ignore-asmjs wasm2js does not support source maps yet #![allow(uncommon_codepoints)] diff --git a/tests/ui/parser/issues/issue-48636.stderr b/tests/ui/parser/issues/issue-48636.stderr index 6177870d1..488a046a5 100644 --- a/tests/ui/parser/issues/issue-48636.stderr +++ b/tests/ui/parser/issues/issue-48636.stderr @@ -10,6 +10,6 @@ LL | /// The ID of the parent core | = help: doc comments must come before what they document, if a comment was intended use `//` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0585`. diff --git a/tests/ui/parser/issue-49257.rs b/tests/ui/parser/issues/issue-49257.rs index a7fa19d52..a7fa19d52 100644 --- a/tests/ui/parser/issue-49257.rs +++ b/tests/ui/parser/issues/issue-49257.rs diff --git a/tests/ui/parser/issue-49257.stderr b/tests/ui/parser/issues/issue-49257.stderr index 846467f7f..97e16f88b 100644 --- a/tests/ui/parser/issue-49257.stderr +++ b/tests/ui/parser/issues/issue-49257.stderr @@ -25,7 +25,7 @@ LL | let Point { .., y } = p; help: move the `..` to the end of the field list | LL - let Point { .., y } = p; -LL + let Point { y , .. } = p; +LL + let Point { y, .. } = p; | error: expected `}`, found `,` diff --git a/tests/ui/parser/issues/issue-51602.stderr b/tests/ui/parser/issues/issue-51602.stderr index 4a5653fdb..7b50e0ad0 100644 --- a/tests/ui/parser/issues/issue-51602.stderr +++ b/tests/ui/parser/issues/issue-51602.stderr @@ -10,5 +10,5 @@ note: the `if` expression is missing a block after this condition LL | if i in 1..10 { | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-52496.stderr b/tests/ui/parser/issues/issue-52496.stderr index 77335c64c..78c81bf5b 100644 --- a/tests/ui/parser/issues/issue-52496.stderr +++ b/tests/ui/parser/issues/issue-52496.stderr @@ -8,10 +8,15 @@ error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/issue-52496.rs:8:22 | LL | let _ = Foo { bar.into(), bat: -1, . }; - | --- - ^ expected one of `,`, `:`, or `}` + | --- ---^ expected one of `,`, `:`, or `}` | | | - | | help: try naming a field: `bar:` + | | while parsing this struct field | while parsing this struct + | +help: try naming a field + | +LL | let _ = Foo { bar: bar.into(), bat: -1, . }; + | ++++ error: expected identifier, found `.` --> $DIR/issue-52496.rs:8:40 diff --git a/tests/ui/parser/issues/issue-5544-a.stderr b/tests/ui/parser/issues/issue-5544-a.stderr index 6e68c7585..aeb134600 100644 --- a/tests/ui/parser/issues/issue-5544-a.stderr +++ b/tests/ui/parser/issues/issue-5544-a.stderr @@ -6,5 +6,5 @@ LL | let __isize = 340282366920938463463374607431768211456; // 2^128 | = note: value exceeds limit of `340282366920938463463374607431768211455` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-5544-b.stderr b/tests/ui/parser/issues/issue-5544-b.stderr index 5d0e76d5d..65e6f196b 100644 --- a/tests/ui/parser/issues/issue-5544-b.stderr +++ b/tests/ui/parser/issues/issue-5544-b.stderr @@ -6,5 +6,5 @@ LL | let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff; | = note: value exceeds limit of `0xffffffffffffffffffffffffffffffff` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-56031.stderr b/tests/ui/parser/issues/issue-56031.stderr index 2fa05dd2d..8031bf82f 100644 --- a/tests/ui/parser/issues/issue-56031.stderr +++ b/tests/ui/parser/issues/issue-56031.stderr @@ -14,5 +14,5 @@ LL - impl for T {} LL + impl T {} | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-57198.stderr b/tests/ui/parser/issues/issue-57198.stderr index dd70b4022..dca0d3ea4 100644 --- a/tests/ui/parser/issues/issue-57198.stderr +++ b/tests/ui/parser/issues/issue-57198.stderr @@ -9,5 +9,5 @@ help: escape `for` to use it as an identifier LL | m::r#for(); | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-5806.stderr b/tests/ui/parser/issues/issue-5806.stderr index bdb5c91ff..4b025bd19 100644 --- a/tests/ui/parser/issues/issue-5806.stderr +++ b/tests/ui/parser/issues/issue-5806.stderr @@ -4,5 +4,5 @@ error: couldn't read $DIR/../parser: $ACCESS_DENIED_MSG (os error $ACCESS_DENIED LL | mod foo; | ^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs index a596a9f2d..a2ea8ad36 100644 --- a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs +++ b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.rs @@ -1,5 +1,5 @@ // Fixed in #66054. // ignore-tidy-trailing-newlines // error-pattern: this file contains an unclosed delimiter -// error-pattern: aborting due to previous error +// error-pattern: aborting due to 1 previous error #[Ѕ
\ No newline at end of file diff --git a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr index c79e8b4fb..14f5469f6 100644 --- a/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr +++ b/tests/ui/parser/issues/issue-58094-missing-right-square-bracket.stderr @@ -6,5 +6,5 @@ LL | #[Ѕ | | | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-58856-1.stderr b/tests/ui/parser/issues/issue-58856-1.stderr index 77ad8acbd..2c3334391 100644 --- a/tests/ui/parser/issues/issue-58856-1.stderr +++ b/tests/ui/parser/issues/issue-58856-1.stderr @@ -8,5 +8,5 @@ LL | fn b(self> LL | } | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-58856-2.stderr b/tests/ui/parser/issues/issue-58856-2.stderr index 5fcf5bcc1..d3255fca0 100644 --- a/tests/ui/parser/issues/issue-58856-2.stderr +++ b/tests/ui/parser/issues/issue-58856-2.stderr @@ -9,5 +9,5 @@ LL | fn how_are_you(&self -> Empty { LL | } | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-60075.stderr b/tests/ui/parser/issues/issue-60075.stderr index cd8f1231f..b40412aba 100644 --- a/tests/ui/parser/issues/issue-60075.stderr +++ b/tests/ui/parser/issues/issue-60075.stderr @@ -7,5 +7,5 @@ LL | let _ = if true { LL | }); | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-61858.rs b/tests/ui/parser/issues/issue-61858.rs index 6c3b56586..6c3b56586 100644 --- a/tests/ui/parser/issue-61858.rs +++ b/tests/ui/parser/issues/issue-61858.rs diff --git a/tests/ui/parser/issue-61858.stderr b/tests/ui/parser/issues/issue-61858.stderr index 03f51c6e3..6bdfec938 100644 --- a/tests/ui/parser/issue-61858.stderr +++ b/tests/ui/parser/issues/issue-61858.stderr @@ -10,5 +10,5 @@ note: the `if` expression is missing a block after this condition LL | (if foobar) | ^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62524.rs b/tests/ui/parser/issues/issue-62524.rs index fa7c626f5..dd86fc9a7 100644 --- a/tests/ui/parser/issues/issue-62524.rs +++ b/tests/ui/parser/issues/issue-62524.rs @@ -1,5 +1,5 @@ // ignore-tidy-trailing-newlines -// error-pattern: aborting due to previous error +// error-pattern: aborting due to 1 previous error #![allow(uncommon_codepoints)] y![ diff --git a/tests/ui/parser/issues/issue-62524.stderr b/tests/ui/parser/issues/issue-62524.stderr index 0cbaacd4c..d83a49aed 100644 --- a/tests/ui/parser/issues/issue-62524.stderr +++ b/tests/ui/parser/issues/issue-62524.stderr @@ -6,5 +6,5 @@ LL | y![ LL | Ϥ, | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62546.stderr b/tests/ui/parser/issues/issue-62546.stderr index 80c1c7168..6889cb3b8 100644 --- a/tests/ui/parser/issues/issue-62546.stderr +++ b/tests/ui/parser/issues/issue-62546.stderr @@ -4,5 +4,5 @@ error: this file contains an unclosed delimiter LL | pub t(# | - unclosed delimiter ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62554.stderr b/tests/ui/parser/issues/issue-62554.stderr index 4637c795a..37314dd39 100644 --- a/tests/ui/parser/issues/issue-62554.stderr +++ b/tests/ui/parser/issues/issue-62554.stderr @@ -9,5 +9,5 @@ LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s | | | unclosed delimiter | unclosed delimiter unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62660.stderr b/tests/ui/parser/issues/issue-62660.stderr index 14c0bdcb1..310b433f2 100644 --- a/tests/ui/parser/issues/issue-62660.stderr +++ b/tests/ui/parser/issues/issue-62660.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | pub fn foo(_: i32, self: Box<Self>) {} | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62881.stderr b/tests/ui/parser/issues/issue-62881.stderr index e57cbd181..2165a81a0 100644 --- a/tests/ui/parser/issues/issue-62881.stderr +++ b/tests/ui/parser/issues/issue-62881.stderr @@ -4,5 +4,5 @@ error: this file contains an unclosed delimiter LL | fn f() -> isize { fn f() -> isize {} pub f< | - unclosed delimiter ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62894.stderr b/tests/ui/parser/issues/issue-62894.stderr index 700479076..870633fc9 100644 --- a/tests/ui/parser/issues/issue-62894.stderr +++ b/tests/ui/parser/issues/issue-62894.stderr @@ -10,5 +10,5 @@ LL | LL | fn main() {} | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-62913.stderr b/tests/ui/parser/issues/issue-62913.stderr index 6f385e8dc..c33e46837 100644 --- a/tests/ui/parser/issues/issue-62913.stderr +++ b/tests/ui/parser/issues/issue-62913.stderr @@ -17,6 +17,8 @@ error: expected item, found `"\u\"` | LL | "\u\" | ^^^^^^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-63135.rs b/tests/ui/parser/issues/issue-63135.rs index d61197dc5..2e1ac080b 100644 --- a/tests/ui/parser/issues/issue-63135.rs +++ b/tests/ui/parser/issues/issue-63135.rs @@ -1,3 +1,3 @@ // error-pattern: this file contains an unclosed delimiter -// error-pattern: aborting due to previous error +// error-pattern: aborting due to 1 previous error fn i(n{...,f # diff --git a/tests/ui/parser/issues/issue-63135.stderr b/tests/ui/parser/issues/issue-63135.stderr index ff9d99c28..9204f561e 100644 --- a/tests/ui/parser/issues/issue-63135.stderr +++ b/tests/ui/parser/issues/issue-63135.stderr @@ -7,5 +7,5 @@ LL | fn i(n{...,f # | | unclosed delimiter | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr index 8c032e588..2bd87ee0c 100644 --- a/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr +++ b/tests/ui/parser/issues/issue-65122-mac-invoc-in-mut-patterns.stderr @@ -2,7 +2,7 @@ error: `mut` must be followed by a named binding --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:6:13 | LL | let mut $eval = (); - | ^^^^^^^^^ help: remove the `mut` prefix: `does_not_exist!()` + | ^^^^ help: remove the `mut` prefix ... LL | mac1! { does_not_exist!() } | --------------------------- in this macro invocation @@ -25,7 +25,7 @@ error: `mut` must be followed by a named binding --> $DIR/issue-65122-mac-invoc-in-mut-patterns.rs:13:13 | LL | let mut $eval = (); - | ^^^ help: remove the `mut` prefix: `does_not_exist!()` + | ^^^ help: remove the `mut` prefix ... LL | mac2! { does_not_exist!() } | --------------------------- in this macro invocation diff --git a/tests/ui/parser/issues/issue-6610.stderr b/tests/ui/parser/issues/issue-6610.stderr index 4a3bc7525..83fc02996 100644 --- a/tests/ui/parser/issues/issue-6610.stderr +++ b/tests/ui/parser/issues/issue-6610.stderr @@ -6,5 +6,5 @@ LL | trait Foo { fn a() } | | | while parsing this `fn` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr index 079fff37e..a265cbf70 100644 --- a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr +++ b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr @@ -7,5 +7,5 @@ LL | fn f() { |[](* } | | unclosed delimiter | closing delimiter possibly meant for this -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-68091-unicode-ident-after-if.rs b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs index 57d36feb3..57d36feb3 100644 --- a/tests/ui/parser/issue-68091-unicode-ident-after-if.rs +++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.rs diff --git a/tests/ui/parser/issue-68091-unicode-ident-after-if.stderr b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr index 6674b924e..2423a7526 100644 --- a/tests/ui/parser/issue-68091-unicode-ident-after-if.stderr +++ b/tests/ui/parser/issues/issue-68091-unicode-ident-after-if.stderr @@ -6,5 +6,5 @@ LL | $($c)ö* {} | | | expected condition here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs index 1a90b4724..1a90b4724 100644 --- a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.rs +++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.rs diff --git a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr index 0b9c364f1..43047ff88 100644 --- a/tests/ui/parser/issue-68092-unicode-ident-after-incomplete-expr.stderr +++ b/tests/ui/parser/issues/issue-68092-unicode-ident-after-incomplete-expr.stderr @@ -4,5 +4,5 @@ error: macro expansion ends with an incomplete expression: expected expression LL | $($c)ö* | ^ expected expression -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-68890.stderr b/tests/ui/parser/issues/issue-68890.stderr index 2a3bf6b41..43ed69dcf 100644 --- a/tests/ui/parser/issues/issue-68890.stderr +++ b/tests/ui/parser/issues/issue-68890.stderr @@ -8,13 +8,19 @@ error: expected one of `)`, `+`, or `,`, found `a` --> $DIR/issue-68890.rs:1:15 | LL | enum e{A((?'a a+?+l))} - | ^ expected one of `)`, `+`, or `,` + | - ^ expected one of `)`, `+`, or `,` + | | + | while parsing this enum + | + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` error: expected item, found `)` --> $DIR/issue-68890.rs:1:21 | LL | enum e{A((?'a a+?+l))} | ^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs index 30e7ef467..30e7ef467 100644 --- a/tests/ui/parser/issue-68987-unmatch-issue-1.rs +++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.rs diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr index 2d873b461..5b5d45a7e 100644 --- a/tests/ui/parser/issue-68987-unmatch-issue-1.stderr +++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-1.stderr @@ -12,5 +12,5 @@ LL | } LL | } | ^ unexpected closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs index 89aaa68ba..89aaa68ba 100644 --- a/tests/ui/parser/issue-68987-unmatch-issue-2.rs +++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.rs diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr index 0ecb748a0..0ecb748a0 100644 --- a/tests/ui/parser/issue-68987-unmatch-issue-2.stderr +++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-2.stderr diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs index e98df8d7c..e98df8d7c 100644 --- a/tests/ui/parser/issue-68987-unmatch-issue-3.rs +++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.rs diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr index dfc4407ed..dfc4407ed 100644 --- a/tests/ui/parser/issue-68987-unmatch-issue-3.stderr +++ b/tests/ui/parser/issues/issue-68987-unmatch-issue-3.stderr diff --git a/tests/ui/parser/issue-68987-unmatch-issue.rs b/tests/ui/parser/issues/issue-68987-unmatch-issue.rs index 5a3620bf2..5a3620bf2 100644 --- a/tests/ui/parser/issue-68987-unmatch-issue.rs +++ b/tests/ui/parser/issues/issue-68987-unmatch-issue.rs diff --git a/tests/ui/parser/issue-68987-unmatch-issue.stderr b/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr index cabd13324..782b85f09 100644 --- a/tests/ui/parser/issue-68987-unmatch-issue.stderr +++ b/tests/ui/parser/issues/issue-68987-unmatch-issue.stderr @@ -12,5 +12,5 @@ LL | } LL | } | ^ unexpected closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-69259.stderr b/tests/ui/parser/issues/issue-69259.stderr index 604b7de33..a8487b5f4 100644 --- a/tests/ui/parser/issues/issue-69259.stderr +++ b/tests/ui/parser/issues/issue-69259.stderr @@ -4,5 +4,5 @@ error: unexpected closing delimiter: `)` LL | fn f) {} | ^ unexpected closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-70552-ascription-in-parens-after-call.stderr b/tests/ui/parser/issues/issue-70552-ascription-in-parens-after-call.stderr index f03c92e1b..14cf52ce6 100644 --- a/tests/ui/parser/issues/issue-70552-ascription-in-parens-after-call.stderr +++ b/tests/ui/parser/issues/issue-70552-ascription-in-parens-after-call.stderr @@ -4,5 +4,5 @@ error: expected expression, found `:` LL | expr as fun()(:); | ^ expected expression -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-1.stderr b/tests/ui/parser/issues/issue-70583-block-is-empty-1.stderr index 46cbb056d..c4621b2b8 100644 --- a/tests/ui/parser/issues/issue-70583-block-is-empty-1.stderr +++ b/tests/ui/parser/issues/issue-70583-block-is-empty-1.stderr @@ -9,5 +9,5 @@ LL | } LL | } | ^ unexpected closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs b/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs index 80f53338a..92ff0ef64 100644 --- a/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs +++ b/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs @@ -6,9 +6,13 @@ pub enum ErrorHandled { impl ErrorHandled { pub fn assert_reported(self) { match self { + //~^ NOTE this delimiter might not be properly closed... ErrorHandled::Reported => {}} - //^~ ERROR block is empty, you might have not meant to close it + //~^ NOTE block is empty, you might have not meant to close it + //~| NOTE as it matches this but it has different indentation ErrorHandled::TooGeneric => panic!(), } } -} //~ ERROR unexpected closing delimiter: `}` +} +//~^ ERROR unexpected closing delimiter: `}` +//~| NOTE unexpected closing delimiter diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr b/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr index 9ae94c701..a21cd4875 100644 --- a/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr +++ b/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr @@ -1,8 +1,9 @@ error: unexpected closing delimiter: `}` - --> $DIR/issue-70583-block-is-empty-2.rs:14:1 + --> $DIR/issue-70583-block-is-empty-2.rs:16:1 | LL | match self { | - this delimiter might not be properly closed... +LL | LL | ErrorHandled::Reported => {}} | --- ...as it matches this but it has different indentation | | @@ -11,5 +12,5 @@ LL | ErrorHandled::Reported => {}} LL | } | ^ unexpected closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-72253.stderr b/tests/ui/parser/issues/issue-72253.stderr index 477fa09f4..c4fc662f5 100644 --- a/tests/ui/parser/issues/issue-72253.stderr +++ b/tests/ui/parser/issues/issue-72253.stderr @@ -6,5 +6,5 @@ LL | .arg("1") LL | ,arg("2") | ^ unexpected token -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-72373.stderr b/tests/ui/parser/issues/issue-72373.stderr index 0bb99a01e..c596c6abd 100644 --- a/tests/ui/parser/issues/issue-72373.stderr +++ b/tests/ui/parser/issues/issue-72373.stderr @@ -9,5 +9,5 @@ help: if you meant to bind the contents of the rest of the array pattern into `t LL | [h, ref ts @ ..] => foo(c, n - h) + foo(ts, n), | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-async.stderr b/tests/ui/parser/issues/issue-76437-async.stderr index 2c9c2a8cf..7f2df5c87 100644 --- a/tests/ui/parser/issues/issue-76437-async.stderr +++ b/tests/ui/parser/issues/issue-76437-async.stderr @@ -7,5 +7,5 @@ LL | async pub fn t() {} | | expected one of `extern`, `fn`, or `unsafe` | help: visibility `pub` must come before `async`: `pub async` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-const-async-unsafe.stderr b/tests/ui/parser/issues/issue-76437-const-async-unsafe.stderr index 2e91beda1..a703fc4e8 100644 --- a/tests/ui/parser/issues/issue-76437-const-async-unsafe.stderr +++ b/tests/ui/parser/issues/issue-76437-const-async-unsafe.stderr @@ -7,5 +7,5 @@ LL | const async unsafe pub fn t() {} | | expected one of `extern` or `fn` | help: visibility `pub` must come before `const async unsafe`: `pub const async unsafe` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-const-async.stderr b/tests/ui/parser/issues/issue-76437-const-async.stderr index 21b96c14d..a9acccdce 100644 --- a/tests/ui/parser/issues/issue-76437-const-async.stderr +++ b/tests/ui/parser/issues/issue-76437-const-async.stderr @@ -7,5 +7,5 @@ LL | const async pub fn t() {} | | expected one of `extern`, `fn`, or `unsafe` | help: visibility `pub` must come before `const async`: `pub const async` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-const.stderr b/tests/ui/parser/issues/issue-76437-const.stderr index cf80d9a90..4c36d773d 100644 --- a/tests/ui/parser/issues/issue-76437-const.stderr +++ b/tests/ui/parser/issues/issue-76437-const.stderr @@ -7,5 +7,5 @@ LL | const pub fn t() {} | | expected one of `async`, `extern`, `fn`, or `unsafe` | help: visibility `pub` must come before `const`: `pub const` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr b/tests/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr index fa8f13721..4ea76179b 100644 --- a/tests/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr +++ b/tests/ui/parser/issues/issue-76437-pub-crate-unsafe.stderr @@ -7,5 +7,5 @@ LL | unsafe pub(crate) fn t() {} | | expected one of `extern` or `fn` | help: visibility `pub(crate)` must come before `unsafe`: `pub(crate) unsafe` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76437-unsafe.stderr b/tests/ui/parser/issues/issue-76437-unsafe.stderr index c63292ef8..69f792775 100644 --- a/tests/ui/parser/issues/issue-76437-unsafe.stderr +++ b/tests/ui/parser/issues/issue-76437-unsafe.stderr @@ -7,5 +7,5 @@ LL | unsafe pub fn t() {} | | expected one of `extern` or `fn` | help: visibility `pub` must come before `unsafe`: `pub unsafe` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-76597.stderr b/tests/ui/parser/issues/issue-76597.stderr index 50b23329f..25858981c 100644 --- a/tests/ui/parser/issues/issue-76597.stderr +++ b/tests/ui/parser/issues/issue-76597.stderr @@ -9,5 +9,5 @@ LL | ... x: u8 LL | ... y: u8, | ^ unexpected token -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-7970b.stderr b/tests/ui/parser/issues/issue-7970b.stderr index a62226a8a..b23b09e75 100644 --- a/tests/ui/parser/issues/issue-7970b.stderr +++ b/tests/ui/parser/issues/issue-7970b.stderr @@ -4,5 +4,5 @@ error: unexpected end of macro invocation LL | macro_rules! test {} | ^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-81804.rs b/tests/ui/parser/issues/issue-81804.rs index ebc4752a1..ebc4752a1 100644 --- a/tests/ui/parser/issue-81804.rs +++ b/tests/ui/parser/issues/issue-81804.rs diff --git a/tests/ui/parser/issue-81804.stderr b/tests/ui/parser/issues/issue-81804.stderr index de3b33ecd..de3b33ecd 100644 --- a/tests/ui/parser/issue-81804.stderr +++ b/tests/ui/parser/issues/issue-81804.stderr diff --git a/tests/ui/parser/issues/issue-81806.stderr b/tests/ui/parser/issues/issue-81806.stderr index 40873388d..f1287b82f 100644 --- a/tests/ui/parser/issues/issue-81806.stderr +++ b/tests/ui/parser/issues/issue-81806.stderr @@ -13,5 +13,5 @@ help: escape `impl` to use it as an identifier LL | r#impl | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-81827.rs b/tests/ui/parser/issues/issue-81827.rs index 91defd12a..91defd12a 100644 --- a/tests/ui/parser/issue-81827.rs +++ b/tests/ui/parser/issues/issue-81827.rs diff --git a/tests/ui/parser/issue-81827.stderr b/tests/ui/parser/issues/issue-81827.stderr index 63d135f73..63d135f73 100644 --- a/tests/ui/parser/issue-81827.stderr +++ b/tests/ui/parser/issues/issue-81827.stderr diff --git a/tests/ui/parser/issues/issue-83639.stderr b/tests/ui/parser/issues/issue-83639.stderr index 4c10df191..87218a448 100644 --- a/tests/ui/parser/issues/issue-83639.stderr +++ b/tests/ui/parser/issues/issue-83639.stderr @@ -4,5 +4,5 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `" "` LL | """ " | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-84104.stderr b/tests/ui/parser/issues/issue-84104.stderr index 7ad59f845..e866d3922 100644 --- a/tests/ui/parser/issues/issue-84104.stderr +++ b/tests/ui/parser/issues/issue-84104.stderr @@ -6,5 +6,5 @@ LL | #[i=i::<ښܖ< | | | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-84117.stderr b/tests/ui/parser/issues/issue-84117.stderr index 237bc11bd..958f3b40b 100644 --- a/tests/ui/parser/issues/issue-84117.stderr +++ b/tests/ui/parser/issues/issue-84117.stderr @@ -47,6 +47,7 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } | | | while parsing the type for `inner_local` | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: you might have meant to end the type parameters here | LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str>, } @@ -61,6 +62,8 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, fo | LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } | ^ expected one of 8 possible tokens + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,` --> $DIR/issue-84117.rs:2:33 diff --git a/tests/ui/parser/issues/issue-84148-2.stderr b/tests/ui/parser/issues/issue-84148-2.stderr index 20761180e..d9b6b336a 100644 --- a/tests/ui/parser/issues/issue-84148-2.stderr +++ b/tests/ui/parser/issues/issue-84148-2.stderr @@ -6,5 +6,5 @@ LL | fn f(t:for<>t? | | | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-8537.stderr b/tests/ui/parser/issues/issue-8537.stderr index 523cc9dc5..0d636bd28 100644 --- a/tests/ui/parser/issues/issue-8537.stderr +++ b/tests/ui/parser/issues/issue-8537.stderr @@ -6,6 +6,6 @@ LL | "invalid-ab_isize" | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions. -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0703`. diff --git a/tests/ui/parser/issues/issue-86895.stderr b/tests/ui/parser/issues/issue-86895.stderr index 575d857c0..dcde7242d 100644 --- a/tests/ui/parser/issues/issue-86895.stderr +++ b/tests/ui/parser/issues/issue-86895.stderr @@ -4,5 +4,5 @@ error: expected one of `async`, `extern`, `fn`, or `unsafe`, found keyword `pub` LL | const pub () {} | ^^^ expected one of `async`, `extern`, `fn`, or `unsafe` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs index df0cd5439..099178a7d 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs +++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.rs @@ -7,3 +7,8 @@ const async const fn test() {} //~| NOTE expected one of `extern`, `fn`, or `unsafe` //~| HELP `const` already used earlier, remove this one //~| NOTE `const` first seen here +//~| ERROR functions cannot be both `const` and `async` +//~| NOTE `const` because of this +//~| NOTE `async` because of this + +fn main() {} diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr index 977c6ebfe..4c55179ce 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/const-async-const.stderr @@ -13,5 +13,14 @@ note: `const` first seen here LL | const async const fn test() {} | ^^^^^ -error: aborting due to previous error +error: functions cannot be both `const` and `async` + --> $DIR/const-async-const.rs:5:1 + | +LL | const async const fn test() {} + | ^^^^^-^^^^^------------------- + | | | + | | `async` because of this + | `const` because of this + +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs new file mode 100644 index 000000000..9d7fe4389 --- /dev/null +++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.rs @@ -0,0 +1,22 @@ +// test for #115714 + +struct Misplaced; + +impl Misplaced { + unsafe const fn from_u32(val: u32) {} + //~^ ERROR expected one of `extern` or `fn` + fn oof(self){} +} + +struct Duplicated; + +impl Duplicated { + unsafe unsafe fn from_u32(val: u32) {} + //~^ ERROR expected one of `extern` or `fn` + fn oof(self){} +} + +fn main() { + Misplaced.oof(); + Duplicated.oof(); +} diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr new file mode 100644 index 000000000..3f504a9eb --- /dev/null +++ b/tests/ui/parser/issues/issue-87217-keyword-order/recovery.stderr @@ -0,0 +1,28 @@ +error: expected one of `extern` or `fn`, found keyword `const` + --> $DIR/recovery.rs:6:12 + | +LL | unsafe const fn from_u32(val: u32) {} + | -------^^^^^ + | | | + | | expected one of `extern` or `fn` + | help: `const` must come before `unsafe`: `const unsafe` + | + = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` + +error: expected one of `extern` or `fn`, found keyword `unsafe` + --> $DIR/recovery.rs:14:12 + | +LL | unsafe unsafe fn from_u32(val: u32) {} + | ^^^^^^ + | | + | expected one of `extern` or `fn` + | help: `unsafe` already used earlier, remove this one + | +note: `unsafe` first seen here + --> $DIR/recovery.rs:14:5 + | +LL | unsafe unsafe fn from_u32(val: u32) {} + | ^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs index bbebc99e9..479426626 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs +++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.rs @@ -12,3 +12,8 @@ async unsafe const fn test() {} //~| HELP `const` must come before `async unsafe` //~| SUGGESTION const async unsafe //~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` +//~| ERROR functions cannot be both `const` and `async` +//~| NOTE `const` because of this +//~| NOTE `async` because of this + +fn main() {} diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr index f455caba1..489e8eefb 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/several-kw-jump.stderr @@ -9,5 +9,14 @@ LL | async unsafe const fn test() {} | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` -error: aborting due to previous error +error: functions cannot be both `const` and `async` + --> $DIR/several-kw-jump.rs:9:1 + | +LL | async unsafe const fn test() {} + | ^^^^^--------^^^^^------------- + | | | + | | `const` because of this + | `async` because of this + +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs index 4ff4cf5c8..867f71c12 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.rs @@ -12,3 +12,5 @@ unsafe async fn test() {} //~| HELP `async` must come before `unsafe` //~| SUGGESTION async unsafe //~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` + +fn main() {} diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr index e9eb14bf0..74989502e 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-async.stderr @@ -9,5 +9,5 @@ LL | unsafe async fn test() {} | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs index 2f5fbc513..9a7f28210 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.rs @@ -12,3 +12,5 @@ unsafe const fn test() {} //~| HELP `const` must come before `unsafe` //~| SUGGESTION const unsafe //~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` + +fn main() {} diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr index 0d2bc3472..5958f0c7d 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-const.stderr @@ -9,5 +9,5 @@ LL | unsafe const fn test() {} | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs index df2412e3e..8305ff4f6 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.rs @@ -12,3 +12,5 @@ extern unsafe fn test() {} //~| HELP `unsafe` must come before `extern` //~| SUGGESTION unsafe extern //~| NOTE keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` + +fn main() {} diff --git a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr index 4224713cc..0e9f7c51e 100644 --- a/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr +++ b/tests/ui/parser/issues/issue-87217-keyword-order/wrong-unsafe.stderr @@ -9,5 +9,5 @@ LL | extern unsafe fn test() {} | = note: keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-87694-duplicated-pub.rs b/tests/ui/parser/issues/issue-87694-duplicated-pub.rs index e3ea61dc4..e3ea61dc4 100644 --- a/tests/ui/parser/issue-87694-duplicated-pub.rs +++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.rs diff --git a/tests/ui/parser/issue-87694-duplicated-pub.stderr b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr index 8d242bc9d..a21023865 100644 --- a/tests/ui/parser/issue-87694-duplicated-pub.stderr +++ b/tests/ui/parser/issues/issue-87694-duplicated-pub.stderr @@ -13,5 +13,5 @@ note: explicit visibility first seen here LL | pub const pub fn test() {} | ^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-87694-misplaced-pub.rs b/tests/ui/parser/issues/issue-87694-misplaced-pub.rs index 3f824617c..3f824617c 100644 --- a/tests/ui/parser/issue-87694-misplaced-pub.rs +++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.rs diff --git a/tests/ui/parser/issue-87694-misplaced-pub.stderr b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr index 94c6a29ef..6f686a7e5 100644 --- a/tests/ui/parser/issue-87694-misplaced-pub.stderr +++ b/tests/ui/parser/issues/issue-87694-misplaced-pub.stderr @@ -7,5 +7,5 @@ LL | const pub fn test() {} | | expected one of `async`, `extern`, `fn`, or `unsafe` | help: visibility `pub` must come before `const`: `pub const` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87812-path.stderr b/tests/ui/parser/issues/issue-87812-path.stderr index d045f4821..fbe26ea39 100644 --- a/tests/ui/parser/issues/issue-87812-path.stderr +++ b/tests/ui/parser/issues/issue-87812-path.stderr @@ -11,6 +11,6 @@ LL | foo!(Baz); | = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/issues/issue-87812.stderr b/tests/ui/parser/issues/issue-87812.stderr index d61ee23a5..35dc66a52 100644 --- a/tests/ui/parser/issues/issue-87812.stderr +++ b/tests/ui/parser/issues/issue-87812.stderr @@ -18,5 +18,5 @@ help: wrap this expression in parentheses LL | break '_l ($f); | + + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-88770.stderr b/tests/ui/parser/issues/issue-88770.stderr index 836f44953..60ef025fa 100644 --- a/tests/ui/parser/issues/issue-88770.stderr +++ b/tests/ui/parser/issues/issue-88770.stderr @@ -10,5 +10,5 @@ LL | fn m(){print!("",(c for&g LL | e | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-88818.stderr b/tests/ui/parser/issues/issue-88818.stderr index 6e624c5a2..10e016106 100644 --- a/tests/ui/parser/issues/issue-88818.stderr +++ b/tests/ui/parser/issues/issue-88818.stderr @@ -14,5 +14,5 @@ LL - impl for S { } LL + impl S { } | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-89388.stderr b/tests/ui/parser/issues/issue-89388.stderr index cf28bef0f..d4987234a 100644 --- a/tests/ui/parser/issues/issue-89388.stderr +++ b/tests/ui/parser/issues/issue-89388.stderr @@ -2,7 +2,12 @@ error: missing angle brackets in associated item path --> $DIR/issue-89388.rs:5:24 | LL | let _ = option.map([_]::to_vec); - | ^^^^^^^^^^^ help: try: `<[_]>::to_vec` + | ^^^ + | +help: types that don't start with an identifier need to be surrounded with angle brackets in qualified paths + | +LL | let _ = option.map(<[_]>::to_vec); + | + + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-89396.fixed b/tests/ui/parser/issues/issue-89396.fixed index 823ad8cd1..0c040ddea 100644 --- a/tests/ui/parser/issues/issue-89396.fixed +++ b/tests/ui/parser/issues/issue-89396.fixed @@ -8,9 +8,9 @@ fn main() { let _ = match opt { Some(_) => true, //~^ ERROR: expected one of - //~| HELP: try using a fat arrow here + //~| HELP: use a fat arrow to start a match arm None => false, //~^ ERROR: expected one of - //~| HELP: try using a fat arrow here + //~| HELP: use a fat arrow to start a match arm }; } diff --git a/tests/ui/parser/issues/issue-89396.rs b/tests/ui/parser/issues/issue-89396.rs index f1d9efa52..d95f666d7 100644 --- a/tests/ui/parser/issues/issue-89396.rs +++ b/tests/ui/parser/issues/issue-89396.rs @@ -8,9 +8,9 @@ fn main() { let _ = match opt { Some(_) = true, //~^ ERROR: expected one of - //~| HELP: try using a fat arrow here + //~| HELP: use a fat arrow to start a match arm None -> false, //~^ ERROR: expected one of - //~| HELP: try using a fat arrow here + //~| HELP: use a fat arrow to start a match arm }; } diff --git a/tests/ui/parser/issues/issue-89396.stderr b/tests/ui/parser/issues/issue-89396.stderr index 504420574..41ce07050 100644 --- a/tests/ui/parser/issues/issue-89396.stderr +++ b/tests/ui/parser/issues/issue-89396.stderr @@ -5,7 +5,7 @@ LL | Some(_) = true, | ^ | | | expected one of `=>`, `if`, or `|` - | help: try using a fat arrow here: `=>` + | help: use a fat arrow to start a match arm: `=>` error: expected one of `=>`, `@`, `if`, or `|`, found `->` --> $DIR/issue-89396.rs:12:14 @@ -14,7 +14,7 @@ LL | None -> false, | ^^ | | | expected one of `=>`, `@`, `if`, or `|` - | help: try using a fat arrow here: `=>` + | help: use a fat arrow to start a match arm: `=>` error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-89574.stderr b/tests/ui/parser/issues/issue-89574.stderr index fb1312c78..5f8f6f939 100644 --- a/tests/ui/parser/issues/issue-89574.stderr +++ b/tests/ui/parser/issues/issue-89574.stderr @@ -4,5 +4,5 @@ error: missing type for `const` item LL | const EMPTY_ARRAY = []; | ^ help: provide a type for the item: `: <type>` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr index a5ee24445..51df17c7c 100644 --- a/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr +++ b/tests/ui/parser/issues/issue-89971-outer-attr-following-inner-attr-ice.stderr @@ -14,5 +14,5 @@ LL - #![deny(missing_docs)] LL + #[deny(missing_docs)] | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-90728.rs b/tests/ui/parser/issues/issue-90728.rs index d6a898361..d6a898361 100644 --- a/tests/ui/parser/issue-90728.rs +++ b/tests/ui/parser/issues/issue-90728.rs diff --git a/tests/ui/parser/issue-90728.stderr b/tests/ui/parser/issues/issue-90728.stderr index b55c46030..b55c46030 100644 --- a/tests/ui/parser/issue-90728.stderr +++ b/tests/ui/parser/issues/issue-90728.stderr diff --git a/tests/ui/parser/issue-91421.rs b/tests/ui/parser/issues/issue-91421.rs index 8bba27f37..8bba27f37 100644 --- a/tests/ui/parser/issue-91421.rs +++ b/tests/ui/parser/issues/issue-91421.rs diff --git a/tests/ui/parser/issue-91421.stderr b/tests/ui/parser/issues/issue-91421.stderr index 2d9652051..99339a285 100644 --- a/tests/ui/parser/issue-91421.stderr +++ b/tests/ui/parser/issues/issue-91421.stderr @@ -10,5 +10,5 @@ help: this binary operation is possibly unfinished LL | let value = if true && { | ^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-93867.stderr b/tests/ui/parser/issues/issue-93867.stderr index ee0cb4efd..c653c8dd4 100644 --- a/tests/ui/parser/issues/issue-93867.stderr +++ b/tests/ui/parser/issues/issue-93867.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | pub fn entry<'a, K, V>() -> Entry<'a> K, V> { | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs b/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs new file mode 100644 index 000000000..cfbbd014d --- /dev/null +++ b/tests/ui/parser/issues/issue-98601-delimiter-error-1.rs @@ -0,0 +1,9 @@ +fn foo() { + match 0 { + _ => {} + } + if foo + } +} //~ ERROR unexpected closing delimiter: `}` + +fn main() {} diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr b/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr new file mode 100644 index 000000000..7dd059c6e --- /dev/null +++ b/tests/ui/parser/issues/issue-98601-delimiter-error-1.stderr @@ -0,0 +1,16 @@ +error: unexpected closing delimiter: `}` + --> $DIR/issue-98601-delimiter-error-1.rs:7:1 + | +LL | fn foo() { + | - this delimiter might not be properly closed... +LL | match 0 { +LL | _ => {} + | -- block is empty, you might have not meant to close it +... +LL | } + | - ...as it matches this but it has different indentation +LL | } + | ^ unexpected closing delimiter + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs new file mode 100644 index 000000000..254e816cf --- /dev/null +++ b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.rs @@ -0,0 +1,5 @@ +fn main() { + todo!(); +} + +fn other(_: i32)) {} //~ ERROR unexpected closing delimiter: `)` diff --git a/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr new file mode 100644 index 000000000..5e4b4dd30 --- /dev/null +++ b/tests/ui/parser/issues/issue-98601-delimiter-error-unexpected-close.stderr @@ -0,0 +1,14 @@ +error: unexpected closing delimiter: `)` + --> $DIR/issue-98601-delimiter-error-unexpected-close.rs:5:17 + | +LL | fn main() { + | - this opening brace... +LL | todo!(); +LL | } + | - ...matches this closing brace +LL | +LL | fn other(_: i32)) {} + | ^ unexpected closing delimiter + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.fixed b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed index 4b4a416b1..4b4a416b1 100644 --- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.fixed +++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.fixed diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.rs b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs index 9cc886641..9cc886641 100644 --- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.rs +++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.rs diff --git a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr index edc640bf5..c503bc3cc 100644 --- a/tests/ui/parser/issue-99625-enum-struct-mutually-exclusive.stderr +++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr @@ -4,5 +4,5 @@ error: `enum` and `struct` are mutually exclusive LL | pub enum struct Range { | ^^^^^^^^^^^ help: replace `enum struct` with: `enum` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.fixed b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed index 64ab6f62b..64ab6f62b 100644 --- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.fixed +++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.fixed diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.rs b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs index 50520971f..50520971f 100644 --- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.rs +++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.rs diff --git a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr index 72377fc37..72377fc37 100644 --- a/tests/ui/parser/issue-99910-const-let-mutually-exclusive.stderr +++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr diff --git a/tests/ui/parser/issues/recover-ge-as-fat-arrow.fixed b/tests/ui/parser/issues/recover-ge-as-fat-arrow.fixed new file mode 100644 index 000000000..7b73dfb02 --- /dev/null +++ b/tests/ui/parser/issues/recover-ge-as-fat-arrow.fixed @@ -0,0 +1,7 @@ +// run-rustfix +fn main() { + match 1 { + 1 => {} //~ ERROR + _ => { let _: u16 = 2u16; } //~ ERROR + } +} diff --git a/tests/ui/parser/issues/recover-ge-as-fat-arrow.rs b/tests/ui/parser/issues/recover-ge-as-fat-arrow.rs new file mode 100644 index 000000000..92143fcf3 --- /dev/null +++ b/tests/ui/parser/issues/recover-ge-as-fat-arrow.rs @@ -0,0 +1,7 @@ +// run-rustfix +fn main() { + match 1 { + 1 >= {} //~ ERROR + _ => { let _: u16 = 2u8; } //~ ERROR + } +} diff --git a/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr b/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr new file mode 100644 index 000000000..2df5cca24 --- /dev/null +++ b/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr @@ -0,0 +1,25 @@ +error: expected one of `...`, `..=`, `..`, `=>`, `if`, or `|`, found `>=` + --> $DIR/recover-ge-as-fat-arrow.rs:4:11 + | +LL | 1 >= {} + | ^^ + | | + | expected one of `...`, `..=`, `..`, `=>`, `if`, or `|` + | help: use a fat arrow to start a match arm: `=>` + +error[E0308]: mismatched types + --> $DIR/recover-ge-as-fat-arrow.rs:5:29 + | +LL | _ => { let _: u16 = 2u8; } + | --- ^^^ expected `u16`, found `u8` + | | + | expected due to this + | +help: change the type of the numeric literal from `u8` to `u16` + | +LL | _ => { let _: u16 = 2u16; } + | ~~~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/keyword-abstract.stderr b/tests/ui/parser/keyword-abstract.stderr index b7d1ce7cd..156e098da 100644 --- a/tests/ui/parser/keyword-abstract.stderr +++ b/tests/ui/parser/keyword-abstract.stderr @@ -9,5 +9,5 @@ help: escape `abstract` to use it as an identifier LL | let r#abstract = (); | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-as-as-identifier.stderr b/tests/ui/parser/keyword-as-as-identifier.stderr index 3c5ad950d..bc654cbc7 100644 --- a/tests/ui/parser/keyword-as-as-identifier.stderr +++ b/tests/ui/parser/keyword-as-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `as` to use it as an identifier LL | let r#as = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-break-as-identifier.stderr b/tests/ui/parser/keyword-break-as-identifier.stderr index a4535eb40..63a9cbae5 100644 --- a/tests/ui/parser/keyword-break-as-identifier.stderr +++ b/tests/ui/parser/keyword-break-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `break` to use it as an identifier LL | let r#break = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-const-as-identifier.stderr b/tests/ui/parser/keyword-const-as-identifier.stderr index 31922f150..61e454174 100644 --- a/tests/ui/parser/keyword-const-as-identifier.stderr +++ b/tests/ui/parser/keyword-const-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `const` to use it as an identifier LL | let r#const = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-continue-as-identifier.stderr b/tests/ui/parser/keyword-continue-as-identifier.stderr index 81285633f..2519000d2 100644 --- a/tests/ui/parser/keyword-continue-as-identifier.stderr +++ b/tests/ui/parser/keyword-continue-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `continue` to use it as an identifier LL | let r#continue = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-else-as-identifier.stderr b/tests/ui/parser/keyword-else-as-identifier.stderr index 2125fe84a..e3eafa8fb 100644 --- a/tests/ui/parser/keyword-else-as-identifier.stderr +++ b/tests/ui/parser/keyword-else-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `else` to use it as an identifier LL | let r#else = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-enum-as-identifier.stderr b/tests/ui/parser/keyword-enum-as-identifier.stderr index 92d092ccb..280f8a2e1 100644 --- a/tests/ui/parser/keyword-enum-as-identifier.stderr +++ b/tests/ui/parser/keyword-enum-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `enum` to use it as an identifier LL | let r#enum = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-final.stderr b/tests/ui/parser/keyword-final.stderr index f1f9f2e2c..74866c9e7 100644 --- a/tests/ui/parser/keyword-final.stderr +++ b/tests/ui/parser/keyword-final.stderr @@ -9,5 +9,5 @@ help: escape `final` to use it as an identifier LL | let r#final = (); | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-fn-as-identifier.stderr b/tests/ui/parser/keyword-fn-as-identifier.stderr index 645efbcae..32fff1a61 100644 --- a/tests/ui/parser/keyword-fn-as-identifier.stderr +++ b/tests/ui/parser/keyword-fn-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `fn` to use it as an identifier LL | let r#fn = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-for-as-identifier.stderr b/tests/ui/parser/keyword-for-as-identifier.stderr index 26407cc4d..813bb3f3b 100644 --- a/tests/ui/parser/keyword-for-as-identifier.stderr +++ b/tests/ui/parser/keyword-for-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `for` to use it as an identifier LL | let r#for = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-if-as-identifier.stderr b/tests/ui/parser/keyword-if-as-identifier.stderr index 26f9a15a7..245ff8977 100644 --- a/tests/ui/parser/keyword-if-as-identifier.stderr +++ b/tests/ui/parser/keyword-if-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `if` to use it as an identifier LL | let r#if = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-impl-as-identifier.stderr b/tests/ui/parser/keyword-impl-as-identifier.stderr index 73a50bc38..fe840ba3d 100644 --- a/tests/ui/parser/keyword-impl-as-identifier.stderr +++ b/tests/ui/parser/keyword-impl-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `impl` to use it as an identifier LL | let r#impl = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-in-as-identifier.stderr b/tests/ui/parser/keyword-in-as-identifier.stderr index 98332b723..12fc0479f 100644 --- a/tests/ui/parser/keyword-in-as-identifier.stderr +++ b/tests/ui/parser/keyword-in-as-identifier.stderr @@ -4,5 +4,5 @@ error: expected pattern, found keyword `in` LL | let in = "foo"; | ^^ expected pattern -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-let-as-identifier.stderr b/tests/ui/parser/keyword-let-as-identifier.stderr index 86faaed38..69f570aa8 100644 --- a/tests/ui/parser/keyword-let-as-identifier.stderr +++ b/tests/ui/parser/keyword-let-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `let` to use it as an identifier LL | let r#let = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-loop-as-identifier.stderr b/tests/ui/parser/keyword-loop-as-identifier.stderr index 304ad61cc..ff14af0c7 100644 --- a/tests/ui/parser/keyword-loop-as-identifier.stderr +++ b/tests/ui/parser/keyword-loop-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `loop` to use it as an identifier LL | let r#loop = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-match-as-identifier.stderr b/tests/ui/parser/keyword-match-as-identifier.stderr index 25ac397fb..3811ef058 100644 --- a/tests/ui/parser/keyword-match-as-identifier.stderr +++ b/tests/ui/parser/keyword-match-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `match` to use it as an identifier LL | let r#match = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-mod-as-identifier.stderr b/tests/ui/parser/keyword-mod-as-identifier.stderr index d5688e871..c60d6f129 100644 --- a/tests/ui/parser/keyword-mod-as-identifier.stderr +++ b/tests/ui/parser/keyword-mod-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `mod` to use it as an identifier LL | let r#mod = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-move-as-identifier.stderr b/tests/ui/parser/keyword-move-as-identifier.stderr index 75653cffc..91cded8e9 100644 --- a/tests/ui/parser/keyword-move-as-identifier.stderr +++ b/tests/ui/parser/keyword-move-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `move` to use it as an identifier LL | let r#move = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-mut-as-identifier.stderr b/tests/ui/parser/keyword-mut-as-identifier.stderr index 040960835..335b31a20 100644 --- a/tests/ui/parser/keyword-mut-as-identifier.stderr +++ b/tests/ui/parser/keyword-mut-as-identifier.stderr @@ -4,5 +4,5 @@ error: expected identifier, found `=` LL | let mut = "foo"; | ^ expected identifier -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-override.stderr b/tests/ui/parser/keyword-override.stderr index cdb573686..108a621a2 100644 --- a/tests/ui/parser/keyword-override.stderr +++ b/tests/ui/parser/keyword-override.stderr @@ -9,5 +9,5 @@ help: escape `override` to use it as an identifier LL | let r#override = (); | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-pub-as-identifier.stderr b/tests/ui/parser/keyword-pub-as-identifier.stderr index 8d513507c..ec62fd4cf 100644 --- a/tests/ui/parser/keyword-pub-as-identifier.stderr +++ b/tests/ui/parser/keyword-pub-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `pub` to use it as an identifier LL | let r#pub = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-ref-as-identifier.stderr b/tests/ui/parser/keyword-ref-as-identifier.stderr index 618043d89..54c258d7a 100644 --- a/tests/ui/parser/keyword-ref-as-identifier.stderr +++ b/tests/ui/parser/keyword-ref-as-identifier.stderr @@ -4,5 +4,5 @@ error: expected identifier, found `=` LL | let ref = "foo"; | ^ expected identifier -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-return-as-identifier.stderr b/tests/ui/parser/keyword-return-as-identifier.stderr index eeb8e468b..9e41d0ccb 100644 --- a/tests/ui/parser/keyword-return-as-identifier.stderr +++ b/tests/ui/parser/keyword-return-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `return` to use it as an identifier LL | let r#return = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-static-as-identifier.stderr b/tests/ui/parser/keyword-static-as-identifier.stderr index a3213e2f2..76fb3afd6 100644 --- a/tests/ui/parser/keyword-static-as-identifier.stderr +++ b/tests/ui/parser/keyword-static-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `static` to use it as an identifier LL | let r#static = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-struct-as-identifier.stderr b/tests/ui/parser/keyword-struct-as-identifier.stderr index b73361a55..89eb644e1 100644 --- a/tests/ui/parser/keyword-struct-as-identifier.stderr +++ b/tests/ui/parser/keyword-struct-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `struct` to use it as an identifier LL | let r#struct = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-trait-as-identifier.stderr b/tests/ui/parser/keyword-trait-as-identifier.stderr index 56ef5f606..3f19f6f3c 100644 --- a/tests/ui/parser/keyword-trait-as-identifier.stderr +++ b/tests/ui/parser/keyword-trait-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `trait` to use it as an identifier LL | let r#trait = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-try-as-identifier-edition2018.stderr b/tests/ui/parser/keyword-try-as-identifier-edition2018.stderr index 94a106d47..ded652302 100644 --- a/tests/ui/parser/keyword-try-as-identifier-edition2018.stderr +++ b/tests/ui/parser/keyword-try-as-identifier-edition2018.stderr @@ -9,5 +9,5 @@ help: escape `try` to use it as an identifier LL | let r#try = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-type-as-identifier.stderr b/tests/ui/parser/keyword-type-as-identifier.stderr index 624c1006b..5e6c6d9e1 100644 --- a/tests/ui/parser/keyword-type-as-identifier.stderr +++ b/tests/ui/parser/keyword-type-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `type` to use it as an identifier LL | let r#type = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-typeof.stderr b/tests/ui/parser/keyword-typeof.stderr index 4c5324505..c671ba94c 100644 --- a/tests/ui/parser/keyword-typeof.stderr +++ b/tests/ui/parser/keyword-typeof.stderr @@ -9,5 +9,5 @@ help: escape `typeof` to use it as an identifier LL | let r#typeof = (); | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-union-as-identifier.rs b/tests/ui/parser/keyword-union-as-identifier.rs new file mode 100644 index 000000000..7062557d7 --- /dev/null +++ b/tests/ui/parser/keyword-union-as-identifier.rs @@ -0,0 +1,72 @@ +// check-pass + +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +mod union { + type union = i32; + + pub struct Bar { + pub union: union, + } + + pub fn union() -> Bar { + Bar { + union: 5 + } + } +} + +mod struct_union { + pub struct union { + pub union: u32 + } + static union: union = union { union: 0 }; + + impl union { + pub fn union<'union>() -> &'union union { + &union + } + } + impl union {} + trait Foo {} + impl Foo for union {} + trait Bar { + fn bar() {} + } + impl Bar for union {} +} + +mod union_union { + pub union union { + pub union: u32 + } + const union: union = union { union: 0 }; + impl union { + pub fn union() -> union { + union + } + } +} + +mod trait_union { + pub trait union { + fn union() {} + } + impl union for () {} +} + +macro_rules! ty { + ($ty:ty { $($field:ident:$field_ty:ty)* }) => {}; +} + +fn main() { + let union = union::union(); + let _ = union.union; + let _ = struct_union::union::union().union; + let union = union_union::union::union(); + let _ = unsafe { union.union }; + <() as trait_union::union>::union(); + ty!(union {}); + ty!(union { union: union }); +} diff --git a/tests/ui/parser/keyword-unsafe-as-identifier.stderr b/tests/ui/parser/keyword-unsafe-as-identifier.stderr index b552c9cd3..25a8001c6 100644 --- a/tests/ui/parser/keyword-unsafe-as-identifier.stderr +++ b/tests/ui/parser/keyword-unsafe-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `unsafe` to use it as an identifier LL | let r#unsafe = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-use-as-identifier.stderr b/tests/ui/parser/keyword-use-as-identifier.stderr index 630798659..26bf2b4f6 100644 --- a/tests/ui/parser/keyword-use-as-identifier.stderr +++ b/tests/ui/parser/keyword-use-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `use` to use it as an identifier LL | let r#use = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-where-as-identifier.stderr b/tests/ui/parser/keyword-where-as-identifier.stderr index 9e72f7940..5243f0488 100644 --- a/tests/ui/parser/keyword-where-as-identifier.stderr +++ b/tests/ui/parser/keyword-where-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `where` to use it as an identifier LL | let r#where = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword-while-as-identifier.stderr b/tests/ui/parser/keyword-while-as-identifier.stderr index 2bb62105d..ea396c613 100644 --- a/tests/ui/parser/keyword-while-as-identifier.stderr +++ b/tests/ui/parser/keyword-while-as-identifier.stderr @@ -9,5 +9,5 @@ help: escape `while` to use it as an identifier LL | let r#while = "foo"; | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/keyword.stderr b/tests/ui/parser/keyword.stderr index ee7d72b39..54539519e 100644 --- a/tests/ui/parser/keyword.stderr +++ b/tests/ui/parser/keyword.stderr @@ -9,5 +9,5 @@ help: escape `break` to use it as an identifier LL | pub mod r#break { | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/labeled-no-colon-expr.stderr b/tests/ui/parser/labeled-no-colon-expr.stderr index 62288fe15..4d61d9c14 100644 --- a/tests/ui/parser/labeled-no-colon-expr.stderr +++ b/tests/ui/parser/labeled-no-colon-expr.stderr @@ -77,6 +77,10 @@ LL | m!({}); | ------ in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) +help: wrap this in another block + | +LL | 'l5 { $b }; + | + + error: labeled expression must be followed by `:` --> $DIR/labeled-no-colon-expr.rs:14:8 diff --git a/tests/ui/parser/lifetime-semicolon.stderr b/tests/ui/parser/lifetime-semicolon.stderr index ee486c236..4f8e2835e 100644 --- a/tests/ui/parser/lifetime-semicolon.stderr +++ b/tests/ui/parser/lifetime-semicolon.stderr @@ -9,5 +9,5 @@ help: use a comma to separate type parameters LL | fn foo<'a, 'b>(_x: &mut Foo<'a, 'b>) {} | ~ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/lit-err-in-macro.rs b/tests/ui/parser/lit-err-in-macro.rs new file mode 100644 index 000000000..cff8ee6b4 --- /dev/null +++ b/tests/ui/parser/lit-err-in-macro.rs @@ -0,0 +1,10 @@ +macro_rules! f { + ($abi:literal) => { + extern $abi fn f() {} + } +} + +f!("Foo"__); +//~^ ERROR suffixes on string literals are invalid + +fn main() {} diff --git a/tests/ui/parser/lit-err-in-macro.stderr b/tests/ui/parser/lit-err-in-macro.stderr new file mode 100644 index 000000000..12e6d5190 --- /dev/null +++ b/tests/ui/parser/lit-err-in-macro.stderr @@ -0,0 +1,8 @@ +error: suffixes on string literals are invalid + --> $DIR/lit-err-in-macro.rs:7:4 + | +LL | f!("Foo"__); + | ^^^^^^^ invalid suffix `__` + +error: aborting due to 1 previous error + diff --git a/tests/ui/parser/macro-bad-delimiter-ident.stderr b/tests/ui/parser/macro-bad-delimiter-ident.stderr index f2365fed2..06f72cdec 100644 --- a/tests/ui/parser/macro-bad-delimiter-ident.stderr +++ b/tests/ui/parser/macro-bad-delimiter-ident.stderr @@ -4,5 +4,5 @@ error: expected one of `(`, `[`, or `{`, found `bar` LL | foo! bar < | ^^^ expected one of `(`, `[`, or `{` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro-keyword.stderr b/tests/ui/parser/macro-keyword.stderr index d794671f8..bfe89e320 100644 --- a/tests/ui/parser/macro-keyword.stderr +++ b/tests/ui/parser/macro-keyword.stderr @@ -9,5 +9,5 @@ help: escape `macro` to use it as an identifier LL | fn r#macro() { | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro-mismatched-delim-brace-paren.stderr b/tests/ui/parser/macro-mismatched-delim-brace-paren.stderr index 077d31800..f9a307222 100644 --- a/tests/ui/parser/macro-mismatched-delim-brace-paren.stderr +++ b/tests/ui/parser/macro-mismatched-delim-brace-paren.stderr @@ -7,5 +7,5 @@ LL | bar, "baz", 1, 2.0 LL | ) | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro/bad-macro-argument.stderr b/tests/ui/parser/macro/bad-macro-argument.stderr index 3cd8accb6..ba6499d71 100644 --- a/tests/ui/parser/macro/bad-macro-argument.stderr +++ b/tests/ui/parser/macro/bad-macro-argument.stderr @@ -4,5 +4,5 @@ error: expected expression, found end of macro arguments LL | println!("Hello, {}", message/); | ^ expected expression -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro/issue-37113.stderr b/tests/ui/parser/macro/issue-37113.stderr index da9e743a0..1f2fe2310 100644 --- a/tests/ui/parser/macro/issue-37113.stderr +++ b/tests/ui/parser/macro/issue-37113.stderr @@ -12,5 +12,5 @@ LL | test_macro!(String,); = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` = note: this error originates in the macro `test_macro` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro/issue-37234.stderr b/tests/ui/parser/macro/issue-37234.stderr index d79196204..cd91ea441 100644 --- a/tests/ui/parser/macro/issue-37234.stderr +++ b/tests/ui/parser/macro/issue-37234.stderr @@ -9,5 +9,5 @@ LL | failed!(); | = note: this error originates in the macro `failed` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro/macro-doc-comments-1.stderr b/tests/ui/parser/macro/macro-doc-comments-1.stderr index eaeb62d2c..9d2d1bc00 100644 --- a/tests/ui/parser/macro/macro-doc-comments-1.stderr +++ b/tests/ui/parser/macro/macro-doc-comments-1.stderr @@ -16,5 +16,5 @@ note: while trying to match `[` LL | (#[$outer:meta]) => () | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro/macro-doc-comments-2.stderr b/tests/ui/parser/macro/macro-doc-comments-2.stderr index 1dcd95f6f..22efd995b 100644 --- a/tests/ui/parser/macro/macro-doc-comments-2.stderr +++ b/tests/ui/parser/macro/macro-doc-comments-2.stderr @@ -16,5 +16,5 @@ note: while trying to match `!` LL | (#![$inner:meta]) => () | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/macro/macro-expand-to-field.rs b/tests/ui/parser/macro/macro-expand-to-field.rs new file mode 100644 index 000000000..533511ecf --- /dev/null +++ b/tests/ui/parser/macro/macro-expand-to-field.rs @@ -0,0 +1,79 @@ +// compile-flags: --crate-type=lib + +// https://github.com/rust-lang/rust/issues/113766 + +macro_rules! field { + ($name:ident:$type:ty) => { + $name:$type + }; +} + +macro_rules! variant { + ($name:ident) => { + $name + } +} + +struct Struct { + //~^ NOTE while parsing this struct + field!(bar:u128), + //~^ NOTE macros cannot expand to struct fields + //~| ERROR unexpected token: `!` + //~| NOTE unexpected token after this + a: u32, + b: u32, + field!(recovers:()), +} + +enum EnumVariant { + variant!(whoops), + //~^ NOTE macros cannot expand to enum variants + //~| ERROR unexpected token: `!` + //~| NOTE unexpected token after this + U32, + F64, + variant!(recovers), + //~^ NOTE macros cannot expand to enum variants + //~| ERROR unexpected token: `!` + //~| NOTE unexpected token after this + Data { //~ NOTE while parsing this struct + field!(x:u32), + //~^ NOTE macros cannot expand to struct fields + //~| ERROR unexpected token: `!` + //~| NOTE unexpected token after this + } +} + +enum EnumVariantField { + Named { //~ NOTE while parsing this struct + field!(oopsies:()), + //~^ NOTE macros cannot expand to struct fields + //~| ERROR unexpected token: `!` + //~| unexpected token after this + field!(oopsies2:()), + }, +} + +union Union { + //~^ NOTE while parsing this union + A: u32, + field!(oopsies:()), + //~^ NOTE macros cannot expand to union fields + //~| ERROR unexpected token: `!` + //~| NOTE unexpected token after this + B: u32, + field!(recovers:()), +} + +// https://github.com/rust-lang/rust/issues/114636 + +#[derive(Debug)] +pub struct Lazy { + //~^ NOTE while parsing this struct + unreachable!() + //~^ NOTE macros cannot expand to struct fields + //~| ERROR unexpected token: `!` + //~| NOTE unexpected token after this +} + +fn main() {} diff --git a/tests/ui/parser/macro/macro-expand-to-field.stderr b/tests/ui/parser/macro/macro-expand-to-field.stderr new file mode 100644 index 000000000..0bb718000 --- /dev/null +++ b/tests/ui/parser/macro/macro-expand-to-field.stderr @@ -0,0 +1,71 @@ +error: unexpected token: `!` + --> $DIR/macro-expand-to-field.rs:19:10 + | +LL | struct Struct { + | ------ while parsing this struct +LL | +LL | field!(bar:u128), + | ^ unexpected token after this + | + = note: macros cannot expand to struct fields + +error: unexpected token: `!` + --> $DIR/macro-expand-to-field.rs:29:12 + | +LL | variant!(whoops), + | ^ unexpected token after this + | + = note: macros cannot expand to enum variants + +error: unexpected token: `!` + --> $DIR/macro-expand-to-field.rs:35:12 + | +LL | variant!(recovers), + | ^ unexpected token after this + | + = note: macros cannot expand to enum variants + +error: unexpected token: `!` + --> $DIR/macro-expand-to-field.rs:40:14 + | +LL | Data { + | ---- while parsing this struct +LL | field!(x:u32), + | ^ unexpected token after this + | + = note: macros cannot expand to struct fields + +error: unexpected token: `!` + --> $DIR/macro-expand-to-field.rs:49:14 + | +LL | Named { + | ----- while parsing this struct +LL | field!(oopsies:()), + | ^ unexpected token after this + | + = note: macros cannot expand to struct fields + +error: unexpected token: `!` + --> $DIR/macro-expand-to-field.rs:60:10 + | +LL | union Union { + | ----- while parsing this union +... +LL | field!(oopsies:()), + | ^ unexpected token after this + | + = note: macros cannot expand to union fields + +error: unexpected token: `!` + --> $DIR/macro-expand-to-field.rs:73:16 + | +LL | pub struct Lazy { + | ---- while parsing this struct +LL | +LL | unreachable!() + | ^ unexpected token after this + | + = note: macros cannot expand to struct fields + +error: aborting due to 7 previous errors + diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.rs b/tests/ui/parser/macro/macro-expand-to-match-arm.rs new file mode 100644 index 000000000..db38fa0d7 --- /dev/null +++ b/tests/ui/parser/macro/macro-expand-to-match-arm.rs @@ -0,0 +1,20 @@ +macro_rules! arm { + ($pattern:pat => $block:block) => { + $pattern => $block + //~^ ERROR macro expansion ignores token `=>` and any following + //~| NOTE the usage of `arm!` is likely invalid in pattern context + //~| NOTE macros cannot expand to match arms + }; +} + +fn main() { + let x = Some(1); + match x { + Some(1) => {}, + arm!(None => {}), + //~^ NOTE caused by the macro expansion here + //~| ERROR `match` arm with no body + Some(2) => {}, + _ => {}, + }; +} diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.stderr b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr new file mode 100644 index 000000000..e3e7ff89c --- /dev/null +++ b/tests/ui/parser/macro/macro-expand-to-match-arm.stderr @@ -0,0 +1,20 @@ +error: macro expansion ignores token `=>` and any following + --> $DIR/macro-expand-to-match-arm.rs:3:18 + | +LL | $pattern => $block + | ^^ +... +LL | arm!(None => {}), + | ---------------- caused by the macro expansion here + | + = note: the usage of `arm!` is likely invalid in pattern context + = note: macros cannot expand to match arms + +error: `match` arm with no body + --> $DIR/macro-expand-to-match-arm.rs:14:9 + | +LL | arm!(None => {}), + | ^^^^^^^^^^^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/macro/macro-repeat.stderr b/tests/ui/parser/macro/macro-repeat.stderr index 63554b197..ade2bbf9b 100644 --- a/tests/ui/parser/macro/macro-repeat.stderr +++ b/tests/ui/parser/macro/macro-repeat.stderr @@ -9,6 +9,8 @@ error: variable 'v' is still repeating at this depth | LL | $v | ^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error: aborting due to 2 previous errors diff --git a/tests/ui/parser/match-arm-without-body.rs b/tests/ui/parser/match-arm-without-body.rs new file mode 100644 index 000000000..4723abff8 --- /dev/null +++ b/tests/ui/parser/match-arm-without-body.rs @@ -0,0 +1,77 @@ +macro_rules! pat { + () => { Some(_) } +} + +fn main() { + match Some(false) { + Some(_) + //~^ ERROR `match` arm with no body + //~| HELP add a body after the pattern + } + match Some(false) { + Some(_) + _ => {} + //~^ ERROR expected one of + } + match Some(false) { + Some(_), + //~^ ERROR unexpected `,` in pattern + //~| HELP try adding parentheses to match on a tuple + //~| HELP or a vertical bar to match on multiple alternatives + } + match Some(false) { + Some(_), + //~^ ERROR unexpected `,` in pattern + //~| HELP try adding parentheses to match on a tuple + //~| HELP or a vertical bar to match on multiple alternatives + _ => {} + } + match Some(false) { + Some(_) if true + //~^ ERROR `match` arm with no body + //~| HELP add a body after the pattern + } + match Some(false) { + Some(_) if true + _ => {} + //~^ ERROR expected one of + } + match Some(false) { + Some(_) if true, + //~^ ERROR `match` arm with no body + //~| HELP add a body after the pattern + } + match Some(false) { + Some(_) if true, + //~^ ERROR `match` arm with no body + //~| HELP add a body after the pattern + _ => {} + } + match Some(false) { + pat!() + //~^ ERROR `match` arm with no body + //~| HELP add a body after the pattern + } + match Some(false) { + pat!(), + //~^ ERROR `match` arm with no body + //~| HELP add a body after the pattern + } + match Some(false) { + pat!() if true, + //~^ ERROR `match` arm with no body + //~| HELP add a body after the pattern + } + match Some(false) { + pat!() + //~^ ERROR expected `,` following `match` arm + //~| HELP missing a comma here + _ => {} + } + match Some(false) { + pat!(), + //~^ ERROR `match` arm with no body + //~| HELP add a body after the pattern + _ => {} + } +} diff --git a/tests/ui/parser/match-arm-without-body.stderr b/tests/ui/parser/match-arm-without-body.stderr new file mode 100644 index 000000000..d98c7ec28 --- /dev/null +++ b/tests/ui/parser/match-arm-without-body.stderr @@ -0,0 +1,110 @@ +error: expected one of `,`, `=>`, `if`, `|`, or `}`, found reserved identifier `_` + --> $DIR/match-arm-without-body.rs:13:9 + | +LL | Some(_) + | - expected one of `,`, `=>`, `if`, `|`, or `}` +LL | _ => {} + | ^ unexpected token + +error: unexpected `,` in pattern + --> $DIR/match-arm-without-body.rs:17:16 + | +LL | Some(_), + | ^ + | +help: try adding parentheses to match on a tuple... + | +LL | (Some(_),) + | + + +help: ...or a vertical bar to match on multiple alternatives + | +LL | Some(_) | + | + +error: unexpected `,` in pattern + --> $DIR/match-arm-without-body.rs:23:16 + | +LL | Some(_), + | ^ + | +help: try adding parentheses to match on a tuple... + | +LL ~ (Some(_), +LL | +LL | +LL | +LL ~ _) => {} + | +help: ...or a vertical bar to match on multiple alternatives + | +LL ~ Some(_) | +LL + +LL + +LL + +LL ~ _ => {} + | + +error: expected one of `,`, `.`, `=>`, `?`, `}`, or an operator, found reserved identifier `_` + --> $DIR/match-arm-without-body.rs:36:9 + | +LL | Some(_) if true + | - expected one of `,`, `.`, `=>`, `?`, `}`, or an operator +LL | _ => {} + | ^ unexpected token + +error: expected `,` following `match` arm + --> $DIR/match-arm-without-body.rs:66:15 + | +LL | pat!() + | ^ help: missing a comma here to end this `match` arm: `,` + +error: `match` arm with no body + --> $DIR/match-arm-without-body.rs:7:9 + | +LL | Some(_) + | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: `match` arm with no body + --> $DIR/match-arm-without-body.rs:30:9 + | +LL | Some(_) if true + | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: `match` arm with no body + --> $DIR/match-arm-without-body.rs:40:9 + | +LL | Some(_) if true, + | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: `match` arm with no body + --> $DIR/match-arm-without-body.rs:45:9 + | +LL | Some(_) if true, + | ^^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: `match` arm with no body + --> $DIR/match-arm-without-body.rs:51:9 + | +LL | pat!() + | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: `match` arm with no body + --> $DIR/match-arm-without-body.rs:56:9 + | +LL | pat!(), + | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: `match` arm with no body + --> $DIR/match-arm-without-body.rs:61:9 + | +LL | pat!() if true, + | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: `match` arm with no body + --> $DIR/match-arm-without-body.rs:72:9 + | +LL | pat!(), + | ^^^^^^- help: add a body after the pattern: `=> todo!(),` + +error: aborting due to 13 previous errors + diff --git a/tests/ui/parser/match-arrows-block-then-binop.stderr b/tests/ui/parser/match-arrows-block-then-binop.stderr index cb361a3db..7ef5228a8 100644 --- a/tests/ui/parser/match-arrows-block-then-binop.stderr +++ b/tests/ui/parser/match-arrows-block-then-binop.stderr @@ -11,5 +11,5 @@ LL | 0 LL ~ }) + 5 | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/match-refactor-to-expr.stderr b/tests/ui/parser/match-refactor-to-expr.stderr index 851bef8f2..72dfcd7dd 100644 --- a/tests/ui/parser/match-refactor-to-expr.stderr +++ b/tests/ui/parser/match-refactor-to-expr.stderr @@ -12,5 +12,5 @@ LL | LL | ; | ^ unexpected token -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/mbe_missing_right_paren.stderr b/tests/ui/parser/mbe_missing_right_paren.stderr index d2af94683..d45a2e3ab 100644 --- a/tests/ui/parser/mbe_missing_right_paren.stderr +++ b/tests/ui/parser/mbe_missing_right_paren.stderr @@ -6,5 +6,5 @@ LL | macro_rules! abc(ؼ | | | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr b/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr index 7fd7ffc94..f7822ba11 100644 --- a/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr +++ b/tests/ui/parser/method-call-on-struct-literal-in-if-condition.stderr @@ -4,10 +4,10 @@ error: invalid struct literal LL | if Example { a: one(), }.is_pos() { | ^^^^^^^^^^^^^^^^^^^^^ | -help: you might need to surround the struct literal in parentheses +help: you might need to surround the struct literal with parentheses | LL | if (Example { a: one(), }).is_pos() { | + + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr index d91a7f054..97aac661d 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr @@ -7,5 +7,5 @@ LL | impl T for () { LL | | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr index d01d9ed60..f70dac443 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr @@ -7,5 +7,5 @@ LL | pub(crate) struct Bar<T> { LL | fn main() {} | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr index 7418dd64c..a565ad49b 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr @@ -7,5 +7,5 @@ LL | trait T { LL | fn main() {} | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/mismatched-delim-brace-empty-block.stderr b/tests/ui/parser/mismatched-delim-brace-empty-block.stderr index 165eb8ae9..180798788 100644 --- a/tests/ui/parser/mismatched-delim-brace-empty-block.stderr +++ b/tests/ui/parser/mismatched-delim-brace-empty-block.stderr @@ -10,5 +10,5 @@ LL | let _ = (); LL | } | ^ unexpected closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr index b2448774a..e40d98582 100644 --- a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr +++ b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr @@ -2,9 +2,8 @@ error: expected one of `,`, `:`, or `>`, found `=` --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:23 | LL | let v : Vec<(u32,_) = vec![]; - | - - ^ expected one of `,`, `:`, or `>` - | | | - | | maybe try to close unmatched angle bracket + | - ^ expected one of `,`, `:`, or `>` + | | | while parsing the type for `v` | help: you might have meant to end the type parameters here @@ -29,9 +28,8 @@ error: expected one of `,`, `:`, or `>`, found `=` --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:18 | LL | let v : Vec<'a = vec![]; - | - -- ^ expected one of `,`, `:`, or `>` - | | | - | | maybe try to close unmatched angle bracket + | - ^ expected one of `,`, `:`, or `>` + | | | while parsing the type for `v` | help: you might have meant to end the type parameters here diff --git a/tests/ui/parser/missing-closing-angle-bracket-struct-field-ty.stderr b/tests/ui/parser/missing-closing-angle-bracket-struct-field-ty.stderr index 6d8b0c3fc..29a5dbb73 100644 --- a/tests/ui/parser/missing-closing-angle-bracket-struct-field-ty.stderr +++ b/tests/ui/parser/missing-closing-angle-bracket-struct-field-ty.stderr @@ -14,5 +14,5 @@ help: you might have meant to end the type parameters here LL | b: Arc<Mutex<usize>>, | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/missing-expression-in-for-loop.stderr b/tests/ui/parser/missing-expression-in-for-loop.stderr index 74a7c4224..74acfc829 100644 --- a/tests/ui/parser/missing-expression-in-for-loop.stderr +++ b/tests/ui/parser/missing-expression-in-for-loop.stderr @@ -9,5 +9,5 @@ help: try adding an expression to the `for` loop LL | for i in /* expression */ { | ++++++++++++++++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/missing-fat-arrow.rs b/tests/ui/parser/missing-fat-arrow.rs new file mode 100644 index 000000000..325f1ccf2 --- /dev/null +++ b/tests/ui/parser/missing-fat-arrow.rs @@ -0,0 +1,38 @@ +fn main() { + let x = 1; + let y = 2; + let value = 3; + + match value { + Some(x) if x == y { + self.next_token()?; //~ ERROR expected identifier, found keyword `self` + }, + _ => {} + } + let _: i32 = (); //~ ERROR mismatched types +} + +struct Foo { + value: usize +} + +fn foo(a: Option<&mut Foo>, b: usize) { + match a { + Some(a) if a.value == b { + a.value = 1; //~ ERROR expected one of `,`, `:`, or `}`, found `.` + }, + _ => {} + } + let _: i32 = (); //~ ERROR mismatched types +} + +fn bar(a: Option<&mut Foo>, b: usize) { + match a { + Some(a) if a.value == b { + a.value, //~ ERROR expected one of `,`, `:`, or `}`, found `.` + } => { + } + _ => {} + } + let _: i32 = (); //~ ERROR mismatched types +} diff --git a/tests/ui/parser/missing-fat-arrow.stderr b/tests/ui/parser/missing-fat-arrow.stderr new file mode 100644 index 000000000..a6c786905 --- /dev/null +++ b/tests/ui/parser/missing-fat-arrow.stderr @@ -0,0 +1,78 @@ +error: expected identifier, found keyword `self` + --> $DIR/missing-fat-arrow.rs:8:13 + | +LL | Some(x) if x == y { + | - while parsing this struct +LL | self.next_token()?; + | ^^^^ expected identifier, found keyword + | +help: you might have meant to start a match arm after the match guard + | +LL | Some(x) if x == y => { + | ++ + +error: expected one of `,`, `:`, or `}`, found `.` + --> $DIR/missing-fat-arrow.rs:22:14 + | +LL | Some(a) if a.value == b { + | - while parsing this struct +LL | a.value = 1; + | -^ expected one of `,`, `:`, or `}` + | | + | while parsing this struct field + | +help: try naming a field + | +LL | a: a.value = 1; + | ++ +help: you might have meant to start a match arm after the match guard + | +LL | Some(a) if a.value == b => { + | ++ + +error: expected one of `,`, `:`, or `}`, found `.` + --> $DIR/missing-fat-arrow.rs:32:14 + | +LL | Some(a) if a.value == b { + | - while parsing this struct +LL | a.value, + | -^ expected one of `,`, `:`, or `}` + | | + | while parsing this struct field + | +help: try naming a field + | +LL | a: a.value, + | ++ +help: you might have meant to start a match arm after the match guard + | +LL | Some(a) if a.value == b => { + | ++ + +error[E0308]: mismatched types + --> $DIR/missing-fat-arrow.rs:12:18 + | +LL | let _: i32 = (); + | --- ^^ expected `i32`, found `()` + | | + | expected due to this + +error[E0308]: mismatched types + --> $DIR/missing-fat-arrow.rs:26:18 + | +LL | let _: i32 = (); + | --- ^^ expected `i32`, found `()` + | | + | expected due to this + +error[E0308]: mismatched types + --> $DIR/missing-fat-arrow.rs:37:18 + | +LL | let _: i32 = (); + | --- ^^ expected `i32`, found `()` + | | + | expected due to this + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/missing-semicolon.stderr b/tests/ui/parser/missing-semicolon.stderr index e0d5e84ec..4108cced3 100644 --- a/tests/ui/parser/missing-semicolon.stderr +++ b/tests/ui/parser/missing-semicolon.stderr @@ -9,5 +9,5 @@ LL | fn main() { m!(0, 0; 0, 0); } | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/missing_right_paren.rs b/tests/ui/parser/missing_right_paren.rs index e240f8c67..cc6d30c9c 100644 --- a/tests/ui/parser/missing_right_paren.rs +++ b/tests/ui/parser/missing_right_paren.rs @@ -1,4 +1,4 @@ // ignore-tidy-trailing-newlines // error-pattern: this file contains an unclosed delimiter -// error-pattern: aborting due to previous error +// error-pattern: aborting due to 1 previous error fn main((ؼ
\ No newline at end of file diff --git a/tests/ui/parser/missing_right_paren.stderr b/tests/ui/parser/missing_right_paren.stderr index 994ce4d85..4815f04fb 100644 --- a/tests/ui/parser/missing_right_paren.stderr +++ b/tests/ui/parser/missing_right_paren.stderr @@ -7,5 +7,5 @@ LL | fn main((ؼ | |unclosed delimiter | unclosed delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-macro-rules.stderr b/tests/ui/parser/misspelled-macro-rules.stderr index 56df71238..fc718d855 100644 --- a/tests/ui/parser/misspelled-macro-rules.stderr +++ b/tests/ui/parser/misspelled-macro-rules.stderr @@ -6,5 +6,5 @@ LL | marco_rules! thing { | | | help: perhaps you meant to define a macro: `macro_rules` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/mod_file_not_exist.stderr b/tests/ui/parser/mod_file_not_exist.stderr index 62456d518..c2f9d30d9 100644 --- a/tests/ui/parser/mod_file_not_exist.stderr +++ b/tests/ui/parser/mod_file_not_exist.stderr @@ -5,6 +5,7 @@ LL | mod not_a_real_file; | ^^^^^^^^^^^^^^^^^^^^ | = help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs" + = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux` --> $DIR/mod_file_not_exist.rs:7:16 diff --git a/tests/ui/parser/mod_file_not_exist_windows.stderr b/tests/ui/parser/mod_file_not_exist_windows.stderr index d5143dbe9..53b09d8ca 100644 --- a/tests/ui/parser/mod_file_not_exist_windows.stderr +++ b/tests/ui/parser/mod_file_not_exist_windows.stderr @@ -5,6 +5,7 @@ LL | mod not_a_real_file; | ^^^^^^^^^^^^^^^^^^^^ | = help: to create the module `not_a_real_file`, create file "$DIR/not_a_real_file.rs" or "$DIR/not_a_real_file/mod.rs" + = note: if there is a `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::...` instead error[E0433]: failed to resolve: use of undeclared crate or module `mod_file_aux` --> $DIR/mod_file_not_exist_windows.rs:7:16 diff --git a/tests/ui/parser/mod_file_with_path_attr.stderr b/tests/ui/parser/mod_file_with_path_attr.stderr index cd1add73d..9ccb775da 100644 --- a/tests/ui/parser/mod_file_with_path_attr.stderr +++ b/tests/ui/parser/mod_file_with_path_attr.stderr @@ -4,5 +4,5 @@ error: couldn't read $DIR/not_a_real_file.rs: $FILE_NOT_FOUND_MSG (os error 2) LL | mod m; | ^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/multiline-comment-line-tracking.stderr b/tests/ui/parser/multiline-comment-line-tracking.stderr index cac0c801a..450a91207 100644 --- a/tests/ui/parser/multiline-comment-line-tracking.stderr +++ b/tests/ui/parser/multiline-comment-line-tracking.stderr @@ -4,5 +4,5 @@ error: expected expression, found `%` LL | %; | ^ expected expression -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/multitrait.stderr b/tests/ui/parser/multitrait.stderr index 5a8bb2f7a..6100f64e3 100644 --- a/tests/ui/parser/multitrait.stderr +++ b/tests/ui/parser/multitrait.stderr @@ -4,5 +4,5 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found ` LL | impl Cmp, ToString for S { | ^ expected one of 8 possible tokens -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/mut-patterns.rs b/tests/ui/parser/mut-patterns.rs index 8b83d6ab2..f2d2df0af 100644 --- a/tests/ui/parser/mut-patterns.rs +++ b/tests/ui/parser/mut-patterns.rs @@ -27,7 +27,7 @@ pub fn main() { struct r#yield(u8, u8); let mut mut yield(become, await) = r#yield(0, 0); //~^ ERROR `mut` on a binding may not be repeated - //~| ERROR `mut` must be attached to each individual binding + //~| ERROR `mut` must be followed by a named binding //~| ERROR expected identifier, found reserved keyword `yield` //~| ERROR expected identifier, found reserved keyword `become` //~| ERROR expected identifier, found keyword `await` diff --git a/tests/ui/parser/mut-patterns.stderr b/tests/ui/parser/mut-patterns.stderr index f179d8c9e..6559cf09c 100644 --- a/tests/ui/parser/mut-patterns.stderr +++ b/tests/ui/parser/mut-patterns.stderr @@ -2,7 +2,7 @@ error: `mut` must be followed by a named binding --> $DIR/mut-patterns.rs:9:9 | LL | let mut _ = 0; - | ^^^^^ help: remove the `mut` prefix: `_` + | ^^^^ help: remove the `mut` prefix | = note: `mut` may be followed by `variable` and `variable @ pattern` @@ -10,7 +10,7 @@ error: `mut` must be followed by a named binding --> $DIR/mut-patterns.rs:10:9 | LL | let mut (_, _) = (0, 0); - | ^^^^^^^^^^ help: remove the `mut` prefix: `(_, _)` + | ^^^^ help: remove the `mut` prefix | = note: `mut` may be followed by `variable` and `variable @ pattern` @@ -83,11 +83,11 @@ help: escape `await` to use it as an identifier LL | let mut mut yield(become, r#await) = r#yield(0, 0); | ++ -error: `mut` must be attached to each individual binding +error: `mut` must be followed by a named binding --> $DIR/mut-patterns.rs:28:9 | LL | let mut mut yield(become, await) = r#yield(0, 0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add `mut` to each binding: `r#yield(mut r#become, mut r#await)` + | ^^^^^^^^ help: remove the `mut` prefix | = note: `mut` may be followed by `variable` and `variable @ pattern` diff --git a/tests/ui/parser/nested-bad-turbofish.stderr b/tests/ui/parser/nested-bad-turbofish.stderr index d82fa80e5..a23c23c41 100644 --- a/tests/ui/parser/nested-bad-turbofish.stderr +++ b/tests/ui/parser/nested-bad-turbofish.stderr @@ -7,5 +7,5 @@ LL | foo<<S as T>::V>(); = help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments = help: or use `(...)` if you meant to specify fn arguments -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/nested-missing-closing-angle-bracket.stderr b/tests/ui/parser/nested-missing-closing-angle-bracket.stderr index b85bc0256..8d69125f8 100644 --- a/tests/ui/parser/nested-missing-closing-angle-bracket.stderr +++ b/tests/ui/parser/nested-missing-closing-angle-bracket.stderr @@ -4,5 +4,5 @@ error: expected one of `,` or `>`, found `;` LL | let v : Vec::<Vec<(u32,_,_)> = vec![vec![]]; | - while parsing the type for `v` ^ expected one of `,` or `>` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/new-unicode-escapes-1.stderr b/tests/ui/parser/new-unicode-escapes-1.stderr index d133e46b4..491915c89 100644 --- a/tests/ui/parser/new-unicode-escapes-1.stderr +++ b/tests/ui/parser/new-unicode-escapes-1.stderr @@ -9,5 +9,5 @@ help: terminate the unicode escape LL | let s = "\u{2603}"; | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/new-unicode-escapes-2.stderr b/tests/ui/parser/new-unicode-escapes-2.stderr index 2f3f8c0f9..e0bdf533d 100644 --- a/tests/ui/parser/new-unicode-escapes-2.stderr +++ b/tests/ui/parser/new-unicode-escapes-2.stderr @@ -4,5 +4,5 @@ error: overlong unicode escape LL | let s = "\u{260311111111}"; | ^^^^^^^^^^^^^^^^ must have at most 6 hex digits -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/new-unicode-escapes-4.stderr b/tests/ui/parser/new-unicode-escapes-4.stderr index 514591af1..d62afee7f 100644 --- a/tests/ui/parser/new-unicode-escapes-4.stderr +++ b/tests/ui/parser/new-unicode-escapes-4.stderr @@ -4,5 +4,5 @@ error: invalid character in unicode escape: `l` LL | let s = "\u{lol}"; | ^ invalid character in unicode escape -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/obsolete-syntax-impl-for-dotdot.stderr b/tests/ui/parser/obsolete-syntax-impl-for-dotdot.stderr index b7108ced0..d5f404bed 100644 --- a/tests/ui/parser/obsolete-syntax-impl-for-dotdot.stderr +++ b/tests/ui/parser/obsolete-syntax-impl-for-dotdot.stderr @@ -6,5 +6,5 @@ LL | impl Trait2 for .. {} | = help: use `auto trait Trait {}` instead -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/omitted-arg-in-item-fn.stderr b/tests/ui/parser/omitted-arg-in-item-fn.stderr index ce2eab051..6f2a9f64c 100644 --- a/tests/ui/parser/omitted-arg-in-item-fn.stderr +++ b/tests/ui/parser/omitted-arg-in-item-fn.stderr @@ -18,5 +18,5 @@ help: if this is a type, explicitly ignore the parameter name LL | fn foo(_: x) { | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/paamayim-nekudotayim.stderr b/tests/ui/parser/paamayim-nekudotayim.stderr index 6ceba07f4..7d40cd63f 100644 --- a/tests/ui/parser/paamayim-nekudotayim.stderr +++ b/tests/ui/parser/paamayim-nekudotayim.stderr @@ -4,5 +4,5 @@ error: expected identifier, found `;` LL | ::; | ^ expected identifier -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/parser-recovery-1.stderr b/tests/ui/parser/parser-recovery-1.stderr index 7045b6f5b..8162db3d8 100644 --- a/tests/ui/parser/parser-recovery-1.stderr +++ b/tests/ui/parser/parser-recovery-1.stderr @@ -12,5 +12,5 @@ LL | } LL | } | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/parser-recovery-2.stderr b/tests/ui/parser/parser-recovery-2.stderr index f396e5fde..d3d6c9b08 100644 --- a/tests/ui/parser/parser-recovery-2.stderr +++ b/tests/ui/parser/parser-recovery-2.stderr @@ -7,5 +7,5 @@ LL | let x = foo(); LL | ) | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-lt-bracket-1.rs b/tests/ui/parser/pat-lt-bracket-1.rs index 2e2001434..33da15adb 100644 --- a/tests/ui/parser/pat-lt-bracket-1.rs +++ b/tests/ui/parser/pat-lt-bracket-1.rs @@ -1,7 +1,7 @@ fn main() { match 42 { x < 7 => (), - //~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<` + //~^ error: expected one of `,`, `=>`, `@`, `if`, `|`, or `}`, found `<` _ => () } } diff --git a/tests/ui/parser/pat-lt-bracket-1.stderr b/tests/ui/parser/pat-lt-bracket-1.stderr index e8ccbad66..f39487052 100644 --- a/tests/ui/parser/pat-lt-bracket-1.stderr +++ b/tests/ui/parser/pat-lt-bracket-1.stderr @@ -1,8 +1,8 @@ -error: expected one of `=>`, `@`, `if`, or `|`, found `<` +error: expected one of `,`, `=>`, `@`, `if`, `|`, or `}`, found `<` --> $DIR/pat-lt-bracket-1.rs:3:7 | LL | x < 7 => (), - | ^ expected one of `=>`, `@`, `if`, or `|` + | ^ expected one of `,`, `=>`, `@`, `if`, `|`, or `}` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-lt-bracket-2.stderr b/tests/ui/parser/pat-lt-bracket-2.stderr index c78f96e1a..5fe97b2ef 100644 --- a/tests/ui/parser/pat-lt-bracket-2.stderr +++ b/tests/ui/parser/pat-lt-bracket-2.stderr @@ -14,5 +14,5 @@ help: if this is a type, explicitly ignore the parameter name LL | fn a(_: B<) {} | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-lt-bracket-3.rs b/tests/ui/parser/pat-lt-bracket-3.rs index a8bdfd3fa..bd83fe8db 100644 --- a/tests/ui/parser/pat-lt-bracket-3.rs +++ b/tests/ui/parser/pat-lt-bracket-3.rs @@ -3,8 +3,7 @@ struct Foo<T>(T, T); impl<T> Foo<T> { fn foo(&self) { match *self { - Foo<T>(x, y) => { - //~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<` + Foo<T>(x, y) => { //~ ERROR generic args in patterns require the turbofish syntax println!("Goodbye, World!") } } diff --git a/tests/ui/parser/pat-lt-bracket-3.stderr b/tests/ui/parser/pat-lt-bracket-3.stderr index bacf868e3..cdb1b3177 100644 --- a/tests/ui/parser/pat-lt-bracket-3.stderr +++ b/tests/ui/parser/pat-lt-bracket-3.stderr @@ -1,8 +1,13 @@ -error: expected one of `=>`, `@`, `if`, or `|`, found `<` +error: generic args in patterns require the turbofish syntax --> $DIR/pat-lt-bracket-3.rs:6:16 | LL | Foo<T>(x, y) => { - | ^ expected one of `=>`, `@`, `if`, or `|` + | ^ + | +help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + | +LL | Foo::<T>(x, y) => { + | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-lt-bracket-4.rs b/tests/ui/parser/pat-lt-bracket-4.rs index de314f6c6..6d348b68c 100644 --- a/tests/ui/parser/pat-lt-bracket-4.rs +++ b/tests/ui/parser/pat-lt-bracket-4.rs @@ -5,7 +5,7 @@ enum BtNode { fn main() { let y = match 10 { - Foo<T>::A(value) => value, //~ error: expected one of `=>`, `@`, `if`, or `|`, found `<` + Foo<T>::A(value) => value, //~ ERROR generic args in patterns require the turbofish syntax Foo<T>::B => 7, }; } diff --git a/tests/ui/parser/pat-lt-bracket-4.stderr b/tests/ui/parser/pat-lt-bracket-4.stderr index 911c276b9..92d16564a 100644 --- a/tests/ui/parser/pat-lt-bracket-4.stderr +++ b/tests/ui/parser/pat-lt-bracket-4.stderr @@ -1,8 +1,13 @@ -error: expected one of `=>`, `@`, `if`, or `|`, found `<` +error: generic args in patterns require the turbofish syntax --> $DIR/pat-lt-bracket-4.rs:8:12 | LL | Foo<T>::A(value) => value, - | ^ expected one of `=>`, `@`, `if`, or `|` + | ^ + | +help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + | +LL | Foo::<T>::A(value) => value, + | ++ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-lt-bracket-5.stderr b/tests/ui/parser/pat-lt-bracket-5.stderr index e23674bce..e556e6c02 100644 --- a/tests/ui/parser/pat-lt-bracket-5.stderr +++ b/tests/ui/parser/pat-lt-bracket-5.stderr @@ -4,5 +4,5 @@ error: expected one of `:`, `;`, `=`, `@`, or `|`, found `[` LL | let v[0] = v[1]; | ^ expected one of `:`, `;`, `=`, `@`, or `|` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-ranges-1.stderr b/tests/ui/parser/pat-ranges-1.stderr index b64a3ce5c..e4d4e145c 100644 --- a/tests/ui/parser/pat-ranges-1.stderr +++ b/tests/ui/parser/pat-ranges-1.stderr @@ -4,5 +4,5 @@ error: expected one of `:`, `;`, `=`, or `|`, found `..=` LL | let macropus!() ..= 11 = 12; | ^^^ expected one of `:`, `;`, `=`, or `|` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-ranges-2.stderr b/tests/ui/parser/pat-ranges-2.stderr index 1a9e33beb..c27436a81 100644 --- a/tests/ui/parser/pat-ranges-2.stderr +++ b/tests/ui/parser/pat-ranges-2.stderr @@ -4,5 +4,5 @@ error: expected one of `::`, `:`, `;`, `=`, or `|`, found `!` LL | let 10 ..= makropulos!() = 12; | ^ expected one of `::`, `:`, `;`, `=`, or `|` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-ranges-3.stderr b/tests/ui/parser/pat-ranges-3.stderr index c9787b789..611b35a65 100644 --- a/tests/ui/parser/pat-ranges-3.stderr +++ b/tests/ui/parser/pat-ranges-3.stderr @@ -4,5 +4,5 @@ error: expected one of `:`, `;`, `=`, or `|`, found `+` LL | let 10 ..= 10 + 3 = 12; | ^ expected one of `:`, `;`, `=`, or `|` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-ranges-4.stderr b/tests/ui/parser/pat-ranges-4.stderr index 69084b5a4..c30160291 100644 --- a/tests/ui/parser/pat-ranges-4.stderr +++ b/tests/ui/parser/pat-ranges-4.stderr @@ -4,5 +4,5 @@ error: expected one of `...`, `..=`, `..`, `:`, `;`, `=`, or `|`, found `-` LL | let 10 - 3 ..= 10 = 8; | ^ expected one of 7 possible tokens -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-ref-enum.stderr b/tests/ui/parser/pat-ref-enum.stderr index a3bce3372..ecda487d0 100644 --- a/tests/ui/parser/pat-ref-enum.stderr +++ b/tests/ui/parser/pat-ref-enum.stderr @@ -4,5 +4,5 @@ error: expected identifier, found enum pattern LL | ref Some(i) => {} | ^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-tuple-1.stderr b/tests/ui/parser/pat-tuple-1.stderr index 391f2c428..579365730 100644 --- a/tests/ui/parser/pat-tuple-1.stderr +++ b/tests/ui/parser/pat-tuple-1.stderr @@ -4,5 +4,5 @@ error: expected pattern, found `,` LL | (, ..) => {} | ^ expected pattern -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pat-tuple-3.stderr b/tests/ui/parser/pat-tuple-3.stderr index 9ac0611c5..7ce00462b 100644 --- a/tests/ui/parser/pat-tuple-3.stderr +++ b/tests/ui/parser/pat-tuple-3.stderr @@ -6,5 +6,5 @@ LL | (.., pat, ..) => {} | | | previously used here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/pub-method-macro.stderr b/tests/ui/parser/pub-method-macro.stderr index 7c7a90926..35cbf4230 100644 --- a/tests/ui/parser/pub-method-macro.stderr +++ b/tests/ui/parser/pub-method-macro.stderr @@ -6,5 +6,5 @@ LL | pub defn!(f); | = help: try adjusting the macro to put `pub` inside the invocation -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/public-instead-of-pub-1.stderr b/tests/ui/parser/public-instead-of-pub-1.stderr index 795a5bcf5..3fbe8d0b1 100644 --- a/tests/ui/parser/public-instead-of-pub-1.stderr +++ b/tests/ui/parser/public-instead-of-pub-1.stderr @@ -9,5 +9,5 @@ help: write `pub` instead of `public` to make the item public LL | pub enum Test { | ~~~ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/public-instead-of-pub-2.stderr b/tests/ui/parser/public-instead-of-pub-2.stderr index efe225656..09d564d7a 100644 --- a/tests/ui/parser/public-instead-of-pub-2.stderr +++ b/tests/ui/parser/public-instead-of-pub-2.stderr @@ -4,5 +4,5 @@ error: expected one of `!` or `::`, found keyword `let` LL | public let x = 1; | ^^^ expected one of `!` or `::` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/public-instead-of-pub-3.stderr b/tests/ui/parser/public-instead-of-pub-3.stderr index 72efae08d..b9b924e67 100644 --- a/tests/ui/parser/public-instead-of-pub-3.stderr +++ b/tests/ui/parser/public-instead-of-pub-3.stderr @@ -9,5 +9,5 @@ help: write `pub` instead of `public` to make the item public LL | pub const X: i32 = 123; | ~~~ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/public-instead-of-pub.stderr b/tests/ui/parser/public-instead-of-pub.stderr index af875491e..c98f8a991 100644 --- a/tests/ui/parser/public-instead-of-pub.stderr +++ b/tests/ui/parser/public-instead-of-pub.stderr @@ -9,5 +9,5 @@ help: write `pub` instead of `public` to make the item public LL | pub struct X; | ~~~ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/qualified-path-in-turbofish.stderr b/tests/ui/parser/qualified-path-in-turbofish.stderr index 8857d2ef3..6e5af8cc1 100644 --- a/tests/ui/parser/qualified-path-in-turbofish.stderr +++ b/tests/ui/parser/qualified-path-in-turbofish.stderr @@ -4,5 +4,5 @@ error: found single colon before projection in qualified path LL | template::<<Impl as T>:Ty>(); | ^ help: use double colon: `::` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/range-3.stderr b/tests/ui/parser/range-3.stderr index 340167f18..c8f26a3ba 100644 --- a/tests/ui/parser/range-3.stderr +++ b/tests/ui/parser/range-3.stderr @@ -4,5 +4,5 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `..` LL | let r = 1..2..3; | ^^ expected one of `.`, `;`, `?`, `else`, or an operator -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/range-4.stderr b/tests/ui/parser/range-4.stderr index 720d48938..a797fa319 100644 --- a/tests/ui/parser/range-4.stderr +++ b/tests/ui/parser/range-4.stderr @@ -4,5 +4,5 @@ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `..` LL | let r = ..1..2; | ^^ expected one of `.`, `;`, `?`, `else`, or an operator -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/range-inclusive-extra-equals.stderr b/tests/ui/parser/range-inclusive-extra-equals.stderr index d37b6be4f..83df719dd 100644 --- a/tests/ui/parser/range-inclusive-extra-equals.stderr +++ b/tests/ui/parser/range-inclusive-extra-equals.stderr @@ -6,5 +6,5 @@ LL | if let 1..==3 = 1 {} | = note: inclusive ranges end with a single equals sign (`..=`) -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/range_inclusive.stderr b/tests/ui/parser/range_inclusive.stderr index 8a9178263..0fd7f28db 100644 --- a/tests/ui/parser/range_inclusive.stderr +++ b/tests/ui/parser/range_inclusive.stderr @@ -6,6 +6,6 @@ LL | for _ in 1..= {} | = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0586`. diff --git a/tests/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.stderr b/tests/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.stderr index 3a7e2a4b1..796b1324a 100644 --- a/tests/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.stderr +++ b/tests/ui/parser/raw/issue-70677-panic-on-unterminated-raw-str-at-eof.stderr @@ -4,6 +4,6 @@ error[E0748]: unterminated raw string LL | r" | ^ unterminated raw string -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0748`. diff --git a/tests/ui/parser/raw/raw-byte-string-eof.stderr b/tests/ui/parser/raw/raw-byte-string-eof.stderr index a76668e80..88fd53904 100644 --- a/tests/ui/parser/raw/raw-byte-string-eof.stderr +++ b/tests/ui/parser/raw/raw-byte-string-eof.stderr @@ -8,6 +8,6 @@ LL | br##"a"#; | = note: this raw string should be terminated with `"##` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0748`. diff --git a/tests/ui/parser/raw/raw-literal-self.stderr b/tests/ui/parser/raw/raw-literal-self.stderr index 2a40dfe20..f42c3e8e7 100644 --- a/tests/ui/parser/raw/raw-literal-self.stderr +++ b/tests/ui/parser/raw/raw-literal-self.stderr @@ -4,5 +4,5 @@ error: `self` cannot be a raw identifier LL | let r#self: (); | ^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/raw/raw-literal-underscore.stderr b/tests/ui/parser/raw/raw-literal-underscore.stderr index d7a364d85..2edba430d 100644 --- a/tests/ui/parser/raw/raw-literal-underscore.stderr +++ b/tests/ui/parser/raw/raw-literal-underscore.stderr @@ -4,5 +4,5 @@ error: `_` cannot be a raw identifier LL | let r#_: (); | ^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/raw/raw-str-delim.stderr b/tests/ui/parser/raw/raw-str-delim.stderr index 8a04f99a1..5edd18cb4 100644 --- a/tests/ui/parser/raw/raw-str-delim.stderr +++ b/tests/ui/parser/raw/raw-str-delim.stderr @@ -4,5 +4,5 @@ error: found invalid character; only `#` is allowed in raw string delimitation: LL | r#~"#"~# | ^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/raw/raw-str-unterminated.stderr b/tests/ui/parser/raw/raw-str-unterminated.stderr index 077f763f1..9d15a2817 100644 --- a/tests/ui/parser/raw/raw-str-unterminated.stderr +++ b/tests/ui/parser/raw/raw-str-unterminated.stderr @@ -6,6 +6,6 @@ LL | r#" string literal goes on | = note: this raw string should be terminated with `"#` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0748`. diff --git a/tests/ui/parser/raw/raw-string-2.stderr b/tests/ui/parser/raw/raw-string-2.stderr index 8bbac9d7b..90dd9775e 100644 --- a/tests/ui/parser/raw/raw-string-2.stderr +++ b/tests/ui/parser/raw/raw-string-2.stderr @@ -6,6 +6,6 @@ LL | let x = r###"here's a long string"# "# "##; | = note: this raw string should be terminated with `"###` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0748`. diff --git a/tests/ui/parser/raw/raw-string.stderr b/tests/ui/parser/raw/raw-string.stderr index b2b853a89..6654ef7a7 100644 --- a/tests/ui/parser/raw/raw-string.stderr +++ b/tests/ui/parser/raw/raw-string.stderr @@ -8,6 +8,6 @@ LL | let x = r##"lol"#; | = note: this raw string should be terminated with `"##` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0748`. diff --git a/tests/ui/parser/raw/too-many-hash.stderr b/tests/ui/parser/raw/too-many-hash.stderr index 29ec17842..1c46b5385 100644 --- a/tests/ui/parser/raw/too-many-hash.stderr +++ b/tests/ui/parser/raw/too-many-hash.stderr @@ -4,5 +4,5 @@ error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbo LL | ... = r################################################################################################################################################################################################################################################################"very raw"##############################################################################################################################################################################################################################################################... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover-enum2.stderr b/tests/ui/parser/recover-enum2.stderr deleted file mode 100644 index 7634bca92..000000000 --- a/tests/ui/parser/recover-enum2.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: expected type, found `{` - --> $DIR/recover-enum2.rs:6:18 - | -LL | Var3 { - | ---- while parsing this struct -LL | abc: {}, - | ^ expected type - -error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{` - --> $DIR/recover-enum2.rs:25:22 - | -LL | Nope(i32 {}) - | ^ expected one of 7 possible tokens - -error: aborting due to 2 previous errors - diff --git a/tests/ui/parser/recover-for-loop-parens-around-head.stderr b/tests/ui/parser/recover-for-loop-parens-around-head.stderr deleted file mode 100644 index 3bad29f20..000000000 --- a/tests/ui/parser/recover-for-loop-parens-around-head.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: expected one of `)`, `,`, `@`, or `|`, found keyword `in` - --> $DIR/recover-for-loop-parens-around-head.rs:10:16 - | -LL | for ( elem in vec ) { - | ^^ expected one of `)`, `,`, `@`, or `|` - -error: unexpected parentheses surrounding `for` loop head - --> $DIR/recover-for-loop-parens-around-head.rs:10:9 - | -LL | for ( elem in vec ) { - | ^ ^ - | -help: remove parentheses in `for` loop - | -LL - for ( elem in vec ) { -LL + for elem in vec { - | - -error[E0308]: mismatched types - --> $DIR/recover-for-loop-parens-around-head.rs:13:38 - | -LL | const RECOVERY_WITNESS: () = 0; - | ^ expected `()`, found integer - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.rs b/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.rs new file mode 100644 index 000000000..b9e3c5783 --- /dev/null +++ b/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.rs @@ -0,0 +1,13 @@ +trait Trait {} + +fn test(_: &for<'a> dyn Trait) {} +//~^ ERROR `for<...>` expected after `dyn`, not before + +fn test2(_: for<'a> impl Trait) {} +//~^ ERROR `for<...>` expected after `impl`, not before + +// Issue #118564 +type A2 = dyn<for<> dyn>; +//~^ ERROR expected identifier, found `>` + +fn main() {} diff --git a/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.stderr b/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.stderr new file mode 100644 index 000000000..a012220e8 --- /dev/null +++ b/tests/ui/parser/recover-hrtb-before-dyn-impl-kw.stderr @@ -0,0 +1,32 @@ +error: `for<...>` expected after `dyn`, not before + --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:3:21 + | +LL | fn test(_: &for<'a> dyn Trait) {} + | ^^^ + | +help: move `dyn` before the `for<...>` + | +LL - fn test(_: &for<'a> dyn Trait) {} +LL + fn test(_: &dyn for<'a> Trait) {} + | + +error: `for<...>` expected after `impl`, not before + --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:6:21 + | +LL | fn test2(_: for<'a> impl Trait) {} + | ^^^^ + | +help: move `impl` before the `for<...>` + | +LL - fn test2(_: for<'a> impl Trait) {} +LL + fn test2(_: impl for<'a> Trait) {} + | + +error: expected identifier, found `>` + --> $DIR/recover-hrtb-before-dyn-impl-kw.rs:10:24 + | +LL | type A2 = dyn<for<> dyn>; + | ^ expected identifier + +error: aborting due to 3 previous errors + diff --git a/tests/ui/parser/issues/issue-104088.rs b/tests/ui/parser/recover/binding-name-starting-with-number.rs index 3dc636b6a..6b279c553 100644 --- a/tests/ui/parser/issues/issue-104088.rs +++ b/tests/ui/parser/recover/binding-name-starting-with-number.rs @@ -8,10 +8,12 @@ fn 1234test() { let 23name = 123; //~^ ERROR expected identifier, found `23name` - +} +fn foo() { let 2x: i32 = 123; //~^ ERROR expected identifier, found `2x` - +} +fn bar() { let 1x = 123; //~^ ERROR expected identifier, found `1x` } diff --git a/tests/ui/parser/issues/issue-104088.stderr b/tests/ui/parser/recover/binding-name-starting-with-number.stderr index 8b751759d..de59a7de0 100644 --- a/tests/ui/parser/issues/issue-104088.stderr +++ b/tests/ui/parser/recover/binding-name-starting-with-number.stderr @@ -1,53 +1,53 @@ error: expected identifier, found `1234test` - --> $DIR/issue-104088.rs:1:4 + --> $DIR/binding-name-starting-with-number.rs:1:4 | LL | fn 1234test() { | ^^^^^^^^ expected identifier | help: identifiers cannot start with a number - --> $DIR/issue-104088.rs:1:4 + --> $DIR/binding-name-starting-with-number.rs:1:4 | LL | fn 1234test() { | ^^^^ error: expected identifier, found `23name` - --> $DIR/issue-104088.rs:9:9 + --> $DIR/binding-name-starting-with-number.rs:9:9 | LL | let 23name = 123; | ^^^^^^ expected identifier | help: identifiers cannot start with a number - --> $DIR/issue-104088.rs:9:9 + --> $DIR/binding-name-starting-with-number.rs:9:9 | LL | let 23name = 123; | ^^ error: expected identifier, found `2x` - --> $DIR/issue-104088.rs:12:9 + --> $DIR/binding-name-starting-with-number.rs:13:9 | LL | let 2x: i32 = 123; | ^^ expected identifier | help: identifiers cannot start with a number - --> $DIR/issue-104088.rs:12:9 + --> $DIR/binding-name-starting-with-number.rs:13:9 | LL | let 2x: i32 = 123; | ^ error: expected identifier, found `1x` - --> $DIR/issue-104088.rs:15:9 + --> $DIR/binding-name-starting-with-number.rs:17:9 | LL | let 1x = 123; | ^^ expected identifier | help: identifiers cannot start with a number - --> $DIR/issue-104088.rs:15:9 + --> $DIR/binding-name-starting-with-number.rs:17:9 | LL | let 1x = 123; | ^ error[E0308]: mismatched types - --> $DIR/issue-104088.rs:5:12 + --> $DIR/binding-name-starting-with-number.rs:5:12 | LL | if let 2e1 = 123 { | ^^^ --- this expression has type `{integer}` diff --git a/tests/ui/parser/recover-assoc-const-constraint.rs b/tests/ui/parser/recover/recover-assoc-const-constraint.rs index 1453e6cb5..1453e6cb5 100644 --- a/tests/ui/parser/recover-assoc-const-constraint.rs +++ b/tests/ui/parser/recover/recover-assoc-const-constraint.rs diff --git a/tests/ui/parser/recover-assoc-const-constraint.stderr b/tests/ui/parser/recover/recover-assoc-const-constraint.stderr index 2d36ce4e9..2d36ce4e9 100644 --- a/tests/ui/parser/recover-assoc-const-constraint.stderr +++ b/tests/ui/parser/recover/recover-assoc-const-constraint.stderr diff --git a/tests/ui/parser/recover-assoc-eq-missing-term.rs b/tests/ui/parser/recover/recover-assoc-eq-missing-term.rs index 4b42c44dc..4b42c44dc 100644 --- a/tests/ui/parser/recover-assoc-eq-missing-term.rs +++ b/tests/ui/parser/recover/recover-assoc-eq-missing-term.rs diff --git a/tests/ui/parser/recover-assoc-eq-missing-term.stderr b/tests/ui/parser/recover/recover-assoc-eq-missing-term.stderr index 152f7f2fb..cf50c0266 100644 --- a/tests/ui/parser/recover-assoc-eq-missing-term.stderr +++ b/tests/ui/parser/recover/recover-assoc-eq-missing-term.stderr @@ -14,5 +14,5 @@ LL - bar::<Item = >(); LL + bar::<Item >(); | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover-assoc-lifetime-constraint.rs b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs index 558fcdfe1..558fcdfe1 100644 --- a/tests/ui/parser/recover-assoc-lifetime-constraint.rs +++ b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.rs diff --git a/tests/ui/parser/recover-assoc-lifetime-constraint.stderr b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr index 79437533d..39a6682fc 100644 --- a/tests/ui/parser/recover-assoc-lifetime-constraint.stderr +++ b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr @@ -8,5 +8,5 @@ LL | bar::<Item = 'a>(); | = help: if you meant to specify a trait object, write `dyn Trait + 'lifetime` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover-const-async-fn-ptr.rs b/tests/ui/parser/recover/recover-const-async-fn-ptr.rs index 25af8772c..25af8772c 100644 --- a/tests/ui/parser/recover-const-async-fn-ptr.rs +++ b/tests/ui/parser/recover/recover-const-async-fn-ptr.rs diff --git a/tests/ui/parser/recover-const-async-fn-ptr.stderr b/tests/ui/parser/recover/recover-const-async-fn-ptr.stderr index 7012096b6..7012096b6 100644 --- a/tests/ui/parser/recover-const-async-fn-ptr.stderr +++ b/tests/ui/parser/recover/recover-const-async-fn-ptr.stderr diff --git a/tests/ui/parser/recover-enum.rs b/tests/ui/parser/recover/recover-enum.rs index 08dd939e2..08dd939e2 100644 --- a/tests/ui/parser/recover-enum.rs +++ b/tests/ui/parser/recover/recover-enum.rs diff --git a/tests/ui/parser/recover-enum.stderr b/tests/ui/parser/recover/recover-enum.stderr index a2b650e4f..a2b650e4f 100644 --- a/tests/ui/parser/recover-enum.stderr +++ b/tests/ui/parser/recover/recover-enum.stderr diff --git a/tests/ui/parser/recover-enum2.rs b/tests/ui/parser/recover/recover-enum2.rs index 0c9420889..56b57f625 100644 --- a/tests/ui/parser/recover-enum2.rs +++ b/tests/ui/parser/recover/recover-enum2.rs @@ -8,7 +8,7 @@ fn main() { } // recover... - let a = 1; + let () = 1; //~ ERROR mismatched types enum Test2 { Fine, } @@ -24,5 +24,6 @@ fn main() { enum Test4 { Nope(i32 {}) //~ ERROR: found `{` } + let () = 1; //~ ERROR mismatched types } } diff --git a/tests/ui/parser/recover/recover-enum2.stderr b/tests/ui/parser/recover/recover-enum2.stderr new file mode 100644 index 000000000..132f84cc7 --- /dev/null +++ b/tests/ui/parser/recover/recover-enum2.stderr @@ -0,0 +1,37 @@ +error: expected type, found `{` + --> $DIR/recover-enum2.rs:6:18 + | +LL | Var3 { + | ---- while parsing this struct +LL | abc: {}, + | ^ expected type + +error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{` + --> $DIR/recover-enum2.rs:25:22 + | +LL | enum Test4 { + | ----- while parsing this enum +LL | Nope(i32 {}) + | ^ expected one of 7 possible tokens + | + = help: enum variants can be `Variant`, `Variant = <integer>`, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` + +error[E0308]: mismatched types + --> $DIR/recover-enum2.rs:11:9 + | +LL | let () = 1; + | ^^ - this expression has type `{integer}` + | | + | expected integer, found `()` + +error[E0308]: mismatched types + --> $DIR/recover-enum2.rs:27:13 + | +LL | let () = 1; + | ^^ - this expression has type `{integer}` + | | + | expected integer, found `()` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/recover-field-extra-angle-brackets-in-struct-with-a-field.rs b/tests/ui/parser/recover/recover-field-extra-angle-brackets-in-struct-with-a-field.rs index e815c7611..e815c7611 100644 --- a/tests/ui/parser/recover-field-extra-angle-brackets-in-struct-with-a-field.rs +++ b/tests/ui/parser/recover/recover-field-extra-angle-brackets-in-struct-with-a-field.rs diff --git a/tests/ui/parser/recover-field-extra-angle-brackets-in-struct-with-a-field.stderr b/tests/ui/parser/recover/recover-field-extra-angle-brackets-in-struct-with-a-field.stderr index 17237c930..2b56498c5 100644 --- a/tests/ui/parser/recover-field-extra-angle-brackets-in-struct-with-a-field.stderr +++ b/tests/ui/parser/recover/recover-field-extra-angle-brackets-in-struct-with-a-field.stderr @@ -7,5 +7,5 @@ LL | | LL | | } | |_ help: remove extra angle bracket -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover-field-extra-angle-brackets.rs b/tests/ui/parser/recover/recover-field-extra-angle-brackets.rs index 5e0e00bcb..5e0e00bcb 100644 --- a/tests/ui/parser/recover-field-extra-angle-brackets.rs +++ b/tests/ui/parser/recover/recover-field-extra-angle-brackets.rs diff --git a/tests/ui/parser/recover-field-extra-angle-brackets.stderr b/tests/ui/parser/recover/recover-field-extra-angle-brackets.stderr index 318e55f6e..628626926 100644 --- a/tests/ui/parser/recover-field-extra-angle-brackets.stderr +++ b/tests/ui/parser/recover/recover-field-extra-angle-brackets.stderr @@ -4,5 +4,5 @@ error: unmatched angle bracket LL | first: Vec<u8>>, | ^ help: remove extra angle bracket -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover-field-semi.rs b/tests/ui/parser/recover/recover-field-semi.rs index b70357886..b70357886 100644 --- a/tests/ui/parser/recover-field-semi.rs +++ b/tests/ui/parser/recover/recover-field-semi.rs diff --git a/tests/ui/parser/recover-field-semi.stderr b/tests/ui/parser/recover/recover-field-semi.stderr index 3cf484748..3cf484748 100644 --- a/tests/ui/parser/recover-field-semi.stderr +++ b/tests/ui/parser/recover/recover-field-semi.stderr diff --git a/tests/ui/parser/recover-fn-ptr-with-generics.rs b/tests/ui/parser/recover/recover-fn-ptr-with-generics.rs index 31de418be..31de418be 100644 --- a/tests/ui/parser/recover-fn-ptr-with-generics.rs +++ b/tests/ui/parser/recover/recover-fn-ptr-with-generics.rs diff --git a/tests/ui/parser/recover-fn-ptr-with-generics.stderr b/tests/ui/parser/recover/recover-fn-ptr-with-generics.stderr index 069fcffe9..069fcffe9 100644 --- a/tests/ui/parser/recover-fn-ptr-with-generics.stderr +++ b/tests/ui/parser/recover/recover-fn-ptr-with-generics.stderr diff --git a/tests/ui/parser/recover-fn-trait-from-fn-kw.rs b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.rs index b6611e627..b6611e627 100644 --- a/tests/ui/parser/recover-fn-trait-from-fn-kw.rs +++ b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.rs diff --git a/tests/ui/parser/recover-fn-trait-from-fn-kw.stderr b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr index 3681a796c..3681a796c 100644 --- a/tests/ui/parser/recover-fn-trait-from-fn-kw.stderr +++ b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr diff --git a/tests/ui/parser/recover/recover-for-loop-parens-around-head.fixed b/tests/ui/parser/recover/recover-for-loop-parens-around-head.fixed new file mode 100644 index 000000000..6afc2d993 --- /dev/null +++ b/tests/ui/parser/recover/recover-for-loop-parens-around-head.fixed @@ -0,0 +1,15 @@ +// run-rustfix +// Here we test that the parser is able to recover in a situation like +// `for ( $pat in $expr )` since that is familiar syntax in other languages. +// Instead we suggest that the user writes `for $pat in $expr`. + +#![deny(unused)] // Make sure we don't trigger `unused_parens`. + +fn main() { + let vec = vec![1, 2, 3]; + + for _elem in vec { + //~^ ERROR unexpected parentheses surrounding `for` loop head + const _RECOVERY_WITNESS: u32 = 0u32; //~ ERROR mismatched types + } +} diff --git a/tests/ui/parser/recover-for-loop-parens-around-head.rs b/tests/ui/parser/recover/recover-for-loop-parens-around-head.rs index 053b428bd..b1716900c 100644 --- a/tests/ui/parser/recover-for-loop-parens-around-head.rs +++ b/tests/ui/parser/recover/recover-for-loop-parens-around-head.rs @@ -1,3 +1,4 @@ +// run-rustfix // Here we test that the parser is able to recover in a situation like // `for ( $pat in $expr )` since that is familiar syntax in other languages. // Instead we suggest that the user writes `for $pat in $expr`. @@ -7,9 +8,8 @@ fn main() { let vec = vec![1, 2, 3]; - for ( elem in vec ) { - //~^ ERROR expected one of `)`, `,`, `@`, or `|`, found keyword `in` - //~| ERROR unexpected parentheses surrounding `for` loop head - const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types + for ( _elem in vec ) { + //~^ ERROR unexpected parentheses surrounding `for` loop head + const _RECOVERY_WITNESS: u32 = 0u8; //~ ERROR mismatched types } } diff --git a/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr b/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr new file mode 100644 index 000000000..beaa346e7 --- /dev/null +++ b/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr @@ -0,0 +1,26 @@ +error: unexpected parentheses surrounding `for` loop head + --> $DIR/recover-for-loop-parens-around-head.rs:11:9 + | +LL | for ( _elem in vec ) { + | ^ ^ + | +help: remove parentheses in `for` loop + | +LL - for ( _elem in vec ) { +LL + for _elem in vec { + | + +error[E0308]: mismatched types + --> $DIR/recover-for-loop-parens-around-head.rs:13:40 + | +LL | const _RECOVERY_WITNESS: u32 = 0u8; + | ^^^ expected `u32`, found `u8` + | +help: change the type of the numeric literal from `u8` to `u32` + | +LL | const _RECOVERY_WITNESS: u32 = 0u32; + | ~~~ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/recover-from-bad-variant.rs b/tests/ui/parser/recover/recover-from-bad-variant.rs index e8887147c..e8887147c 100644 --- a/tests/ui/parser/recover-from-bad-variant.rs +++ b/tests/ui/parser/recover/recover-from-bad-variant.rs diff --git a/tests/ui/parser/recover-from-bad-variant.stderr b/tests/ui/parser/recover/recover-from-bad-variant.stderr index 04968bbdf..04968bbdf 100644 --- a/tests/ui/parser/recover-from-bad-variant.stderr +++ b/tests/ui/parser/recover/recover-from-bad-variant.stderr diff --git a/tests/ui/parser/recover-from-homoglyph.rs b/tests/ui/parser/recover/recover-from-homoglyph.rs index 99ce0d1a6..99ce0d1a6 100644 --- a/tests/ui/parser/recover-from-homoglyph.rs +++ b/tests/ui/parser/recover/recover-from-homoglyph.rs diff --git a/tests/ui/parser/recover-from-homoglyph.stderr b/tests/ui/parser/recover/recover-from-homoglyph.stderr index f11ca9fd5..f11ca9fd5 100644 --- a/tests/ui/parser/recover-from-homoglyph.stderr +++ b/tests/ui/parser/recover/recover-from-homoglyph.stderr diff --git a/tests/ui/parser/recover-labeled-non-block-expr.fixed b/tests/ui/parser/recover/recover-labeled-non-block-expr.fixed index c2e76444d..c2e76444d 100644 --- a/tests/ui/parser/recover-labeled-non-block-expr.fixed +++ b/tests/ui/parser/recover/recover-labeled-non-block-expr.fixed diff --git a/tests/ui/parser/recover-labeled-non-block-expr.rs b/tests/ui/parser/recover/recover-labeled-non-block-expr.rs index fc11c646a..fc11c646a 100644 --- a/tests/ui/parser/recover-labeled-non-block-expr.rs +++ b/tests/ui/parser/recover/recover-labeled-non-block-expr.rs diff --git a/tests/ui/parser/recover-labeled-non-block-expr.stderr b/tests/ui/parser/recover/recover-labeled-non-block-expr.stderr index d66ce6950..d66ce6950 100644 --- a/tests/ui/parser/recover-labeled-non-block-expr.stderr +++ b/tests/ui/parser/recover/recover-labeled-non-block-expr.stderr diff --git a/tests/ui/parser/recover-missing-semi-before-item.fixed b/tests/ui/parser/recover/recover-missing-semi-before-item.fixed index 0be17e69e..acb846373 100644 --- a/tests/ui/parser/recover-missing-semi-before-item.fixed +++ b/tests/ui/parser/recover/recover-missing-semi-before-item.fixed @@ -1,6 +1,6 @@ // run-rustfix -#![allow(unused_variables, dead_code)] +#![allow(unused_variables, dead_code, unused_imports)] fn for_struct() { let foo = 3; //~ ERROR expected `;`, found keyword `struct` diff --git a/tests/ui/parser/recover-missing-semi-before-item.rs b/tests/ui/parser/recover/recover-missing-semi-before-item.rs index 867b7b749..ef6cfe3c4 100644 --- a/tests/ui/parser/recover-missing-semi-before-item.rs +++ b/tests/ui/parser/recover/recover-missing-semi-before-item.rs @@ -1,6 +1,6 @@ // run-rustfix -#![allow(unused_variables, dead_code)] +#![allow(unused_variables, dead_code, unused_imports)] fn for_struct() { let foo = 3 //~ ERROR expected `;`, found keyword `struct` diff --git a/tests/ui/parser/recover-missing-semi-before-item.stderr b/tests/ui/parser/recover/recover-missing-semi-before-item.stderr index 61c43f2f1..61c43f2f1 100644 --- a/tests/ui/parser/recover-missing-semi-before-item.stderr +++ b/tests/ui/parser/recover/recover-missing-semi-before-item.stderr diff --git a/tests/ui/parser/recover-missing-semi.rs b/tests/ui/parser/recover/recover-missing-semi.rs index f47d5e680..f47d5e680 100644 --- a/tests/ui/parser/recover-missing-semi.rs +++ b/tests/ui/parser/recover/recover-missing-semi.rs diff --git a/tests/ui/parser/recover-missing-semi.stderr b/tests/ui/parser/recover/recover-missing-semi.stderr index ba4798285..ba4798285 100644 --- a/tests/ui/parser/recover-missing-semi.stderr +++ b/tests/ui/parser/recover/recover-missing-semi.stderr diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed b/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed new file mode 100644 index 000000000..6b9b7fa88 --- /dev/null +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed @@ -0,0 +1,12 @@ +// run-rustfix +fn main() { + let val = 42; + let x = match val { + 0 if true => { + //~^ ERROR unexpected parentheses surrounding `match` arm pattern + 42u8 + } + _ => 0u8, + }; + let _y: u32 = x.into(); //~ ERROR mismatched types +} diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs b/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs new file mode 100644 index 000000000..f523581e2 --- /dev/null +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs @@ -0,0 +1,12 @@ +// run-rustfix +fn main() { + let val = 42; + let x = match val { + (0 if true) => { + //~^ ERROR unexpected parentheses surrounding `match` arm pattern + 42u8 + } + _ => 0u8, + }; + let _y: u32 = x; //~ ERROR mismatched types +} diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr b/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr new file mode 100644 index 000000000..bad4d7d2f --- /dev/null +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr @@ -0,0 +1,28 @@ +error: unexpected parentheses surrounding `match` arm pattern + --> $DIR/recover-parens-around-match-arm-head.rs:5:9 + | +LL | (0 if true) => { + | ^ ^ + | +help: remove parentheses surrounding the pattern + | +LL - (0 if true) => { +LL + 0 if true => { + | + +error[E0308]: mismatched types + --> $DIR/recover-parens-around-match-arm-head.rs:11:19 + | +LL | let _y: u32 = x; + | --- ^ expected `u32`, found `u8` + | | + | expected due to this + | +help: you can convert a `u8` to a `u32` + | +LL | let _y: u32 = x.into(); + | +++++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/recover-quantified-closure.rs b/tests/ui/parser/recover/recover-quantified-closure.rs index 10af39b70..10af39b70 100644 --- a/tests/ui/parser/recover-quantified-closure.rs +++ b/tests/ui/parser/recover/recover-quantified-closure.rs diff --git a/tests/ui/parser/recover-quantified-closure.stderr b/tests/ui/parser/recover/recover-quantified-closure.stderr index 39eec80f6..37e93cbee 100644 --- a/tests/ui/parser/recover-quantified-closure.stderr +++ b/tests/ui/parser/recover/recover-quantified-closure.stderr @@ -25,10 +25,10 @@ LL | for <Foo>::Bar in x {} = help: consider removing `for<...>` error: implicit types in closure signatures are forbidden when `for<...>` is present - --> $DIR/recover-quantified-closure.rs:2:25 + --> $DIR/recover-quantified-closure.rs:2:24 | LL | for<'a> |x: &'a u8| *x + 1; - | ------- ^ + | ------- ^ | | | `for<...>` is here diff --git a/tests/ui/parser/recover-range-pats.rs b/tests/ui/parser/recover/recover-range-pats.rs index 156c7ad94..156c7ad94 100644 --- a/tests/ui/parser/recover-range-pats.rs +++ b/tests/ui/parser/recover/recover-range-pats.rs diff --git a/tests/ui/parser/recover-range-pats.stderr b/tests/ui/parser/recover/recover-range-pats.stderr index 5b69ca5cd..5b69ca5cd 100644 --- a/tests/ui/parser/recover-range-pats.stderr +++ b/tests/ui/parser/recover/recover-range-pats.stderr diff --git a/tests/ui/parser/recover-ref-dyn-mut.rs b/tests/ui/parser/recover/recover-ref-dyn-mut.rs index 3016275cc..3016275cc 100644 --- a/tests/ui/parser/recover-ref-dyn-mut.rs +++ b/tests/ui/parser/recover/recover-ref-dyn-mut.rs diff --git a/tests/ui/parser/recover-ref-dyn-mut.stderr b/tests/ui/parser/recover/recover-ref-dyn-mut.stderr index c048c8ea1..c048c8ea1 100644 --- a/tests/ui/parser/recover-ref-dyn-mut.stderr +++ b/tests/ui/parser/recover/recover-ref-dyn-mut.stderr diff --git a/tests/ui/parser/recover-struct.rs b/tests/ui/parser/recover/recover-struct.rs index bfa5b454c..bfa5b454c 100644 --- a/tests/ui/parser/recover-struct.rs +++ b/tests/ui/parser/recover/recover-struct.rs diff --git a/tests/ui/parser/recover-struct.stderr b/tests/ui/parser/recover/recover-struct.stderr index 9f6fb06ca..51a9e7077 100644 --- a/tests/ui/parser/recover-struct.stderr +++ b/tests/ui/parser/recover/recover-struct.stderr @@ -8,5 +8,5 @@ LL | Very LL | Bad | ^^^ unexpected token -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover-tuple-pat.rs b/tests/ui/parser/recover/recover-tuple-pat.rs index 7fded752d..7fded752d 100644 --- a/tests/ui/parser/recover-tuple-pat.rs +++ b/tests/ui/parser/recover/recover-tuple-pat.rs diff --git a/tests/ui/parser/recover-tuple-pat.stderr b/tests/ui/parser/recover/recover-tuple-pat.stderr index 93a6a66a6..e181f0720 100644 --- a/tests/ui/parser/recover-tuple-pat.stderr +++ b/tests/ui/parser/recover/recover-tuple-pat.stderr @@ -4,5 +4,5 @@ error: expected pattern, found `.` LL | (1, .=., 4) => { let _: usize = ""; } | ^ expected pattern -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover-tuple.rs b/tests/ui/parser/recover/recover-tuple.rs index 59e2695de..59e2695de 100644 --- a/tests/ui/parser/recover-tuple.rs +++ b/tests/ui/parser/recover/recover-tuple.rs diff --git a/tests/ui/parser/recover-tuple.stderr b/tests/ui/parser/recover/recover-tuple.stderr index 88891b54b..88891b54b 100644 --- a/tests/ui/parser/recover-tuple.stderr +++ b/tests/ui/parser/recover/recover-tuple.stderr diff --git a/tests/ui/parser/recover-unticked-labels.fixed b/tests/ui/parser/recover/recover-unticked-labels.fixed index 159d995b8..159d995b8 100644 --- a/tests/ui/parser/recover-unticked-labels.fixed +++ b/tests/ui/parser/recover/recover-unticked-labels.fixed diff --git a/tests/ui/parser/recover-unticked-labels.rs b/tests/ui/parser/recover/recover-unticked-labels.rs index 56034de68..56034de68 100644 --- a/tests/ui/parser/recover-unticked-labels.rs +++ b/tests/ui/parser/recover/recover-unticked-labels.rs diff --git a/tests/ui/parser/recover-unticked-labels.stderr b/tests/ui/parser/recover/recover-unticked-labels.stderr index fbd108ca6..fbd108ca6 100644 --- a/tests/ui/parser/recover-unticked-labels.stderr +++ b/tests/ui/parser/recover/recover-unticked-labels.stderr diff --git a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-0.fixed b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed index 227c40e97..227c40e97 100644 --- a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-0.fixed +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed diff --git a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-0.rs b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs index 3699e6fe5..3699e6fe5 100644 --- a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-0.rs +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs diff --git a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-0.stderr b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr index 18aa5fadb..18aa5fadb 100644 --- a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-0.stderr +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr diff --git a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-1.rs b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-1.rs index f515ae81e..f515ae81e 100644 --- a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-1.rs +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-1.rs diff --git a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-1.stderr b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-1.stderr index 2219c2a73..2219c2a73 100644 --- a/tests/ui/parser/recover-where-clause-before-tuple-struct-body-1.stderr +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-1.stderr diff --git a/tests/ui/parser/recovered-struct-variant.stderr b/tests/ui/parser/recovered-struct-variant.stderr index 78c67866f..f0050394b 100644 --- a/tests/ui/parser/recovered-struct-variant.stderr +++ b/tests/ui/parser/recovered-struct-variant.stderr @@ -6,5 +6,5 @@ LL | A { a, b: usize } | | | while parsing this struct -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/regions-out-of-scope-slice.stderr b/tests/ui/parser/regions-out-of-scope-slice.stderr index bbc657ffd..5d8f6af16 100644 --- a/tests/ui/parser/regions-out-of-scope-slice.stderr +++ b/tests/ui/parser/regions-out-of-scope-slice.stderr @@ -7,5 +7,5 @@ LL | x = &'blk [1,2,3]; | annotated with lifetime here | help: remove the lifetime annotation -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-closure-lifetime.stderr b/tests/ui/parser/removed-syntax-closure-lifetime.stderr index e107c6b78..4c991d67e 100644 --- a/tests/ui/parser/removed-syntax-closure-lifetime.stderr +++ b/tests/ui/parser/removed-syntax-closure-lifetime.stderr @@ -9,5 +9,5 @@ help: you might have meant to end the type parameters here LL | type closure = Box<lt>/fn()>; | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-enum-newtype.stderr b/tests/ui/parser/removed-syntax-enum-newtype.stderr index 8f7ca3567..5b917e938 100644 --- a/tests/ui/parser/removed-syntax-enum-newtype.stderr +++ b/tests/ui/parser/removed-syntax-enum-newtype.stderr @@ -6,5 +6,5 @@ LL | enum e = isize; | | | while parsing this enum -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-field-let.stderr b/tests/ui/parser/removed-syntax-field-let.stderr index 9bc18dabd..339d056e6 100644 --- a/tests/ui/parser/removed-syntax-field-let.stderr +++ b/tests/ui/parser/removed-syntax-field-let.stderr @@ -10,5 +10,5 @@ LL | let foo: (), = 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 +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-field-semicolon.stderr b/tests/ui/parser/removed-syntax-field-semicolon.stderr index 532d4fb2b..522912a9e 100644 --- a/tests/ui/parser/removed-syntax-field-semicolon.stderr +++ b/tests/ui/parser/removed-syntax-field-semicolon.stderr @@ -6,5 +6,5 @@ LL | struct S { LL | bar: (); | ^ help: replace `;` with `,` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-fixed-vec.stderr b/tests/ui/parser/removed-syntax-fixed-vec.stderr index a2b97544f..5bc9c2ccf 100644 --- a/tests/ui/parser/removed-syntax-fixed-vec.stderr +++ b/tests/ui/parser/removed-syntax-fixed-vec.stderr @@ -4,5 +4,5 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `*` LL | type v = [isize * 3]; | ^ expected one of 7 possible tokens -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-fn-sigil.rs b/tests/ui/parser/removed-syntax-fn-sigil.rs index 725843429..d55a032d1 100644 --- a/tests/ui/parser/removed-syntax-fn-sigil.rs +++ b/tests/ui/parser/removed-syntax-fn-sigil.rs @@ -1,3 +1,4 @@ fn main() { - let x: fn~() = || (); //~ ERROR expected `(`, found `~` + let x: fn~() = || (); //~ ERROR missing parameters for function definition + //~| ERROR expected one of `->`, `;`, or `=`, found `~` } diff --git a/tests/ui/parser/removed-syntax-fn-sigil.stderr b/tests/ui/parser/removed-syntax-fn-sigil.stderr index 196a5af47..0d3774167 100644 --- a/tests/ui/parser/removed-syntax-fn-sigil.stderr +++ b/tests/ui/parser/removed-syntax-fn-sigil.stderr @@ -1,10 +1,14 @@ -error: expected `(`, found `~` +error: missing parameters for function definition --> $DIR/removed-syntax-fn-sigil.rs:2:14 | LL | let x: fn~() = || (); - | - ^ expected `(` - | | - | while parsing the type for `x` + | ^ help: add a parameter list -error: aborting due to previous error +error: expected one of `->`, `;`, or `=`, found `~` + --> $DIR/removed-syntax-fn-sigil.rs:2:14 + | +LL | let x: fn~() = || (); + | ^ expected one of `->`, `;`, or `=` + +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/removed-syntax-mode.stderr b/tests/ui/parser/removed-syntax-mode.stderr index d0393b379..fd964c4b7 100644 --- a/tests/ui/parser/removed-syntax-mode.stderr +++ b/tests/ui/parser/removed-syntax-mode.stderr @@ -4,5 +4,5 @@ error: expected parameter name, found `+` LL | fn f(+x: isize) {} | ^ expected parameter name -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-mut-vec-expr.stderr b/tests/ui/parser/removed-syntax-mut-vec-expr.stderr index 313420fb9..a1aa1ae49 100644 --- a/tests/ui/parser/removed-syntax-mut-vec-expr.stderr +++ b/tests/ui/parser/removed-syntax-mut-vec-expr.stderr @@ -4,5 +4,5 @@ error: expected expression, found keyword `mut` LL | let v = [mut 1, 2, 3, 4]; | ^^^ expected expression -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-mut-vec-ty.stderr b/tests/ui/parser/removed-syntax-mut-vec-ty.stderr index 02b518e25..beaae7cdd 100644 --- a/tests/ui/parser/removed-syntax-mut-vec-ty.stderr +++ b/tests/ui/parser/removed-syntax-mut-vec-ty.stderr @@ -4,5 +4,5 @@ error: expected type, found keyword `mut` LL | type v = [mut isize]; | ^^^ expected type -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-ptr-lifetime.stderr b/tests/ui/parser/removed-syntax-ptr-lifetime.stderr index 914de43e6..5c74efffa 100644 --- a/tests/ui/parser/removed-syntax-ptr-lifetime.stderr +++ b/tests/ui/parser/removed-syntax-ptr-lifetime.stderr @@ -4,5 +4,5 @@ error: expected one of `!`, `(`, `::`, `;`, `<`, or `where`, found `/` LL | type bptr = &lifetime/isize; | ^ expected one of `!`, `(`, `::`, `;`, `<`, or `where` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-record.stderr b/tests/ui/parser/removed-syntax-record.stderr index 0a1655840..dbf09f1c7 100644 --- a/tests/ui/parser/removed-syntax-record.stderr +++ b/tests/ui/parser/removed-syntax-record.stderr @@ -4,5 +4,5 @@ error: expected type, found `{` LL | type t = { f: () }; | ^ expected type -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-uniq-mut-expr.stderr b/tests/ui/parser/removed-syntax-uniq-mut-expr.stderr index 63d2fdb8c..7aaedad19 100644 --- a/tests/ui/parser/removed-syntax-uniq-mut-expr.stderr +++ b/tests/ui/parser/removed-syntax-uniq-mut-expr.stderr @@ -4,5 +4,5 @@ error: expected expression, found keyword `mut` LL | let a_box = box mut 42; | ^^^ expected expression -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-uniq-mut-ty.stderr b/tests/ui/parser/removed-syntax-uniq-mut-ty.stderr index 39db0be9f..5ae1f4f58 100644 --- a/tests/ui/parser/removed-syntax-uniq-mut-ty.stderr +++ b/tests/ui/parser/removed-syntax-uniq-mut-ty.stderr @@ -4,5 +4,5 @@ error: expected one of `>`, a const expression, lifetime, or type, found keyword LL | type mut_box = Box<mut isize>; | ^^^ expected one of `>`, a const expression, lifetime, or type -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-with-1.stderr b/tests/ui/parser/removed-syntax-with-1.stderr index c3f747b61..78042678a 100644 --- a/tests/ui/parser/removed-syntax-with-1.stderr +++ b/tests/ui/parser/removed-syntax-with-1.stderr @@ -7,5 +7,5 @@ LL | let b = S { foo: () with a, bar: () }; | | help: try adding a comma: `,` | while parsing this struct -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/removed-syntax-with-2.stderr b/tests/ui/parser/removed-syntax-with-2.stderr index c6ae1ce67..e75c5bcd6 100644 --- a/tests/ui/parser/removed-syntax-with-2.stderr +++ b/tests/ui/parser/removed-syntax-with-2.stderr @@ -2,8 +2,9 @@ error: expected one of `,`, `:`, or `}`, found `a` --> $DIR/removed-syntax-with-2.rs:8:31 | LL | let b = S { foo: (), with a }; - | - ^ expected one of `,`, `:`, or `}` - | | + | - ---- ^ expected one of `,`, `:`, or `}` + | | | + | | while parsing this struct field | while parsing this struct error[E0063]: missing field `bar` in initializer of `S` diff --git a/tests/ui/parser/self-in-function-arg.stderr b/tests/ui/parser/self-in-function-arg.stderr index 47d8381b0..9ceec8d46 100644 --- a/tests/ui/parser/self-in-function-arg.stderr +++ b/tests/ui/parser/self-in-function-arg.stderr @@ -4,5 +4,5 @@ error: unexpected `self` parameter in function LL | fn foo(x:i32, self: i32) -> i32 { self } | ^^^^ must be the first parameter of an associated function -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/semi-in-let-chain.rs b/tests/ui/parser/semi-in-let-chain.rs new file mode 100644 index 000000000..9c21af037 --- /dev/null +++ b/tests/ui/parser/semi-in-let-chain.rs @@ -0,0 +1,27 @@ +// Issue #117720 + +#![feature(let_chains)] + +fn main() { + if let () = () + && let () = (); //~ERROR + && let () = () + { + } +} + +fn foo() { + if let () = () + && () == (); //~ERROR + && 1 < 0 + { + } +} + +fn bar() { + if let () = () + && () == (); //~ERROR + && let () = () + { + } +} diff --git a/tests/ui/parser/semi-in-let-chain.stderr b/tests/ui/parser/semi-in-let-chain.stderr new file mode 100644 index 000000000..c1a8f9296 --- /dev/null +++ b/tests/ui/parser/semi-in-let-chain.stderr @@ -0,0 +1,50 @@ +error: expected `{`, found `;` + --> $DIR/semi-in-let-chain.rs:7:23 + | +LL | && let () = (); + | ^ expected `{` + | +note: you likely meant to continue parsing the let-chain starting here + --> $DIR/semi-in-let-chain.rs:8:9 + | +LL | && let () = () + | ^^^^^^ +help: consider removing this semicolon to parse the `let` as part of the same chain + | +LL - && let () = (); +LL + && let () = () + | + +error: expected `{`, found `;` + --> $DIR/semi-in-let-chain.rs:15:20 + | +LL | && () == (); + | ^ expected `{` + | +note: the `if` expression is missing a block after this condition + --> $DIR/semi-in-let-chain.rs:14:8 + | +LL | if let () = () + | ________^ +LL | | && () == (); + | |___________________^ + +error: expected `{`, found `;` + --> $DIR/semi-in-let-chain.rs:23:20 + | +LL | && () == (); + | ^ expected `{` + | +note: you likely meant to continue parsing the let-chain starting here + --> $DIR/semi-in-let-chain.rs:24:9 + | +LL | && let () = () + | ^^^^^^ +help: consider removing this semicolon to parse the `let` as part of the same chain + | +LL - && () == (); +LL + && () == () + | + +error: aborting due to 3 previous errors + diff --git a/tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr b/tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr index 896a9dc83..41cd4fb93 100644 --- a/tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr +++ b/tests/ui/parser/shebang/issue-71471-ignore-tidy.stderr @@ -4,5 +4,5 @@ error: expected `[`, found `B` LL | #!B | ^ expected `[` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/shebang/shebang-doc-comment.stderr b/tests/ui/parser/shebang/shebang-doc-comment.stderr index 2227d45ec..92fefded5 100644 --- a/tests/ui/parser/shebang/shebang-doc-comment.stderr +++ b/tests/ui/parser/shebang/shebang-doc-comment.stderr @@ -3,6 +3,8 @@ error: expected item, found `[` | LL | [allow(unused_variables)] | ^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/shebang/shebang-must-start-file.stderr b/tests/ui/parser/shebang/shebang-must-start-file.stderr index 50543e8bd..56991c96b 100644 --- a/tests/ui/parser/shebang/shebang-must-start-file.stderr +++ b/tests/ui/parser/shebang/shebang-must-start-file.stderr @@ -4,5 +4,5 @@ error: expected `[`, found `/` LL | #!/bin/bash | ^ expected `[` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/similar-tokens.stderr b/tests/ui/parser/similar-tokens.stderr index 90acfc052..7070232c1 100644 --- a/tests/ui/parser/similar-tokens.stderr +++ b/tests/ui/parser/similar-tokens.stderr @@ -7,5 +7,5 @@ LL | use x::{A. B}; | expected one of `,`, `::`, `as`, or `}` | help: missing `,` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/struct-filed-with-attr.stderr b/tests/ui/parser/struct-filed-with-attr.stderr index c2cd7e82e..d850ed620 100644 --- a/tests/ui/parser/struct-filed-with-attr.stderr +++ b/tests/ui/parser/struct-filed-with-attr.stderr @@ -4,5 +4,5 @@ error: expected `,`, or `}`, found `#` LL | owo: bool | ^ help: try adding a comma: `,` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/struct-literal-in-if.rs b/tests/ui/parser/struct-literal-in-if.rs index 2ce2c8f18..c4a253c3d 100644 --- a/tests/ui/parser/struct-literal-in-if.rs +++ b/tests/ui/parser/struct-literal-in-if.rs @@ -14,4 +14,9 @@ fn main() { }.hi() { println!("yo"); } + if let true = Foo { //~ ERROR struct literals are not allowed here + x: 3 + }.hi() { + println!("yo"); + } } diff --git a/tests/ui/parser/struct-literal-in-if.stderr b/tests/ui/parser/struct-literal-in-if.stderr index b5a9864bb..8b72469fc 100644 --- a/tests/ui/parser/struct-literal-in-if.stderr +++ b/tests/ui/parser/struct-literal-in-if.stderr @@ -14,5 +14,21 @@ LL | x: 3 LL ~ }).hi() { | -error: aborting due to previous error +error: struct literals are not allowed here + --> $DIR/struct-literal-in-if.rs:17:19 + | +LL | if let true = Foo { + | ___________________^ +LL | | x: 3 +LL | | }.hi() { + | |_____^ + | +help: surround the struct literal with parentheses + | +LL ~ if let true = (Foo { +LL | x: 3 +LL ~ }).hi() { + | + +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/struct-literal-in-match-discriminant.stderr b/tests/ui/parser/struct-literal-in-match-discriminant.stderr index 692b4d735..5177f5f12 100644 --- a/tests/ui/parser/struct-literal-in-match-discriminant.stderr +++ b/tests/ui/parser/struct-literal-in-match-discriminant.stderr @@ -14,5 +14,5 @@ LL | x: 3 LL ~ }) { | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/struct-literal-in-match-guard.rs b/tests/ui/parser/struct-literal-in-match-guard.rs index bf0551b5c..bbee60e28 100644 --- a/tests/ui/parser/struct-literal-in-match-guard.rs +++ b/tests/ui/parser/struct-literal-in-match-guard.rs @@ -3,6 +3,8 @@ // Unlike `if` condition, `match` guards accept struct literals. // This is detected in <https://github.com/rust-lang/rust/pull/74566#issuecomment-663613705>. +#![feature(if_let_guard)] + #[derive(PartialEq)] struct Foo { x: isize, @@ -11,6 +13,7 @@ struct Foo { fn foo(f: Foo) { match () { () if f == Foo { x: 42 } => {} + () if let Foo { x: 0.. } = Foo { x: 42 } => {} _ => {} } } diff --git a/tests/ui/parser/struct-literal-in-while.rs b/tests/ui/parser/struct-literal-in-while.rs index 5000ce85b..86931f788 100644 --- a/tests/ui/parser/struct-literal-in-while.rs +++ b/tests/ui/parser/struct-literal-in-while.rs @@ -14,4 +14,9 @@ fn main() { }.hi() { println!("yo"); } + while let true = Foo { //~ ERROR struct literals are not allowed here + x: 3 + }.hi() { + println!("yo"); + } } diff --git a/tests/ui/parser/struct-literal-in-while.stderr b/tests/ui/parser/struct-literal-in-while.stderr index 17e9277e0..13d003608 100644 --- a/tests/ui/parser/struct-literal-in-while.stderr +++ b/tests/ui/parser/struct-literal-in-while.stderr @@ -14,5 +14,21 @@ LL | x: 3 LL ~ }).hi() { | -error: aborting due to previous error +error: struct literals are not allowed here + --> $DIR/struct-literal-in-while.rs:17:22 + | +LL | while let true = Foo { + | ______________________^ +LL | | x: 3 +LL | | }.hi() { + | |_____^ + | +help: surround the struct literal with parentheses + | +LL ~ while let true = (Foo { +LL | x: 3 +LL ~ }).hi() { + | + +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr b/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr index 0852c7cb4..c715486e2 100644 --- a/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr +++ b/tests/ui/parser/struct-literal-restrictions-in-lamda.stderr @@ -24,7 +24,7 @@ LL | | }.hi() { | |__________^ expected `bool`, found closure | = note: expected type `bool` - found closure `[closure@$DIR/struct-literal-restrictions-in-lamda.rs:12:11: 12:13]` + found closure `{closure@$DIR/struct-literal-restrictions-in-lamda.rs:12:11: 12:13}` help: use parentheses to call this closure | LL ~ while (|| Foo { diff --git a/tests/ui/parser/suggest-assoc-const.stderr b/tests/ui/parser/suggest-assoc-const.stderr index 2ddfa07c5..7ba1dbdff 100644 --- a/tests/ui/parser/suggest-assoc-const.stderr +++ b/tests/ui/parser/suggest-assoc-const.stderr @@ -4,5 +4,5 @@ error: non-item in item list LL | let _X: i32; | ^^^ help: consider using `const` instead of `let` for associated const: `const` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest-const-for-global-var.stderr b/tests/ui/parser/suggest-const-for-global-var.stderr index 94e44ec7f..235e621d8 100644 --- a/tests/ui/parser/suggest-const-for-global-var.stderr +++ b/tests/ui/parser/suggest-const-for-global-var.stderr @@ -4,5 +4,5 @@ error: expected item, found keyword `let` LL | let X: i32 = 12; | ^^^ consider using `const` or `static` instead of `let` for global variables -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr b/tests/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr index 396e0c130..c716d5908 100644 --- a/tests/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr +++ b/tests/ui/parser/suggest-removing-semicolon-after-impl-trait-items.stderr @@ -11,5 +11,5 @@ LL | fn bar() {}; LL | } | - item list ends here -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest-semi-in-array.stderr b/tests/ui/parser/suggest-semi-in-array.stderr index d7cd6efae..25b067995 100644 --- a/tests/ui/parser/suggest-semi-in-array.stderr +++ b/tests/ui/parser/suggest-semi-in-array.stderr @@ -6,5 +6,5 @@ LL | let v = [1 LL | 2]; | ^ unexpected token -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest-semicolon-before-array.stderr b/tests/ui/parser/suggest-semicolon-before-array.stderr index 8a33321fb..f5573f5e4 100644 --- a/tests/ui/parser/suggest-semicolon-before-array.stderr +++ b/tests/ui/parser/suggest-semicolon-before-array.stderr @@ -9,5 +9,5 @@ help: consider adding `;` here LL | foo(); | + -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest_misplaced_generics/enum.stderr b/tests/ui/parser/suggest_misplaced_generics/enum.stderr index 5f5947627..7bef9d709 100644 --- a/tests/ui/parser/suggest_misplaced_generics/enum.stderr +++ b/tests/ui/parser/suggest_misplaced_generics/enum.stderr @@ -10,5 +10,5 @@ LL - enum<T> Foo { Variant(T) } LL + enum Foo<T> { Variant(T) } | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr b/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr index 89716e6f1..e887c0881 100644 --- a/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr +++ b/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr @@ -6,5 +6,5 @@ LL | fn<'a, B: 'a + std::ops::Add<Output = u32>> f<T>(_x: B) { } | = help: place the generic parameter name after the fn name -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr index 061d0910a..18e173a9d 100644 --- a/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr +++ b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr @@ -10,5 +10,5 @@ LL - fn<'a, B: 'a + std::ops::Add<Output = u32>> f(_x: B) { } LL + fn f<'a, B: 'a + std::ops::Add<Output = u32>>(_x: B) { } | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr index 47e120169..cde690835 100644 --- a/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr +++ b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr @@ -4,5 +4,5 @@ error: expected identifier, found `<` LL | fn<~>()> id(x: T) -> T { x } | ^ expected identifier -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr index e749f1a0d..e77df69ee 100644 --- a/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr +++ b/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr @@ -10,5 +10,5 @@ LL - fn<T> id(x: T) -> T { x } LL + fn id<T>(x: T) -> T { x } | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest_misplaced_generics/struct.stderr b/tests/ui/parser/suggest_misplaced_generics/struct.stderr index 2b6509070..09e176adb 100644 --- a/tests/ui/parser/suggest_misplaced_generics/struct.stderr +++ b/tests/ui/parser/suggest_misplaced_generics/struct.stderr @@ -10,5 +10,5 @@ LL - struct<T> Foo { x: T } LL + struct Foo<T> { x: T } | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest_misplaced_generics/trait.stderr b/tests/ui/parser/suggest_misplaced_generics/trait.stderr index ac86cfa46..0d0b780d4 100644 --- a/tests/ui/parser/suggest_misplaced_generics/trait.stderr +++ b/tests/ui/parser/suggest_misplaced_generics/trait.stderr @@ -10,5 +10,5 @@ LL - trait<T> Foo { LL + trait Foo<T> { | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest_misplaced_generics/type.stderr b/tests/ui/parser/suggest_misplaced_generics/type.stderr index 22744f6cf..3034535d5 100644 --- a/tests/ui/parser/suggest_misplaced_generics/type.stderr +++ b/tests/ui/parser/suggest_misplaced_generics/type.stderr @@ -10,5 +10,5 @@ LL - type<T> Foo = T; LL + type Foo<T> = T; | -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/ternary_operator.rs b/tests/ui/parser/ternary_operator.rs new file mode 100644 index 000000000..c8810781b --- /dev/null +++ b/tests/ui/parser/ternary_operator.rs @@ -0,0 +1,30 @@ +fn a() { + let x = 5 > 2 ? true : false; + //~^ ERROR Rust has no ternary operator + //~| HELP use an `if-else` expression instead +} + +fn b() { + let x = 5 > 2 ? { true } : { false }; + //~^ ERROR Rust has no ternary operator + //~| HELP use an `if-else` expression instead +} + +fn c() { + let x = 5 > 2 ? f32::MAX : f32::MIN; + //~^ ERROR Rust has no ternary operator + //~| HELP use an `if-else` expression instead +} + +fn bad() { + // regression test for #117208 + v ? return; + //~^ ERROR expected one of +} + +fn main() { + let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false }; + //~^ ERROR Rust has no ternary operator + //~| HELP use an `if-else` expression instead + //~| ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `:` +} diff --git a/tests/ui/parser/ternary_operator.stderr b/tests/ui/parser/ternary_operator.stderr new file mode 100644 index 000000000..6635e1672 --- /dev/null +++ b/tests/ui/parser/ternary_operator.stderr @@ -0,0 +1,48 @@ +error: Rust has no ternary operator + --> $DIR/ternary_operator.rs:2:19 + | +LL | let x = 5 > 2 ? true : false; + | ^^^^^^^^^^^^^^^ + | + = help: use an `if-else` expression instead + +error: Rust has no ternary operator + --> $DIR/ternary_operator.rs:8:19 + | +LL | let x = 5 > 2 ? { true } : { false }; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: use an `if-else` expression instead + +error: Rust has no ternary operator + --> $DIR/ternary_operator.rs:14:19 + | +LL | let x = 5 > 2 ? f32::MAX : f32::MIN; + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = help: use an `if-else` expression instead + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found keyword `return` + --> $DIR/ternary_operator.rs:21:9 + | +LL | v ? return; + | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/ternary_operator.rs:26:37 + | +LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false }; + | ^ 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: Rust has no ternary operator + --> $DIR/ternary_operator.rs:26:19 + | +LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: use an `if-else` expression instead + +error: aborting due to 6 previous errors + diff --git a/tests/ui/parser/trailing-carriage-return-in-string.stderr b/tests/ui/parser/trailing-carriage-return-in-string.stderr index 8a44e0270..fa2677921 100644 --- a/tests/ui/parser/trailing-carriage-return-in-string.stderr +++ b/tests/ui/parser/trailing-carriage-return-in-string.stderr @@ -6,5 +6,5 @@ LL | let bad = "This is \
a test"; | = help: this is an isolated carriage return; consider checking your editor and version control settings -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/trailing-question-in-macro-type.stderr b/tests/ui/parser/trailing-question-in-macro-type.stderr index c096ae04f..e3d33bf25 100644 --- a/tests/ui/parser/trailing-question-in-macro-type.stderr +++ b/tests/ui/parser/trailing-question-in-macro-type.stderr @@ -4,6 +4,6 @@ error[E0425]: cannot find value `o` in this scope LL | fn_expr!{ o?.when(|&i| i > 0)?.when(|&i| i%2 == 0) }; | ^ not found in this scope -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/parser/trait-bounds-not-on-impl.stderr b/tests/ui/parser/trait-bounds-not-on-impl.stderr index 8d2d5e3d7..7f51bd97e 100644 --- a/tests/ui/parser/trait-bounds-not-on-impl.stderr +++ b/tests/ui/parser/trait-bounds-not-on-impl.stderr @@ -4,5 +4,5 @@ error: expected a trait, found type LL | impl Foo + Owned for Bar {} | ^^^^^^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/trait-object-delimiters.rs b/tests/ui/parser/trait-object-delimiters.rs index c41cda187..e9b13defe 100644 --- a/tests/ui/parser/trait-object-delimiters.rs +++ b/tests/ui/parser/trait-object-delimiters.rs @@ -3,9 +3,9 @@ fn foo1(_: &dyn Drop + AsRef<str>) {} //~ ERROR ambiguous `+` in a type //~^ ERROR only auto traits can be used as additional traits in a trait object -fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds +fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect parentheses around trait bounds -fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds +fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} //~ ERROR incorrect parentheses around trait bounds fn foo3(_: &dyn {Drop + AsRef<str>}) {} //~ ERROR expected parameter name, found `{` //~^ ERROR expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{` diff --git a/tests/ui/parser/trait-object-delimiters.stderr b/tests/ui/parser/trait-object-delimiters.stderr index ccce3a805..519546750 100644 --- a/tests/ui/parser/trait-object-delimiters.stderr +++ b/tests/ui/parser/trait-object-delimiters.stderr @@ -4,28 +4,28 @@ error: ambiguous `+` in a type LL | fn foo1(_: &dyn Drop + AsRef<str>) {} | ^^^^^^^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(dyn Drop + AsRef<str>)` -error: incorrect braces around trait bounds +error: incorrect parentheses around trait bounds --> $DIR/trait-object-delimiters.rs:6:17 | LL | fn foo2(_: &dyn (Drop + AsRef<str>)) {} | ^ ^ | -help: remove the parentheses +help: fix the parentheses | LL - fn foo2(_: &dyn (Drop + AsRef<str>)) {} -LL + fn foo2(_: &dyn Drop + AsRef<str>) {} +LL + fn foo2(_: &(dyn Drop + AsRef<str>)) {} | -error: incorrect braces around trait bounds +error: incorrect parentheses around trait bounds --> $DIR/trait-object-delimiters.rs:8:25 | LL | fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} | ^ ^ | -help: remove the parentheses +help: fix the parentheses | LL - fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} -LL + fn foo2_no_space(_: &dyn Drop + AsRef<str>) {} +LL + fn foo2_no_space(_: &(dyn Drop + AsRef<str>)) {} | error: expected parameter name, found `{` diff --git a/tests/ui/parser/trait-object-polytrait-priority.stderr b/tests/ui/parser/trait-object-polytrait-priority.stderr index a6add6079..23ec1e9cf 100644 --- a/tests/ui/parser/trait-object-polytrait-priority.stderr +++ b/tests/ui/parser/trait-object-polytrait-priority.stderr @@ -4,6 +4,6 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&for<'a> Trait< LL | let _: &for<'a> Trait<'a> + 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&(for<'a> Trait<'a> + 'static)` -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0178`. diff --git a/tests/ui/parser/trait-pub-assoc-const.stderr b/tests/ui/parser/trait-pub-assoc-const.stderr index c14a2f2ee..436f6a390 100644 --- a/tests/ui/parser/trait-pub-assoc-const.stderr +++ b/tests/ui/parser/trait-pub-assoc-const.stderr @@ -6,6 +6,6 @@ LL | pub const Foo: u32; | = note: trait items always share the visibility of their trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0449`. diff --git a/tests/ui/parser/trait-pub-assoc-ty.stderr b/tests/ui/parser/trait-pub-assoc-ty.stderr index 7f6e7350c..279e3a953 100644 --- a/tests/ui/parser/trait-pub-assoc-ty.stderr +++ b/tests/ui/parser/trait-pub-assoc-ty.stderr @@ -6,6 +6,6 @@ LL | pub type Foo; | = note: trait items always share the visibility of their trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0449`. diff --git a/tests/ui/parser/trait-pub-method.stderr b/tests/ui/parser/trait-pub-method.stderr index 2bf1d468a..ee8b6f7cb 100644 --- a/tests/ui/parser/trait-pub-method.stderr +++ b/tests/ui/parser/trait-pub-method.stderr @@ -6,6 +6,6 @@ LL | pub fn foo(); | = note: trait items always share the visibility of their trait -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0449`. diff --git a/tests/ui/parser/try-with-nonterminal-block.rs b/tests/ui/parser/try-with-nonterminal-block.rs new file mode 100644 index 000000000..2a9652f2e --- /dev/null +++ b/tests/ui/parser/try-with-nonterminal-block.rs @@ -0,0 +1,19 @@ +// check-pass +// edition:2021 + +#![feature(try_blocks)] + +macro_rules! create_try { + ($body:block) => { + try $body + }; +} + +fn main() { + let x: Option<&str> = create_try! {{ + None?; + "Hello world" + }}; + + println!("{x:?}"); +} diff --git a/tests/ui/parser/type-alias-where-fixable.fixed b/tests/ui/parser/type-alias-where-fixable.fixed deleted file mode 100644 index 2f47c0d91..000000000 --- a/tests/ui/parser/type-alias-where-fixable.fixed +++ /dev/null @@ -1,28 +0,0 @@ -// check-pass -// run-rustfix - -trait Trait { - // Fine. - type Assoc where u32: Copy; - // Fine. - type Assoc2 where u32: Copy, i32: Copy; -} - -impl Trait for u32 { - // Not fine, suggests moving. - type Assoc = () where u32: Copy; - //~^ WARNING where clause not allowed here - // Not fine, suggests moving `u32: Copy` - type Assoc2 = () where i32: Copy, u32: Copy; - //~^ WARNING where clause not allowed here -} - -impl Trait for i32 { - // Fine. - type Assoc = () where u32: Copy; - // Not fine, suggests moving both. - type Assoc2 = () where u32: Copy, i32: Copy; - //~^ WARNING where clause not allowed here -} - -fn main() {} diff --git a/tests/ui/parser/type-alias-where-fixable.rs b/tests/ui/parser/type-alias-where-fixable.rs deleted file mode 100644 index b20aa9398..000000000 --- a/tests/ui/parser/type-alias-where-fixable.rs +++ /dev/null @@ -1,28 +0,0 @@ -// check-pass -// run-rustfix - -trait Trait { - // Fine. - type Assoc where u32: Copy; - // Fine. - type Assoc2 where u32: Copy, i32: Copy; -} - -impl Trait for u32 { - // Not fine, suggests moving. - type Assoc where u32: Copy = (); - //~^ WARNING where clause not allowed here - // Not fine, suggests moving `u32: Copy` - type Assoc2 where u32: Copy = () where i32: Copy; - //~^ WARNING where clause not allowed here -} - -impl Trait for i32 { - // Fine. - type Assoc = () where u32: Copy; - // Not fine, suggests moving both. - type Assoc2 where u32: Copy, i32: Copy = (); - //~^ WARNING where clause not allowed here -} - -fn main() {} diff --git a/tests/ui/parser/type-alias-where-fixable.stderr b/tests/ui/parser/type-alias-where-fixable.stderr deleted file mode 100644 index f0acb388b..000000000 --- a/tests/ui/parser/type-alias-where-fixable.stderr +++ /dev/null @@ -1,42 +0,0 @@ -warning: where clause not allowed here - --> $DIR/type-alias-where-fixable.rs:13:16 - | -LL | type Assoc where u32: Copy = (); - | ^^^^^^^^^^^^^^^ - | - = 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 = (); -LL + type Assoc = () where u32: Copy; - | - -warning: where clause not allowed here - --> $DIR/type-alias-where-fixable.rs:16:17 - | -LL | type Assoc2 where u32: Copy = () where i32: Copy; - | ^^^^^^^^^^^^^^^ - | - = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information -help: move it to the end of the type declaration - | -LL - type Assoc2 where u32: Copy = () where i32: Copy; -LL + type Assoc2 = () where i32: Copy, u32: Copy; - | - -warning: where clause not allowed here - --> $DIR/type-alias-where-fixable.rs:24:17 - | -LL | type Assoc2 where u32: Copy, i32: Copy = (); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information -help: move it to the end of the type declaration - | -LL - type Assoc2 where u32: Copy, i32: Copy = (); -LL + type Assoc2 = () where u32: Copy, i32: Copy; - | - -warning: 3 warnings emitted - diff --git a/tests/ui/parser/type-alias-where.rs b/tests/ui/parser/type-alias-where.rs deleted file mode 100644 index 62e301cb4..000000000 --- a/tests/ui/parser/type-alias-where.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-fail - -// Fine, but lints as unused -type Foo where u32: Copy = (); -// Not fine. -type Bar = () where u32: Copy; -//~^ ERROR where clauses are not allowed -type Baz = () where; -//~^ ERROR where clauses are not allowed - -fn main() {} diff --git a/tests/ui/parser/type-alias-where.stderr b/tests/ui/parser/type-alias-where.stderr deleted file mode 100644 index fb8381792..000000000 --- a/tests/ui/parser/type-alias-where.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: where clauses are not allowed after the type for type aliases - --> $DIR/type-alias-where.rs:6:15 - | -LL | type Bar = () where u32: Copy; - | ^^^^^^^^^^^^^^^ - | - = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information - -error: where clauses are not allowed after the type for type aliases - --> $DIR/type-alias-where.rs:8:15 - | -LL | type Baz = () where; - | ^^^^^ - | - = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information - -error: aborting due to 2 previous errors - diff --git a/tests/ui/parser/typod-const-in-const-param-def.rs b/tests/ui/parser/typod-const-in-const-param-def.rs new file mode 100644 index 000000000..85d3ebba5 --- /dev/null +++ b/tests/ui/parser/typod-const-in-const-param-def.rs @@ -0,0 +1,16 @@ +pub fn foo<Const N: u8>() {} +//~^ ERROR `const` keyword was mistyped as `Const` + +pub fn bar<Const>() {} +// OK + +pub fn baz<Const N: u8, T>() {} +//~^ ERROR `const` keyword was mistyped as `Const` + +pub fn qux<T, Const N: u8>() {} +//~^ ERROR `const` keyword was mistyped as `Const` + +pub fn quux<T, Const N: u8, U>() {} +//~^ ERROR `const` keyword was mistyped as `Const` + +fn main() {} diff --git a/tests/ui/parser/typod-const-in-const-param-def.stderr b/tests/ui/parser/typod-const-in-const-param-def.stderr new file mode 100644 index 000000000..75d73c6ea --- /dev/null +++ b/tests/ui/parser/typod-const-in-const-param-def.stderr @@ -0,0 +1,46 @@ +error: `const` keyword was mistyped as `Const` + --> $DIR/typod-const-in-const-param-def.rs:1:12 + | +LL | pub fn foo<Const N: u8>() {} + | ^^^^^ + | +help: use the `const` keyword + | +LL | pub fn foo<const N: u8>() {} + | ~~~~~ + +error: `const` keyword was mistyped as `Const` + --> $DIR/typod-const-in-const-param-def.rs:7:12 + | +LL | pub fn baz<Const N: u8, T>() {} + | ^^^^^ + | +help: use the `const` keyword + | +LL | pub fn baz<const N: u8, T>() {} + | ~~~~~ + +error: `const` keyword was mistyped as `Const` + --> $DIR/typod-const-in-const-param-def.rs:10:15 + | +LL | pub fn qux<T, Const N: u8>() {} + | ^^^^^ + | +help: use the `const` keyword + | +LL | pub fn qux<T, const N: u8>() {} + | ~~~~~ + +error: `const` keyword was mistyped as `Const` + --> $DIR/typod-const-in-const-param-def.rs:13:16 + | +LL | pub fn quux<T, Const N: u8, U>() {} + | ^^^^^ + | +help: use the `const` keyword + | +LL | pub fn quux<T, const N: u8, U>() {} + | ~~~~~ + +error: aborting due to 4 previous errors + diff --git a/tests/ui/parser/unbalanced-doublequote.stderr b/tests/ui/parser/unbalanced-doublequote.stderr index 94b300a7b..d40b982da 100644 --- a/tests/ui/parser/unbalanced-doublequote.stderr +++ b/tests/ui/parser/unbalanced-doublequote.stderr @@ -5,6 +5,6 @@ LL | / " LL | | } | |__^ -error: aborting due to previous error +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0765`. diff --git a/tests/ui/parser/unclosed-braces.stderr b/tests/ui/parser/unclosed-braces.stderr index cbc5f8de4..acd92ac79 100644 --- a/tests/ui/parser/unclosed-braces.stderr +++ b/tests/ui/parser/unclosed-braces.stderr @@ -13,5 +13,5 @@ LL | } LL | | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.stderr b/tests/ui/parser/unclosed-delimiter-in-dep.stderr index a46d020b9..1231decd9 100644 --- a/tests/ui/parser/unclosed-delimiter-in-dep.stderr +++ b/tests/ui/parser/unclosed-delimiter-in-dep.stderr @@ -9,5 +9,5 @@ LL | } LL | } | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/unclosed_delim_mod.stderr b/tests/ui/parser/unclosed_delim_mod.stderr index a46d020b9..1231decd9 100644 --- a/tests/ui/parser/unclosed_delim_mod.stderr +++ b/tests/ui/parser/unclosed_delim_mod.stderr @@ -9,5 +9,5 @@ LL | } LL | } | ^ mismatched closing delimiter -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr b/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr index 430a13e6e..c6960892b 100644 --- a/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr +++ b/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr @@ -4,5 +4,5 @@ error: this file contains an unclosed delimiter LL | fn foo() { | - unclosed delimiter ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/unmatched-langle-2.stderr b/tests/ui/parser/unmatched-langle-2.stderr index 773bb33d8..9881c6ba5 100644 --- a/tests/ui/parser/unmatched-langle-2.stderr +++ b/tests/ui/parser/unmatched-langle-2.stderr @@ -4,5 +4,5 @@ error: expected `::`, found `(` LL | foo::<Ty<<<i32>(); | ^ expected `::` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/unsafe-foreign-mod.stderr b/tests/ui/parser/unsafe-foreign-mod.stderr index 4acf72c5d..77f6e93be 100644 --- a/tests/ui/parser/unsafe-foreign-mod.stderr +++ b/tests/ui/parser/unsafe-foreign-mod.stderr @@ -4,5 +4,5 @@ error: extern block cannot be declared unsafe LL | unsafe extern "C" { | ^^^^^^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/unsafe-mod.stderr b/tests/ui/parser/unsafe-mod.stderr index dac6e7a35..fbe24aa10 100644 --- a/tests/ui/parser/unsafe-mod.stderr +++ b/tests/ui/parser/unsafe-mod.stderr @@ -5,6 +5,7 @@ LL | unsafe mod n; | ^^^^^^^^^^^^^ | = help: to create the module `n`, create file "$DIR/n.rs" or "$DIR/n/mod.rs" + = note: if there is a `mod n` elsewhere in the crate already, import it with `use crate::...` instead error: module cannot be declared unsafe --> $DIR/unsafe-mod.rs:1:1 diff --git a/tests/ui/parser/unsized.stderr b/tests/ui/parser/unsized.stderr index 3d4ed526b..1bb4aa97d 100644 --- a/tests/ui/parser/unsized.stderr +++ b/tests/ui/parser/unsized.stderr @@ -4,5 +4,5 @@ error: expected `where`, `{`, `(`, or `;` after struct name, found keyword `for` LL | struct S1 for type; | ^^^ expected `where`, `{`, `(`, or `;` after struct name -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/unsized2.stderr b/tests/ui/parser/unsized2.stderr index 17e39b292..10f4c8332 100644 --- a/tests/ui/parser/unsized2.stderr +++ b/tests/ui/parser/unsized2.stderr @@ -4,5 +4,5 @@ error: expected expression, found keyword `type` LL | f<type>(); | ^^^^ expected expression -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/use-ends-with-mod-sep.stderr b/tests/ui/parser/use-ends-with-mod-sep.stderr index bd0d881a0..2f8e09c07 100644 --- a/tests/ui/parser/use-ends-with-mod-sep.stderr +++ b/tests/ui/parser/use-ends-with-mod-sep.stderr @@ -4,5 +4,5 @@ error: expected identifier, found `;` LL | use std::any::; | ^ expected identifier -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/use-unclosed-brace.stderr b/tests/ui/parser/use-unclosed-brace.stderr index ad5bb2de1..6e624cb91 100644 --- a/tests/ui/parser/use-unclosed-brace.stderr +++ b/tests/ui/parser/use-unclosed-brace.stderr @@ -7,5 +7,5 @@ LL | use foo::{bar, baz; LL | fn main() {} | ^ -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/utf16-be-without-bom.stderr b/tests/ui/parser/utf16-be-without-bom.stderr Binary files differindex 768d2c531..c041f3ecf 100644 --- a/tests/ui/parser/utf16-be-without-bom.stderr +++ b/tests/ui/parser/utf16-be-without-bom.stderr diff --git a/tests/ui/parser/utf16-le-without-bom.stderr b/tests/ui/parser/utf16-le-without-bom.stderr Binary files differindex 4f4b91e39..cc2220441 100644 --- a/tests/ui/parser/utf16-le-without-bom.stderr +++ b/tests/ui/parser/utf16-le-without-bom.stderr diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs index 9eeee195e..f1238ec24 100644 --- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs +++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.rs @@ -5,5 +5,9 @@ fn f2<'a>(x: u8, y: Vec<&'a ...>) {} //~^ ERROR C-variadic type `...` may not be nested inside another type fn main() { - let _recovery_witness: () = 0; //~ ERROR mismatched types + // While this is an error, wf-checks happen before typeck, and if any wf-checks + // encountered errors, we do not continue to typeck, even if the items are + // unrelated. + // FIXME(oli-obk): make this report a type mismatch again. + let _recovery_witness: () = 0; } diff --git a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr index 8b9d676a4..7ca6a6d1b 100644 --- a/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr +++ b/tests/ui/parser/variadic-ffi-nested-syntactic-fail.stderr @@ -10,15 +10,6 @@ error[E0743]: C-variadic type `...` may not be nested inside another type LL | fn f2<'a>(x: u8, y: Vec<&'a ...>) {} | ^^^ -error[E0308]: mismatched types - --> $DIR/variadic-ffi-nested-syntactic-fail.rs:8:33 - | -LL | let _recovery_witness: () = 0; - | -- ^ expected `()`, found integer - | | - | expected due to this - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0308, E0743. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0743`. diff --git a/tests/ui/parser/variadic-ffi-semantic-restrictions.rs b/tests/ui/parser/variadic-ffi-semantic-restrictions.rs index 0b61e267d..b173e23e7 100644 --- a/tests/ui/parser/variadic-ffi-semantic-restrictions.rs +++ b/tests/ui/parser/variadic-ffi-semantic-restrictions.rs @@ -32,6 +32,18 @@ extern "C" fn f3_3(..., x: isize) {} //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function +const unsafe extern "C" fn f4_1(x: isize, ...) {} +//~^ ERROR functions cannot be both `const` and C-variadic + +const extern "C" fn f4_2(x: isize, ...) {} +//~^ ERROR functions cannot be both `const` and C-variadic +//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + +const extern "C" fn f4_3(..., x: isize, ...) {} +//~^ ERROR functions cannot be both `const` and C-variadic +//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic +//~| ERROR `...` must be the last argument of a C-variadic function + extern "C" { fn e_f1(...); //~^ ERROR C-variadic function must be declared with at least one named argument @@ -49,12 +61,13 @@ impl X { //~| ERROR C-variadic function must be declared with at least one named argument fn i_f3(..., x: isize, ...) {} //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic - //~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function fn i_f4(..., x: isize, ...) {} //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic - //~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR `...` must be the last argument of a C-variadic function + const fn i_f5(x: isize, ...) {} + //~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic + //~| ERROR functions cannot be both `const` and C-variadic } trait T { diff --git a/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr b/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr index f1cbbb279..18526080e 100644 --- a/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr +++ b/tests/ui/parser/variadic-ffi-semantic-restrictions.stderr @@ -76,131 +76,172 @@ error: only foreign or `unsafe extern "C"` functions may be C-variadic LL | extern "C" fn f3_3(..., x: isize) {} | ^^^ +error: functions cannot be both `const` and C-variadic + --> $DIR/variadic-ffi-semantic-restrictions.rs:35:1 + | +LL | const unsafe extern "C" fn f4_1(x: isize, ...) {} + | ^^^^^ `const` because of this ^^^ C-variadic because of this + +error: functions cannot be both `const` and C-variadic + --> $DIR/variadic-ffi-semantic-restrictions.rs:38:1 + | +LL | const extern "C" fn f4_2(x: isize, ...) {} + | ^^^^^ `const` because of this ^^^ C-variadic because of this + +error: only foreign or `unsafe extern "C"` functions may be C-variadic + --> $DIR/variadic-ffi-semantic-restrictions.rs:38:36 + | +LL | const extern "C" fn f4_2(x: isize, ...) {} + | ^^^ + +error: `...` must be the last argument of a C-variadic function + --> $DIR/variadic-ffi-semantic-restrictions.rs:42:26 + | +LL | const extern "C" fn f4_3(..., x: isize, ...) {} + | ^^^ + +error: functions cannot be both `const` and C-variadic + --> $DIR/variadic-ffi-semantic-restrictions.rs:42:1 + | +LL | const extern "C" fn f4_3(..., x: isize, ...) {} + | ^^^^^ ^^^ ^^^ C-variadic because of this + | | | + | | C-variadic because of this + | `const` because of this + +error: only foreign or `unsafe extern "C"` functions may be C-variadic + --> $DIR/variadic-ffi-semantic-restrictions.rs:42:26 + | +LL | const extern "C" fn f4_3(..., x: isize, ...) {} + | ^^^ ^^^ + error: C-variadic function must be declared with at least one named argument - --> $DIR/variadic-ffi-semantic-restrictions.rs:36:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:48:13 | LL | fn e_f1(...); | ^^^ error: `...` must be the last argument of a C-variadic function - --> $DIR/variadic-ffi-semantic-restrictions.rs:38:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13 | LL | fn e_f2(..., x: isize); | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:45:23 + --> $DIR/variadic-ffi-semantic-restrictions.rs:57:23 | LL | fn i_f1(x: isize, ...) {} | ^^^ error: C-variadic function must be declared with at least one named argument - --> $DIR/variadic-ffi-semantic-restrictions.rs:47:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:59:13 | LL | fn i_f2(...) {} | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:47:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:59:13 | LL | fn i_f2(...) {} | ^^^ error: `...` must be the last argument of a C-variadic function - --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13 - | -LL | fn i_f3(..., x: isize, ...) {} - | ^^^ - -error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:50:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:62:13 | LL | fn i_f3(..., x: isize, ...) {} | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:50:28 + --> $DIR/variadic-ffi-semantic-restrictions.rs:62:13 | LL | fn i_f3(..., x: isize, ...) {} - | ^^^ + | ^^^ ^^^ error: `...` must be the last argument of a C-variadic function - --> $DIR/variadic-ffi-semantic-restrictions.rs:54:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13 | LL | fn i_f4(..., x: isize, ...) {} | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:54:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13 | LL | fn i_f4(..., x: isize, ...) {} - | ^^^ + | ^^^ ^^^ + +error: functions cannot be both `const` and C-variadic + --> $DIR/variadic-ffi-semantic-restrictions.rs:68:5 + | +LL | const fn i_f5(x: isize, ...) {} + | ^^^^^ ^^^ C-variadic because of this + | | + | `const` because of this error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:54:28 + --> $DIR/variadic-ffi-semantic-restrictions.rs:68:29 | -LL | fn i_f4(..., x: isize, ...) {} - | ^^^ +LL | const fn i_f5(x: isize, ...) {} + | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:61:23 + --> $DIR/variadic-ffi-semantic-restrictions.rs:74:23 | LL | fn t_f1(x: isize, ...) {} | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:63:23 + --> $DIR/variadic-ffi-semantic-restrictions.rs:76:23 | LL | fn t_f2(x: isize, ...); | ^^^ error: C-variadic function must be declared with at least one named argument - --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:78:13 | LL | fn t_f3(...) {} | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:65:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:78:13 | LL | fn t_f3(...) {} | ^^^ error: C-variadic function must be declared with at least one named argument - --> $DIR/variadic-ffi-semantic-restrictions.rs:68:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:81:13 | LL | fn t_f4(...); | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:68:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:81:13 | LL | fn t_f4(...); | ^^^ error: `...` must be the last argument of a C-variadic function - --> $DIR/variadic-ffi-semantic-restrictions.rs:71:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:84:13 | LL | fn t_f5(..., x: isize) {} | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:71:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:84:13 | LL | fn t_f5(..., x: isize) {} | ^^^ error: `...` must be the last argument of a C-variadic function - --> $DIR/variadic-ffi-semantic-restrictions.rs:74:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:87:13 | LL | fn t_f6(..., x: isize); | ^^^ error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/variadic-ffi-semantic-restrictions.rs:74:13 + --> $DIR/variadic-ffi-semantic-restrictions.rs:87:13 | LL | fn t_f6(..., x: isize); | ^^^ -error: aborting due to 34 previous errors +error: aborting due to 40 previous errors diff --git a/tests/ui/parser/virtual-structs.stderr b/tests/ui/parser/virtual-structs.stderr index a5211d83f..7b45e77ba 100644 --- a/tests/ui/parser/virtual-structs.stderr +++ b/tests/ui/parser/virtual-structs.stderr @@ -3,6 +3,8 @@ error: expected item, found reserved keyword `virtual` | LL | virtual struct SuperStruct { | ^^^^^^^ expected item + | + = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/where-clauses-no-bounds-or-predicates.stderr b/tests/ui/parser/where-clauses-no-bounds-or-predicates.stderr index b80b0a409..4bd0cc885 100644 --- a/tests/ui/parser/where-clauses-no-bounds-or-predicates.stderr +++ b/tests/ui/parser/where-clauses-no-bounds-or-predicates.stderr @@ -4,5 +4,5 @@ error: expected `:`, found `{` LL | fn foo<'a>() where 'a {} | ^ expected `:` -error: aborting due to previous error +error: aborting due to 1 previous error diff --git a/tests/ui/parser/while-if-let-without-body.stderr b/tests/ui/parser/while-if-let-without-body.stderr index 2dac45c11..0bd68b7b9 100644 --- a/tests/ui/parser/while-if-let-without-body.stderr +++ b/tests/ui/parser/while-if-let-without-body.stderr @@ -14,5 +14,5 @@ LL | | } LL | } | ^ expected `{` -error: aborting due to previous error +error: aborting due to 1 previous error |