diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
commit | 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch) | |
tree | daf049b282ab10e8c3d03e409b3cd84ff3f7690c /tests/ui/parser | |
parent | Adding debian version 1.68.2+dfsg1-1. (diff) | |
download | rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/parser')
136 files changed, 1033 insertions, 989 deletions
diff --git a/tests/ui/parser/anon-enums-are-ambiguous.rs b/tests/ui/parser/anon-enums-are-ambiguous.rs new file mode 100644 index 000000000..b0173cf98 --- /dev/null +++ b/tests/ui/parser/anon-enums-are-ambiguous.rs @@ -0,0 +1,26 @@ +// check-pass + +macro_rules! test_expr { + ($expr:expr) => {}; +} + +macro_rules! test_ty { + ($a:ty | $b:ty) => {}; +} + +fn main() { + test_expr!(a as fn() -> B | C); + // Do not break the `|` operator. + + test_expr!(|_: fn() -> B| C | D); + // Do not break `-> Ret` in closure args. + + test_ty!(A | B); + // We can't support anon enums in arbitrary positions. + + test_ty!(fn() -> A | B); + // Don't break fn ptrs. + + test_ty!(impl Fn() -> A | B); + // Don't break parenthesized generics. +} diff --git a/tests/ui/parser/bastion-of-the-turbofish.rs b/tests/ui/parser/bastion-of-the-turbofish.rs index e12857008..7ceea676d 100644 --- a/tests/ui/parser/bastion-of-the-turbofish.rs +++ b/tests/ui/parser/bastion-of-the-turbofish.rs @@ -34,7 +34,7 @@ // See https://github.com/rust-lang/rust/pull/53562 // and https://github.com/rust-lang/rfcs/pull/2527 -// and https://twitter.com/garblefart/status/1393236602856611843 +// and https://web.archive.org/web/20211010063452/https://twitter.com/garblefart/status/1393236602856611843 // for context. fn main() { diff --git a/tests/ui/parser/deli-ident-issue-1.rs b/tests/ui/parser/deli-ident-issue-1.rs new file mode 100644 index 000000000..224ee6c09 --- /dev/null +++ b/tests/ui/parser/deli-ident-issue-1.rs @@ -0,0 +1,22 @@ +#![feature(let_chains)] +trait Demo {} + +impl dyn Demo { + pub fn report(&self) -> u32 { + let sum = |a: u32, + b: u32, + c: u32| { + a + b + c + }; + sum(1, 2, 3) + } + + fn check(&self, val: Option<u32>, num: Option<u32>) { + if let Some(b) = val + && let Some(c) = num { + && b == c { + } + } +} + +fn main() { } //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/deli-ident-issue-1.stderr b/tests/ui/parser/deli-ident-issue-1.stderr new file mode 100644 index 000000000..eb5073e14 --- /dev/null +++ b/tests/ui/parser/deli-ident-issue-1.stderr @@ -0,0 +1,17 @@ +error: this file contains an unclosed delimiter + --> $DIR/deli-ident-issue-1.rs:22:66 + | +LL | impl dyn Demo { + | - unclosed delimiter +... +LL | && let Some(c) = num { + | - this delimiter might not be properly closed... +... +LL | } + | - ...as it matches this but it has different indentation +... +LL | fn main() { } + | ^ + +error: aborting due to previous error + diff --git a/tests/ui/parser/deli-ident-issue-2.rs b/tests/ui/parser/deli-ident-issue-2.rs new file mode 100644 index 000000000..5394760df --- /dev/null +++ b/tests/ui/parser/deli-ident-issue-2.rs @@ -0,0 +1,7 @@ +fn main() { + if 1 < 2 { + let _a = vec!]; //~ ERROR mismatched closing delimiter + } +} //~ ERROR unexpected closing delimiter + +fn main() {} diff --git a/tests/ui/parser/deli-ident-issue-2.stderr b/tests/ui/parser/deli-ident-issue-2.stderr new file mode 100644 index 000000000..e0188cdfb --- /dev/null +++ b/tests/ui/parser/deli-ident-issue-2.stderr @@ -0,0 +1,19 @@ +error: mismatched closing delimiter: `]` + --> $DIR/deli-ident-issue-2.rs:2:14 + | +LL | if 1 < 2 { + | ^ unclosed delimiter +LL | let _a = vec!]; + | ^ mismatched closing delimiter + +error: unexpected closing delimiter: `}` + --> $DIR/deli-ident-issue-2.rs:5:1 + | +LL | let _a = vec!]; + | - missing open `[` for this delimiter +LL | } +LL | } + | ^ unexpected closing delimiter + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/do-not-suggest-semicolon-before-array.rs b/tests/ui/parser/do-not-suggest-semicolon-before-array.rs index 7ebf3f6b0..7eff7f431 100644 --- a/tests/ui/parser/do-not-suggest-semicolon-before-array.rs +++ b/tests/ui/parser/do-not-suggest-semicolon-before-array.rs @@ -2,7 +2,7 @@ fn foo() {} fn bar() -> [u8; 2] { foo() - [1, 3) //~ ERROR expected one of `.`, `?`, `]`, or an operator, found `,` + [1, 3) //~ ERROR mismatched closing delimiter } fn main() {} 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 a9dd52632..7b43c7700 100644 --- a/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr +++ b/tests/ui/parser/do-not-suggest-semicolon-before-array.stderr @@ -1,8 +1,8 @@ -error: expected one of `.`, `?`, `]`, or an operator, found `,` +error: mismatched closing delimiter: `)` --> $DIR/do-not-suggest-semicolon-before-array.rs:5:5 | LL | [1, 3) - | ^ ^ help: `]` may belong here + | ^ ^ mismatched closing delimiter | | | unclosed delimiter diff --git a/tests/ui/parser/fn-header-semantic-fail.stderr b/tests/ui/parser/fn-header-semantic-fail.stderr index 038fdfb2d..2d8bd19a7 100644 --- a/tests/ui/parser/fn-header-semantic-fail.stderr +++ b/tests/ui/parser/fn-header-semantic-fail.stderr @@ -209,8 +209,8 @@ note: ...which requires const checking `main::ff5`... | LL | const async unsafe extern "C" fn ff5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze... - = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`... + = note: ...which requires computing whether `main::ff5::{opaque#0}` is freeze... + = note: ...which requires evaluating trait selection obligation `main::ff5::{opaque#0}: core::marker::Freeze`... = note: ...which again requires computing type of `main::ff5::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/fn-header-semantic-fail.rs:5:1 @@ -245,8 +245,8 @@ note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-f | LL | const async unsafe extern "C" fn ft5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze... - = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`... + = note: ...which requires computing whether `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5::{opaque#0}` is freeze... + = note: ...which requires evaluating trait selection obligation `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5::{opaque#0}: core::marker::Freeze`... = note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:28:5: 28:17>::ft5::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/fn-header-semantic-fail.rs:5:1 @@ -281,8 +281,8 @@ note: ...which requires const checking `main::<impl at $DIR/fn-header-semantic-f | LL | const async unsafe extern "C" fn fi5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which requires computing whether `impl core::future::future::Future<Output = ()>` is freeze... - = note: ...which requires evaluating trait selection obligation `impl core::future::future::Future<Output = ()>: core::marker::Freeze`... + = note: ...which requires computing whether `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5::{opaque#0}` is freeze... + = note: ...which requires evaluating trait selection obligation `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5::{opaque#0}: core::marker::Freeze`... = note: ...which again requires computing type of `main::<impl at $DIR/fn-header-semantic-fail.rs:40:5: 40:11>::fi5::{opaque#0}`, completing the cycle note: cycle used when checking item types in top-level module --> $DIR/fn-header-semantic-fail.rs:5:1 diff --git a/tests/ui/parser/issue-102806.stderr b/tests/ui/parser/issue-102806.stderr index 6872b8bc0..ba8174a82 100644 --- a/tests/ui/parser/issue-102806.stderr +++ b/tests/ui/parser/issue-102806.stderr @@ -32,7 +32,12 @@ error: expected field pattern, found `...` --> $DIR/issue-102806.rs:21:22 | LL | let V3 { z: val, ... } = v; - | ^^^ help: to omit remaining fields, use one fewer `.`: `..` + | ^^^ + | +help: to omit remaining fields, use `..` + | +LL | let V3 { z: val, .. } = v; + | ~~ error[E0063]: missing fields `x` and `y` in initializer of `V3` --> $DIR/issue-102806.rs:17:13 diff --git a/tests/ui/parser/issue-103451.rs b/tests/ui/parser/issue-103451.rs index 1fdb00148..be33213f3 100644 --- a/tests/ui/parser/issue-103451.rs +++ b/tests/ui/parser/issue-103451.rs @@ -1,5 +1,4 @@ // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected value, found struct `R` struct R { } struct S { x: [u8; R diff --git a/tests/ui/parser/issue-103451.stderr b/tests/ui/parser/issue-103451.stderr index eb3c92fb4..6aacd5012 100644 --- a/tests/ui/parser/issue-103451.stderr +++ b/tests/ui/parser/issue-103451.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-103451.rs:5:15 + --> $DIR/issue-103451.rs:4:15 | LL | struct S { | - unclosed delimiter @@ -8,25 +8,5 @@ LL | x: [u8; R | | | unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/issue-103451.rs:5:15 - | -LL | struct S { - | - unclosed delimiter -LL | x: [u8; R - | - ^ - | | - | unclosed delimiter - -error[E0423]: expected value, found struct `R` - --> $DIR/issue-103451.rs:5:13 - | -LL | struct R { } - | ------------ `R` defined here -LL | struct S { -LL | x: [u8; R - | ^ help: use struct literal syntax instead: `R {}` - -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0423`. diff --git a/tests/ui/parser/issue-107705.rs b/tests/ui/parser/issue-107705.rs new file mode 100644 index 000000000..b80984fcd --- /dev/null +++ b/tests/ui/parser/issue-107705.rs @@ -0,0 +1,3 @@ +// compile-flags: -C debug-assertions + +fn f() {a(b:&, //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issue-107705.stderr b/tests/ui/parser/issue-107705.stderr new file mode 100644 index 000000000..d2d613461 --- /dev/null +++ b/tests/ui/parser/issue-107705.stderr @@ -0,0 +1,10 @@ +error: this file contains an unclosed delimiter + --> $DIR/issue-107705.rs:3:67 + | +LL | fn f() {a(b:&, + | - - unclosed delimiter ^ + | | + | unclosed delimiter + +error: aborting due to previous error + diff --git a/tests/ui/parser/issue-108495-dec.rs b/tests/ui/parser/issue-108495-dec.rs new file mode 100644 index 000000000..e0816f84e --- /dev/null +++ b/tests/ui/parser/issue-108495-dec.rs @@ -0,0 +1,39 @@ +fn test0() { + let mut i = 0; + let _ = i + i--; //~ ERROR Rust has no postfix decrement operator + // won't suggest since we can not handle the precedences +} + +fn test1() { + let mut i = 0; + let _ = i-- + i--; //~ ERROR Rust has no postfix decrement operator +} + +fn test2() { + let mut i = 0; + let _ = --i + i--; //~ ERROR Rust has no postfix decrement operator +} + +fn test3() { + let mut i = 0; + let _ = i-- + --i; //~ ERROR Rust has no postfix decrement operator +} + +fn test4() { + let mut i = 0; + let _ = (1 + 2 + i)--; //~ ERROR Rust has no postfix decrement operator +} + +fn test5() { + let mut i = 0; + let _ = (i-- + 1) + 2; //~ ERROR Rust has no postfix decrement operator +} + +fn test6(){ + let i=10; + while i != 0 { + i--; //~ ERROR Rust has no postfix decrement operator + } +} + +fn main() {} diff --git a/tests/ui/parser/issue-108495-dec.stderr b/tests/ui/parser/issue-108495-dec.stderr new file mode 100644 index 000000000..85b29038f --- /dev/null +++ b/tests/ui/parser/issue-108495-dec.stderr @@ -0,0 +1,69 @@ +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:3:18 + | +LL | let _ = i + i--; + | ^^ not a valid postfix operator + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:9:14 + | +LL | let _ = i-- + i--; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | let _ = { let tmp = i; i -= 1; tmp } + i--; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:14:20 + | +LL | let _ = --i + i--; + | ^^ not a valid postfix operator + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:19:14 + | +LL | let _ = i-- + --i; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | let _ = { let tmp = i; i -= 1; tmp } + --i; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:24:24 + | +LL | let _ = (1 + 2 + i)--; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) -= 1; tmp }; + | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:29:15 + | +LL | let _ = (i-- + 1) + 2; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | let _ = ({ let tmp = i; i -= 1; tmp } + 1) + 2; + | +++++++++++ ~~~~~~~~~~~~~~~ + +error: Rust has no postfix decrement operator + --> $DIR/issue-108495-dec.rs:35:10 + | +LL | i--; + | ^^ not a valid postfix operator + | +help: use `-= 1` instead + | +LL | i -= 1; + | ~~~~ + +error: aborting due to 7 previous errors + diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.rs b/tests/ui/parser/issue-68987-unmatch-issue-1.rs new file mode 100644 index 000000000..30e7ef467 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-1.rs @@ -0,0 +1,12 @@ +// This file has unexpected closing delimiter, + +fn func(o: Option<u32>) { + match o { + Some(_x) => {} // Extra '}' + let _ = if true {}; + } + None => {} + } +} //~ ERROR unexpected closing delimiter + +fn main() {} diff --git a/tests/ui/parser/issue-68987-unmatch-issue-1.stderr b/tests/ui/parser/issue-68987-unmatch-issue-1.stderr new file mode 100644 index 000000000..2d873b461 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-1.stderr @@ -0,0 +1,16 @@ +error: unexpected closing delimiter: `}` + --> $DIR/issue-68987-unmatch-issue-1.rs:10:1 + | +LL | match o { + | - this delimiter might not be properly closed... +LL | Some(_x) => {} // Extra '}' + | -- block is empty, you might have not meant to close it +LL | let _ = if true {}; +LL | } + | - ...as it matches this but it has different indentation +... +LL | } + | ^ unexpected closing delimiter + +error: aborting due to previous error + diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.rs b/tests/ui/parser/issue-68987-unmatch-issue-2.rs new file mode 100644 index 000000000..89aaa68ba --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-2.rs @@ -0,0 +1,14 @@ +// FIXME: this case need more work to fix +// currently the TokenTree matching ')' with '{', which is not user friendly for diagnostics +async fn obstest() -> Result<> { + let obs_connect = || -> Result<(), MyError) { //~ ERROR mismatched closing delimiter + async { + } + } + + if let Ok(version, scene_list) = obs_connect() { + + } else { + + } +} //~ ERROR unexpected closing delimiter diff --git a/tests/ui/parser/issue-68987-unmatch-issue-2.stderr b/tests/ui/parser/issue-68987-unmatch-issue-2.stderr new file mode 100644 index 000000000..0ecb748a0 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-2.stderr @@ -0,0 +1,19 @@ +error: mismatched closing delimiter: `)` + --> $DIR/issue-68987-unmatch-issue-2.rs:3:32 + | +LL | async fn obstest() -> Result<> { + | ^ unclosed delimiter +LL | let obs_connect = || -> Result<(), MyError) { + | ^ mismatched closing delimiter + +error: unexpected closing delimiter: `}` + --> $DIR/issue-68987-unmatch-issue-2.rs:14:1 + | +LL | let obs_connect = || -> Result<(), MyError) { + | - missing open `(` for this delimiter +... +LL | } + | ^ unexpected closing delimiter + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.rs b/tests/ui/parser/issue-68987-unmatch-issue-3.rs new file mode 100644 index 000000000..e98df8d7c --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-3.rs @@ -0,0 +1,8 @@ +// the `{` is closed with `)`, there is a missing `(` +fn f(i: u32, j: u32) { + let res = String::new(); + let mut cnt = i; + while cnt < j { + write!&mut res, " "); //~ ERROR mismatched closing delimiter + } +} //~ ERROR unexpected closing delimiter diff --git a/tests/ui/parser/issue-68987-unmatch-issue-3.stderr b/tests/ui/parser/issue-68987-unmatch-issue-3.stderr new file mode 100644 index 000000000..dfc4407ed --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue-3.stderr @@ -0,0 +1,19 @@ +error: mismatched closing delimiter: `)` + --> $DIR/issue-68987-unmatch-issue-3.rs:5:19 + | +LL | while cnt < j { + | ^ unclosed delimiter +LL | write!&mut res, " "); + | ^ mismatched closing delimiter + +error: unexpected closing delimiter: `}` + --> $DIR/issue-68987-unmatch-issue-3.rs:8:1 + | +LL | write!&mut res, " "); + | - missing open `(` for this delimiter +LL | } +LL | } + | ^ unexpected closing delimiter + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issue-68987-unmatch-issue.rs b/tests/ui/parser/issue-68987-unmatch-issue.rs new file mode 100644 index 000000000..5a3620bf2 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue.rs @@ -0,0 +1,12 @@ +// This file has unexpected closing delimiter, + +fn func(o: Option<u32>) { + match o { + Some(_x) => // Missing '{' + let _ = if true {}; + } + None => {} + } +} //~ ERROR unexpected closing delimiter + +fn main() {} diff --git a/tests/ui/parser/issue-68987-unmatch-issue.stderr b/tests/ui/parser/issue-68987-unmatch-issue.stderr new file mode 100644 index 000000000..cabd13324 --- /dev/null +++ b/tests/ui/parser/issue-68987-unmatch-issue.stderr @@ -0,0 +1,16 @@ +error: unexpected closing delimiter: `}` + --> $DIR/issue-68987-unmatch-issue.rs:10:1 + | +LL | match o { + | - this delimiter might not be properly closed... +LL | Some(_x) => // Missing '{' +LL | let _ = if true {}; + | -- 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 previous error + diff --git a/tests/ui/parser/issue-81804.rs b/tests/ui/parser/issue-81804.rs index 803bde11e..ebc4752a1 100644 --- a/tests/ui/parser/issue-81804.rs +++ b/tests/ui/parser/issue-81804.rs @@ -1,8 +1,5 @@ // error-pattern: this file contains an unclosed delimiter // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected pattern, found `=` -// error-pattern: expected one of `)`, `,`, `->`, `where`, or `{`, found `]` -// error-pattern: expected item, found `]` fn main() {} diff --git a/tests/ui/parser/issue-81804.stderr b/tests/ui/parser/issue-81804.stderr index 19c4422c6..de3b33ecd 100644 --- a/tests/ui/parser/issue-81804.stderr +++ b/tests/ui/parser/issue-81804.stderr @@ -1,14 +1,13 @@ -error: this file contains an unclosed delimiter - --> $DIR/issue-81804.rs:9:11 +error: mismatched closing delimiter: `}` + --> $DIR/issue-81804.rs:6:8 | LL | fn p([=(} - | -- ^ - | || - | |unclosed delimiter - | unclosed delimiter + | ^^ mismatched closing delimiter + | | + | unclosed delimiter error: this file contains an unclosed delimiter - --> $DIR/issue-81804.rs:9:11 + --> $DIR/issue-81804.rs:6:11 | LL | fn p([=(} | -- ^ @@ -16,26 +15,5 @@ LL | fn p([=(} | |unclosed delimiter | unclosed delimiter -error: expected pattern, found `=` - --> $DIR/issue-81804.rs:9:7 - | -LL | fn p([=(} - | ^ expected pattern - -error: expected one of `)`, `,`, `->`, `where`, or `{`, found `]` - --> $DIR/issue-81804.rs:9:8 - | -LL | fn p([=(} - | ^ -^ - | | | - | | help: `)` may belong here - | unclosed delimiter - -error: expected item, found `]` - --> $DIR/issue-81804.rs:9:11 - | -LL | fn p([=(} - | ^ expected item - -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issue-81827.rs b/tests/ui/parser/issue-81827.rs index 7ec581594..91defd12a 100644 --- a/tests/ui/parser/issue-81827.rs +++ b/tests/ui/parser/issue-81827.rs @@ -1,6 +1,5 @@ // error-pattern: this file contains an unclosed delimiter // error-pattern: mismatched closing delimiter: `]` -// error-pattern: expected one of `)` or `,`, found `{` #![crate_name="0"] diff --git a/tests/ui/parser/issue-81827.stderr b/tests/ui/parser/issue-81827.stderr index 069de3391..63d135f73 100644 --- a/tests/ui/parser/issue-81827.stderr +++ b/tests/ui/parser/issue-81827.stderr @@ -1,23 +1,5 @@ -error: this file contains an unclosed delimiter - --> $DIR/issue-81827.rs:11:27 - | -LL | fn r()->i{0|{#[cfg(r(0{]0 - | - - ^ - | | | - | | unclosed delimiter - | unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-81827.rs:11:27 - | -LL | fn r()->i{0|{#[cfg(r(0{]0 - | - - ^ - | | | - | | unclosed delimiter - | unclosed delimiter - error: mismatched closing delimiter: `]` - --> $DIR/issue-81827.rs:11:23 + --> $DIR/issue-81827.rs:10:23 | LL | fn r()->i{0|{#[cfg(r(0{]0 | - ^^ mismatched closing delimiter @@ -25,11 +7,15 @@ LL | fn r()->i{0|{#[cfg(r(0{]0 | | unclosed delimiter | closing delimiter possibly meant for this -error: expected one of `)` or `,`, found `{` - --> $DIR/issue-81827.rs:11:23 +error: this file contains an unclosed delimiter + --> $DIR/issue-81827.rs:10:27 | LL | fn r()->i{0|{#[cfg(r(0{]0 - | ^ expected one of `)` or `,` + | - - - ^ + | | | | + | | | missing open `[` for this delimiter + | | unclosed delimiter + | unclosed delimiter -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-104367.rs b/tests/ui/parser/issues/issue-104367.rs new file mode 100644 index 000000000..861761b64 --- /dev/null +++ b/tests/ui/parser/issues/issue-104367.rs @@ -0,0 +1,6 @@ +#[derive(A)] +struct S { + d: [u32; { + #![cfg] { + #![w,) //~ ERROR mismatched closing delimiter + //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-104367.stderr b/tests/ui/parser/issues/issue-104367.stderr new file mode 100644 index 000000000..e6e765357 --- /dev/null +++ b/tests/ui/parser/issues/issue-104367.stderr @@ -0,0 +1,26 @@ +error: mismatched closing delimiter: `)` + --> $DIR/issue-104367.rs:5:15 + | +LL | #![w,) + | ^ ^ mismatched closing delimiter + | | + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-104367.rs:6:71 + | +LL | struct S { + | - unclosed delimiter +LL | d: [u32; { + | - - unclosed delimiter + | | + | unclosed delimiter +LL | #![cfg] { + | - unclosed delimiter +LL | #![w,) + | - missing open `(` for this delimiter +LL | + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issues/issue-105209.rs b/tests/ui/parser/issues/issue-105209.rs new file mode 100644 index 000000000..6146b795d --- /dev/null +++ b/tests/ui/parser/issues/issue-105209.rs @@ -0,0 +1,3 @@ +// compile-flags: -Zunpretty=ast-tree +#![c={#![c[)x //~ ERROR mismatched closing delimiter + //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-105209.stderr b/tests/ui/parser/issues/issue-105209.stderr new file mode 100644 index 000000000..c75eafa18 --- /dev/null +++ b/tests/ui/parser/issues/issue-105209.stderr @@ -0,0 +1,22 @@ +error: mismatched closing delimiter: `)` + --> $DIR/issue-105209.rs:2:11 + | +LL | #![c={#![c[)x + | ^^ mismatched closing delimiter + | | + | unclosed delimiter + +error: this file contains an unclosed delimiter + --> $DIR/issue-105209.rs:3:68 + | +LL | #![c={#![c[)x + | - - - - missing open `(` for this delimiter + | | | | + | | | unclosed delimiter + | | unclosed delimiter + | unclosed delimiter +LL | + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/parser/issues/issue-10636-2.rs b/tests/ui/parser/issues/issue-10636-2.rs index 6fb63639d..80d8ef65a 100644 --- a/tests/ui/parser/issues/issue-10636-2.rs +++ b/tests/ui/parser/issues/issue-10636-2.rs @@ -1,11 +1,11 @@ +// error-pattern: mismatched closing delimiter: `}` // FIXME(31528) we emit a bunch of silly errors here due to continuing past the // first one. This would be easy-ish to address by better recovery in tokenisation. pub fn trace_option(option: Option<isize>) { option.map(|some| 42; - //~^ ERROR: expected one of + } -//~^ ERROR: expected expression, found `)` fn main() {} diff --git a/tests/ui/parser/issues/issue-10636-2.stderr b/tests/ui/parser/issues/issue-10636-2.stderr index d4f2da9e3..4cd4be180 100644 --- a/tests/ui/parser/issues/issue-10636-2.stderr +++ b/tests/ui/parser/issues/issue-10636-2.stderr @@ -1,16 +1,13 @@ -error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/issue-10636-2.rs:5:15 +error: mismatched closing delimiter: `}` + --> $DIR/issue-10636-2.rs:6:15 | +LL | pub fn trace_option(option: Option<isize>) { + | - closing delimiter possibly meant for this LL | option.map(|some| 42; - | ^ ^ help: `)` may belong here - | | - | unclosed delimiter - -error: expected expression, found `)` - --> $DIR/issue-10636-2.rs:8:1 - | + | ^ unclosed delimiter +... LL | } - | ^ expected expression + | ^ mismatched closing delimiter -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr index 1f0c1ea4c..de02ea85b 100644 --- a/tests/ui/parser/issues/issue-44406.stderr +++ b/tests/ui/parser/issues/issue-44406.stderr @@ -21,8 +21,8 @@ LL | foo!(true); = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: if `bar` is a struct, use braces as delimiters | -LL | bar { } - | ~ +LL | bar { baz: $rest } + | ~ ~ help: if `bar` is a function, use the arguments directly | LL - bar(baz: $rest) 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 25699f9fe..a596a9f2d 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,4 +1,5 @@ // Fixed in #66054. // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 2 previous errors +// error-pattern: this file contains an unclosed delimiter +// error-pattern: aborting due to 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 8a44ee761..c79e8b4fb 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 @@ -1,16 +1,10 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-58094-missing-right-square-bracket.rs:4:4 + --> $DIR/issue-58094-missing-right-square-bracket.rs:5:4 | LL | #[Ѕ | - ^ | | | unclosed delimiter -error: expected item after attributes - --> $DIR/issue-58094-missing-right-square-bracket.rs:4:1 - | -LL | #[Ѕ - | ^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-58856-1.rs b/tests/ui/parser/issues/issue-58856-1.rs index ea80eb871..799243d54 100644 --- a/tests/ui/parser/issues/issue-58856-1.rs +++ b/tests/ui/parser/issues/issue-58856-1.rs @@ -1,8 +1,5 @@ impl A { - //~^ ERROR cannot find type `A` in this scope fn b(self> - //~^ ERROR expected one of `)`, `,`, or `:`, found `>` - //~| ERROR expected one of `->`, `where`, or `{`, found `>` -} +} //~ ERROR mismatched closing delimiter fn main() {} diff --git a/tests/ui/parser/issues/issue-58856-1.stderr b/tests/ui/parser/issues/issue-58856-1.stderr index 96151f3fe..77ad8acbd 100644 --- a/tests/ui/parser/issues/issue-58856-1.stderr +++ b/tests/ui/parser/issues/issue-58856-1.stderr @@ -1,29 +1,12 @@ -error: expected one of `)`, `,`, or `:`, found `>` - --> $DIR/issue-58856-1.rs:3:9 - | -LL | fn b(self> - | ^ ^ help: `)` may belong here - | | - | unclosed delimiter - -error: expected one of `->`, `where`, or `{`, found `>` - --> $DIR/issue-58856-1.rs:3:14 +error: mismatched closing delimiter: `}` + --> $DIR/issue-58856-1.rs:2:9 | LL | impl A { - | - while parsing this item list starting here -LL | + | - closing delimiter possibly meant for this LL | fn b(self> - | ^ expected one of `->`, `where`, or `{` -... + | ^ unclosed delimiter LL | } - | - the item list ends here - -error[E0412]: cannot find type `A` in this scope - --> $DIR/issue-58856-1.rs:1:6 - | -LL | impl A { - | ^ not found in this scope + | ^ mismatched closing delimiter -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/parser/issues/issue-58856-2.rs b/tests/ui/parser/issues/issue-58856-2.rs index 9356d57b0..5edd72639 100644 --- a/tests/ui/parser/issues/issue-58856-2.rs +++ b/tests/ui/parser/issues/issue-58856-2.rs @@ -4,11 +4,8 @@ trait Howness {} impl Howness for () { fn how_are_you(&self -> Empty { - //~^ ERROR expected one of `)` or `,`, found `->` - //~| ERROR method `how_are_you` is not a member of trait `Howness` Empty } -} -//~^ ERROR non-item in item list +} //~ ERROR mismatched closing delimiter fn main() {} diff --git a/tests/ui/parser/issues/issue-58856-2.stderr b/tests/ui/parser/issues/issue-58856-2.stderr index 627dd3890..5fcf5bcc1 100644 --- a/tests/ui/parser/issues/issue-58856-2.stderr +++ b/tests/ui/parser/issues/issue-58856-2.stderr @@ -1,34 +1,13 @@ -error: expected one of `)` or `,`, found `->` +error: mismatched closing delimiter: `}` --> $DIR/issue-58856-2.rs:6:19 | -LL | fn how_are_you(&self -> Empty { - | ^ -^^ - | | | - | | help: `)` may belong here - | unclosed delimiter - -error: non-item in item list - --> $DIR/issue-58856-2.rs:11:1 - | LL | impl Howness for () { - | - item list starts here + | - closing delimiter possibly meant for this +LL | fn how_are_you(&self -> Empty { + | ^ unclosed delimiter ... LL | } - | ^ - | | - | non-item starts here - | item list ends here - -error[E0407]: method `how_are_you` is not a member of trait `Howness` - --> $DIR/issue-58856-2.rs:6:5 - | -LL | / fn how_are_you(&self -> Empty { -LL | | -LL | | -LL | | Empty -LL | | } - | |_____^ not a member of trait `Howness` + | ^ mismatched closing delimiter -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0407`. diff --git a/tests/ui/parser/issues/issue-60075.rs b/tests/ui/parser/issues/issue-60075.rs index e89d78ee8..3c36e4d3e 100644 --- a/tests/ui/parser/issues/issue-60075.rs +++ b/tests/ui/parser/issues/issue-60075.rs @@ -3,9 +3,6 @@ fn main() {} trait T { fn qux() -> Option<usize> { let _ = if true { - }); -//~^ ERROR non-item in item list -//~| ERROR mismatched closing delimiter: `)` -//~| ERROR expected one of `.`, `;` + }); //~ ERROR mismatched closing delimiter Some(4) } diff --git a/tests/ui/parser/issues/issue-60075.stderr b/tests/ui/parser/issues/issue-60075.stderr index 210ef700c..cd8f1231f 100644 --- a/tests/ui/parser/issues/issue-60075.stderr +++ b/tests/ui/parser/issues/issue-60075.stderr @@ -1,21 +1,3 @@ -error: expected one of `.`, `;`, `?`, `else`, or an operator, found `}` - --> $DIR/issue-60075.rs:6:10 - | -LL | }); - | ^ expected one of `.`, `;`, `?`, `else`, or an operator - -error: non-item in item list - --> $DIR/issue-60075.rs:6:11 - | -LL | trait T { - | - item list starts here -... -LL | }); - | ^ non-item starts here -... -LL | } - | - item list ends here - error: mismatched closing delimiter: `)` --> $DIR/issue-60075.rs:4:31 | @@ -25,5 +7,5 @@ LL | let _ = if true { LL | }); | ^ mismatched closing delimiter -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62524.rs b/tests/ui/parser/issues/issue-62524.rs index 5259dfe2e..fa7c626f5 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 3 previous errors +// error-pattern: aborting due to 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 55eed0402..0cbaacd4c 100644 --- a/tests/ui/parser/issues/issue-62524.stderr +++ b/tests/ui/parser/issues/issue-62524.stderr @@ -6,28 +6,5 @@ LL | y![ LL | Ϥ, | ^ -error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/issue-62524.rs:5:3 - | -LL | y![ - | ___^ -LL | | Ϥ, - | |__^ - | -help: change the delimiters to curly braces - | -LL | y! { /* items */ } - | ~~~~~~~~~~~~~~~ -help: add a semicolon - | -LL | Ϥ,; - | + - -error: cannot find macro `y` in this scope - --> $DIR/issue-62524.rs:5:1 - | -LL | y![ - | ^ - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62546.rs b/tests/ui/parser/issues/issue-62546.rs index f06b65058..bb30d68ea 100644 --- a/tests/ui/parser/issues/issue-62546.rs +++ b/tests/ui/parser/issues/issue-62546.rs @@ -1,3 +1 @@ -pub t(# -//~^ ERROR missing `fn` or `struct` for function or struct definition -//~ ERROR this file contains an unclosed delimiter +pub t(# //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-62546.stderr b/tests/ui/parser/issues/issue-62546.stderr index 32c61391e..80c1c7168 100644 --- a/tests/ui/parser/issues/issue-62546.stderr +++ b/tests/ui/parser/issues/issue-62546.stderr @@ -1,17 +1,8 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-62546.rs:3:52 + --> $DIR/issue-62546.rs:1:60 | LL | pub t(# - | - unclosed delimiter -LL | -LL | - | ^ + | - unclosed delimiter ^ -error: missing `fn` or `struct` for function or struct definition - --> $DIR/issue-62546.rs:1:4 - | -LL | pub t(# - | ---^- help: if you meant to call a macro, try: `t!` - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62554.rs b/tests/ui/parser/issues/issue-62554.rs index cfd02183c..4b463a173 100644 --- a/tests/ui/parser/issues/issue-62554.rs +++ b/tests/ui/parser/issues/issue-62554.rs @@ -1,5 +1,4 @@ // error-pattern:this file contains an unclosed delimiter -// error-pattern:xpected `{`, found `macro_rules` fn main() {} diff --git a/tests/ui/parser/issues/issue-62554.stderr b/tests/ui/parser/issues/issue-62554.stderr index 9e62572e3..4637c795a 100644 --- a/tests/ui/parser/issues/issue-62554.stderr +++ b/tests/ui/parser/issues/issue-62554.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 + --> $DIR/issue-62554.rs:5:89 | LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { | - - - - - ^ @@ -9,65 +9,5 @@ LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s | | | unclosed delimiter | unclosed delimiter unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ - | | | | | | - | | | | | unclosed delimiter - | | | | unclosed delimiter - | | | unclosed delimiter - | unclosed delimiter unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ - | | | | | | - | | | | | unclosed delimiter - | | | | unclosed delimiter - | | | unclosed delimiter - | unclosed delimiter unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ - | | | | | | - | | | | | unclosed delimiter - | | | | unclosed delimiter - | | | unclosed delimiter - | unclosed delimiter unclosed delimiter - -error: this file contains an unclosed delimiter - --> $DIR/issue-62554.rs:6:89 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | - - - - - ^ - | | | | | | - | | | | | unclosed delimiter - | | | | unclosed delimiter - | | | unclosed delimiter - | unclosed delimiter unclosed delimiter - -error: expected `{`, found `macro_rules` - --> $DIR/issue-62554.rs:6:23 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | ^^^^^^^^^^^ expected `{` - | -note: the `if` expression is missing a block after this condition - --> $DIR/issue-62554.rs:6:20 - | -LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { - | ^^ -help: try placing this code inside a block - | -LL | fn foo(u: u8) { if u8 { macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 { } - | + + - -error: aborting due to 6 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62881.rs b/tests/ui/parser/issues/issue-62881.rs index b9204595f..cc80d4499 100644 --- a/tests/ui/parser/issues/issue-62881.rs +++ b/tests/ui/parser/issues/issue-62881.rs @@ -1,6 +1,3 @@ fn main() {} -fn f() -> isize { fn f() -> isize {} pub f< -//~^ ERROR missing `fn` or `struct` for function or struct definition -//~| ERROR mismatched types -//~ ERROR this file contains an unclosed delimiter +fn f() -> isize { fn f() -> isize {} pub f< //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-62881.stderr b/tests/ui/parser/issues/issue-62881.stderr index 87be69baa..e57cbd181 100644 --- a/tests/ui/parser/issues/issue-62881.stderr +++ b/tests/ui/parser/issues/issue-62881.stderr @@ -1,26 +1,8 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-62881.rs:6:52 + --> $DIR/issue-62881.rs:3:96 | LL | fn f() -> isize { fn f() -> isize {} pub f< - | - unclosed delimiter -... -LL | - | ^ + | - unclosed delimiter ^ -error: missing `fn` or `struct` for function or struct definition - --> $DIR/issue-62881.rs:3:41 - | -LL | fn f() -> isize { fn f() -> isize {} pub f< - | ^ - -error[E0308]: mismatched types - --> $DIR/issue-62881.rs:3:29 - | -LL | fn f() -> isize { fn f() -> isize {} pub f< - | - ^^^^^ expected `isize`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression - -error: aborting due to 3 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/issues/issue-62894.rs b/tests/ui/parser/issues/issue-62894.rs index b9c0bf834..4dfa406ea 100644 --- a/tests/ui/parser/issues/issue-62894.rs +++ b/tests/ui/parser/issues/issue-62894.rs @@ -1,6 +1,5 @@ // Regression test for #62894, shouldn't crash. // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected one of `(`, `[`, or `{`, found keyword `fn` fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! diff --git a/tests/ui/parser/issues/issue-62894.stderr b/tests/ui/parser/issues/issue-62894.stderr index 07a203bf4..700479076 100644 --- a/tests/ui/parser/issues/issue-62894.stderr +++ b/tests/ui/parser/issues/issue-62894.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-62894.rs:7:14 + --> $DIR/issue-62894.rs:6:14 | LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! | - - - unclosed delimiter @@ -10,41 +10,5 @@ LL | LL | fn main() {} | ^ -error: this file contains an unclosed delimiter - --> $DIR/issue-62894.rs:7:14 - | -LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! - | - - - unclosed delimiter - | | | - | | unclosed delimiter - | unclosed delimiter -LL | -LL | fn main() {} - | ^ - -error: this file contains an unclosed delimiter - --> $DIR/issue-62894.rs:7:14 - | -LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! - | - - - unclosed delimiter - | | | - | | unclosed delimiter - | unclosed delimiter -LL | -LL | fn main() {} - | ^ - -error: expected one of `(`, `[`, or `{`, found keyword `fn` - --> $DIR/issue-62894.rs:7:1 - | -LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq! - | - expected one of `(`, `[`, or `{` -LL | -LL | fn main() {} - | ^^ unexpected token - --> $SRC_DIR/core/src/macros/mod.rs:LL:COL - | - = note: while parsing argument for this `expr` macro fragment - -error: aborting due to 4 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62895.rs b/tests/ui/parser/issues/issue-62895.rs index 53f17405d..33511dee9 100644 --- a/tests/ui/parser/issues/issue-62895.rs +++ b/tests/ui/parser/issues/issue-62895.rs @@ -1,11 +1,11 @@ fn main() {} -fn v() -> isize { //~ ERROR mismatched types -mod _ { //~ ERROR expected identifier -pub fn g() -> isizee { //~ ERROR cannot find type `isizee` in this scope -mod _ { //~ ERROR expected identifier -pub g() -> is //~ ERROR missing `fn` for function definition -(), w20); +fn v() -> isize { +mod _ { +pub fn g() -> isizee { +mod _ { +pub g() -> is +(), w20); //~ ERROR mismatched closing delimiter } -(), w20); //~ ERROR expected item, found `;` +(), w20); //~ ERROR mismatched closing delimiter } diff --git a/tests/ui/parser/issues/issue-62895.stderr b/tests/ui/parser/issues/issue-62895.stderr index 2e7e500f4..0ad9ac63e 100644 --- a/tests/ui/parser/issues/issue-62895.stderr +++ b/tests/ui/parser/issues/issue-62895.stderr @@ -1,47 +1,20 @@ -error: expected identifier, found reserved identifier `_` - --> $DIR/issue-62895.rs:4:5 +error: mismatched closing delimiter: `)` + --> $DIR/issue-62895.rs:6:7 | LL | mod _ { - | ^ expected identifier, found reserved identifier - -error: expected identifier, found reserved identifier `_` - --> $DIR/issue-62895.rs:6:5 - | -LL | mod _ { - | ^ expected identifier, found reserved identifier - -error: missing `fn` for function definition - --> $DIR/issue-62895.rs:7:4 - | + | ^ unclosed delimiter LL | pub g() -> is - | ^^^^ - | -help: add `fn` here to parse `g` as a public function - | -LL | pub fn g() -> is - | ++ - -error: expected item, found `;` - --> $DIR/issue-62895.rs:10:9 - | LL | (), w20); - | ^ help: remove this semicolon - -error[E0412]: cannot find type `isizee` in this scope - --> $DIR/issue-62895.rs:5:15 - | -LL | pub fn g() -> isizee { - | ^^^^^^ help: a builtin type with a similar name exists: `isize` + | ^ mismatched closing delimiter -error[E0308]: mismatched types - --> $DIR/issue-62895.rs:3:11 +error: mismatched closing delimiter: `)` + --> $DIR/issue-62895.rs:4:7 | -LL | fn v() -> isize { - | - ^^^^^ expected `isize`, found `()` - | | - | implicitly returns `()` as its body has no tail or `return` expression +LL | mod _ { + | ^ unclosed delimiter +... +LL | (), w20); + | ^ mismatched closing delimiter -error: aborting due to 6 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0308, E0412. -For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/issues/issue-62973.rs b/tests/ui/parser/issues/issue-62973.rs index 1c5d0c6f8..22d754577 100644 --- a/tests/ui/parser/issues/issue-62973.rs +++ b/tests/ui/parser/issues/issue-62973.rs @@ -1,5 +1,5 @@ // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 7 previous errors +// error-pattern: aborting due to 3 previous errors fn main() {} diff --git a/tests/ui/parser/issues/issue-62973.stderr b/tests/ui/parser/issues/issue-62973.stderr index 4737bc718..14411a8cb 100644 --- a/tests/ui/parser/issues/issue-62973.stderr +++ b/tests/ui/parser/issues/issue-62973.stderr @@ -1,68 +1,3 @@ -error: this file contains an unclosed delimiter - --> $DIR/issue-62973.rs:8:2 - | -LL | fn p() { match s { v, E { [) {) } - | - - unclosed delimiter - | | - | unclosed delimiter -LL | -LL | - | ^ - -error: this file contains an unclosed delimiter - --> $DIR/issue-62973.rs:8:2 - | -LL | fn p() { match s { v, E { [) {) } - | - - unclosed delimiter - | | - | unclosed delimiter -LL | -LL | - | ^ - -error: expected one of `,`, `:`, or `}`, found `{` - --> $DIR/issue-62973.rs:6:8 - | -LL | fn p() { match s { v, E { [) {) } - | ^ - ^ expected one of `,`, `:`, or `}` - | | | - | | while parsing this struct - | unclosed delimiter - | -help: `}` may belong here - | -LL | fn p() { match s { v, E} { [) {) } - | + -help: try naming a field - | -LL | fn p() { match s { v, E: E { [) {) } - | ++ - -error: struct literals are not allowed here - --> $DIR/issue-62973.rs:6:16 - | -LL | fn p() { match s { v, E { [) {) } - | ________________^ -LL | | -LL | | - | |_^ - | -help: surround the struct literal with parentheses - | -LL ~ fn p() { match (s { v, E { [) {) } -LL | -LL ~ ) - | - -error: expected one of `.`, `?`, `{`, or an operator, found `}` - --> $DIR/issue-62973.rs:8:2 - | -LL | fn p() { match s { v, E { [) {) } - | ----- while parsing this `match` expression -LL | -LL | - | ^ expected one of `.`, `?`, `{`, or an operator - error: mismatched closing delimiter: `)` --> $DIR/issue-62973.rs:6:27 | @@ -79,5 +14,18 @@ LL | fn p() { match s { v, E { [) {) } | | | unclosed delimiter -error: aborting due to 7 previous errors +error: this file contains an unclosed delimiter + --> $DIR/issue-62973.rs:8:2 + | +LL | fn p() { match s { v, E { [) {) } + | - - - - missing open `(` for this delimiter + | | | | + | | | missing open `(` for this delimiter + | | unclosed delimiter + | unclosed delimiter +LL | +LL | + | ^ + +error: aborting due to 3 previous errors diff --git a/tests/ui/parser/issues/issue-63116.rs b/tests/ui/parser/issues/issue-63116.rs index 430bc1d71..6b9d9cdbe 100644 --- a/tests/ui/parser/issues/issue-63116.rs +++ b/tests/ui/parser/issues/issue-63116.rs @@ -1,3 +1,3 @@ // fixed by #66361 -// error-pattern: aborting due to 3 previous errors +// error-pattern: aborting due to 2 previous errors impl W <s(f;Y(;] diff --git a/tests/ui/parser/issues/issue-63116.stderr b/tests/ui/parser/issues/issue-63116.stderr index cfdd99d14..27c94f337 100644 --- a/tests/ui/parser/issues/issue-63116.stderr +++ b/tests/ui/parser/issues/issue-63116.stderr @@ -1,17 +1,3 @@ -error: this file contains an unclosed delimiter - --> $DIR/issue-63116.rs:3:18 - | -LL | impl W <s(f;Y(;] - | - ^ - | | - | unclosed delimiter - -error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `;` - --> $DIR/issue-63116.rs:3:12 - | -LL | impl W <s(f;Y(;] - | ^ expected one of 7 possible tokens - error: mismatched closing delimiter: `]` --> $DIR/issue-63116.rs:3:14 | @@ -20,5 +6,14 @@ LL | impl W <s(f;Y(;] | | | unclosed delimiter -error: aborting due to 3 previous errors +error: this file contains an unclosed delimiter + --> $DIR/issue-63116.rs:3:18 + | +LL | impl W <s(f;Y(;] + | - - ^ + | | | + | | missing open `[` for this delimiter + | unclosed delimiter + +error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-63135.rs b/tests/ui/parser/issues/issue-63135.rs index a5a8de854..d61197dc5 100644 --- a/tests/ui/parser/issues/issue-63135.rs +++ b/tests/ui/parser/issues/issue-63135.rs @@ -1,3 +1,3 @@ -// error-pattern: aborting due to 5 previous errors - +// error-pattern: this file contains an unclosed delimiter +// error-pattern: aborting due to 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 80e9ac5be..ff9d99c28 100644 --- a/tests/ui/parser/issues/issue-63135.stderr +++ b/tests/ui/parser/issues/issue-63135.stderr @@ -7,37 +7,5 @@ LL | fn i(n{...,f # | | unclosed delimiter | unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/issue-63135.rs:3:16 - | -LL | fn i(n{...,f # - | - - ^ - | | | - | | unclosed delimiter - | unclosed delimiter - -error: expected field pattern, found `...` - --> $DIR/issue-63135.rs:3:8 - | -LL | fn i(n{...,f # - | ^^^ help: to omit remaining fields, use one fewer `.`: `..` - -error: expected `}`, found `,` - --> $DIR/issue-63135.rs:3:11 - | -LL | fn i(n{...,f # - | ---^ - | | | - | | expected `}` - | `..` must be at the end and cannot have a trailing comma - -error: expected one of `!` or `[`, found `}` - --> $DIR/issue-63135.rs:3:16 - | -LL | fn i(n{...,f # - | - ^ expected one of `!` or `[` - | | - | while parsing the fields for this pattern - -error: aborting due to 5 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.rs b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.rs index aed428bfc..69a2dfe6c 100644 --- a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.rs +++ b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.rs @@ -9,6 +9,4 @@ // // ended up bubbling up `Ok(true)` to `unexpected` which then used `unreachable!()`. -fn f() { |[](* } -//~^ ERROR expected one of `,` or `:`, found `(` -//~| ERROR expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` +fn f() { |[](* } //~ ERROR mismatched closing delimiter diff --git a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr index 6cbab855c..079fff37e 100644 --- a/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr +++ b/tests/ui/parser/issues/issue-66357-unexpected-unreachable.stderr @@ -1,16 +1,11 @@ -error: expected one of `,` or `:`, found `(` +error: mismatched closing delimiter: `}` --> $DIR/issue-66357-unexpected-unreachable.rs:12:13 | LL | fn f() { |[](* } - | ^ expected one of `,` or `:` + | - ^ ^ mismatched closing delimiter + | | | + | | unclosed delimiter + | closing delimiter possibly meant for this -error: expected one of `&`, `(`, `)`, `-`, `...`, `..=`, `..`, `[`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` - --> $DIR/issue-66357-unexpected-unreachable.rs:12:13 - | -LL | fn f() { |[](* } - | ^^ help: `)` may belong here - | | - | unclosed delimiter - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs index 87222ef4b..e712160fc 100644 --- a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs +++ b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.rs @@ -4,9 +4,6 @@ mod a { enum Bug { V = [PhantomData; { [ () ].len() ].len() as isize, //~^ ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` } } @@ -14,10 +11,6 @@ mod b { enum Bug { V = [Vec::new; { [].len() ].len() as isize, //~^ ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR type annotations needed } } @@ -25,11 +18,6 @@ mod c { enum Bug { V = [Vec::new; { [0].len() ].len() as isize, //~^ ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR mismatched closing delimiter: `]` - //~| ERROR type annotations needed - } } -fn main() {} +fn main() {} //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr index a00f37ed6..9f631edf6 100644 --- a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr +++ b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr @@ -8,7 +8,7 @@ LL | V = [PhantomData; { [ () ].len() ].len() as isize, | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:12:24 | LL | V = [Vec::new; { [].len() ].len() as isize, | - ^ ^ mismatched closing delimiter @@ -17,7 +17,7 @@ LL | V = [Vec::new; { [].len() ].len() as isize, | closing delimiter possibly meant for this error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:19:24 | LL | V = [Vec::new; { [0].len() ].len() as isize, | - ^ ^ mismatched closing delimiter @@ -25,104 +25,23 @@ LL | V = [Vec::new; { [0].len() ].len() as isize, | | unclosed delimiter | closing delimiter possibly meant for this -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 - | -LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 - | -LL | V = [Vec::new; { [].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 - | -LL | V = [Vec::new; { [0].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 - | -LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 - | -LL | V = [Vec::new; { [].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 - | -LL | V = [Vec::new; { [0].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:5:27 +error: this file contains an unclosed delimiter + --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:23:65 | LL | V = [PhantomData; { [ () ].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:24 - | + | - missing open `[` for this delimiter +... LL | V = [Vec::new; { [].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error: mismatched closing delimiter: `]` - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:24 - | + | - missing open `[` for this delimiter +... +LL | mod c { + | - unclosed delimiter +LL | enum Bug { LL | V = [Vec::new; { [0].len() ].len() as isize, - | - ^ ^ mismatched closing delimiter - | | | - | | unclosed delimiter - | closing delimiter possibly meant for this - -error[E0282]: type annotations needed - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:15:26 - | -LL | V = [Vec::new; { [].len() ].len() as isize, - | ^^ cannot infer type for type parameter `T` - -error[E0282]: type annotations needed - --> $DIR/issue-67377-invalid-syntax-in-enum-discriminant.rs:26:14 - | -LL | V = [Vec::new; { [0].len() ].len() as isize, - | ^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Vec` - | -help: consider specifying the generic argument - | -LL | V = [Vec::<T>::new; { [0].len() ].len() as isize, - | +++++ + | - missing open `[` for this delimiter +... +LL | fn main() {} + | ^ -error: aborting due to 14 previous errors +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/parser/issues/issue-68629.rs b/tests/ui/parser/issues/issue-68629.rs Binary files differindex 672a31f12..af89bb586 100644 --- a/tests/ui/parser/issues/issue-68629.rs +++ b/tests/ui/parser/issues/issue-68629.rs diff --git a/tests/ui/parser/issues/issue-68629.stderr b/tests/ui/parser/issues/issue-68629.stderr Binary files differindex 43a903e6c..2562baa1c 100644 --- a/tests/ui/parser/issues/issue-68629.stderr +++ b/tests/ui/parser/issues/issue-68629.stderr diff --git a/tests/ui/parser/issues/issue-69259.rs b/tests/ui/parser/issues/issue-69259.rs new file mode 100644 index 000000000..01fc2c085 --- /dev/null +++ b/tests/ui/parser/issues/issue-69259.rs @@ -0,0 +1,3 @@ +fn main() {} + +fn f) {} //~ ERROR unexpected closing delimiter diff --git a/tests/ui/parser/issues/issue-69259.stderr b/tests/ui/parser/issues/issue-69259.stderr new file mode 100644 index 000000000..604b7de33 --- /dev/null +++ b/tests/ui/parser/issues/issue-69259.stderr @@ -0,0 +1,8 @@ +error: unexpected closing delimiter: `)` + --> $DIR/issue-69259.rs:3:5 + | +LL | fn f) {} + | ^ unexpected closing delimiter + +error: aborting due to 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 39bf113ef..46cbb056d 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 @@ -2,10 +2,10 @@ error: unexpected closing delimiter: `}` --> $DIR/issue-70583-block-is-empty-1.rs:20:1 | LL | fn struct_generic(x: Vec<i32>) { - | - this opening brace... + | - this delimiter might not be properly closed... ... LL | } - | - ...matches this closing brace + | - ...as it matches this but it has different indentation LL | } | ^ 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 5d37b2164..9ae94c701 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,12 @@ error: unexpected closing delimiter: `}` --> $DIR/issue-70583-block-is-empty-2.rs:14:1 | +LL | match self { + | - this delimiter might not be properly closed... LL | ErrorHandled::Reported => {}} - | -- block is empty, you might have not meant to close it + | --- ...as it matches this but it has different indentation + | | + | block is empty, you might have not meant to close it ... LL | } | ^ unexpected closing delimiter diff --git a/tests/ui/parser/issues/issue-84104.rs b/tests/ui/parser/issues/issue-84104.rs index 998949b94..962eb69bd 100644 --- a/tests/ui/parser/issues/issue-84104.rs +++ b/tests/ui/parser/issues/issue-84104.rs @@ -1,3 +1,2 @@ // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected one of #[i=i::<ښܖ< diff --git a/tests/ui/parser/issues/issue-84104.stderr b/tests/ui/parser/issues/issue-84104.stderr index aff31f2c9..7ad59f845 100644 --- a/tests/ui/parser/issues/issue-84104.stderr +++ b/tests/ui/parser/issues/issue-84104.stderr @@ -1,16 +1,10 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-84104.rs:3:13 + --> $DIR/issue-84104.rs:2:13 | LL | #[i=i::<ښܖ< | - ^ | | | unclosed delimiter -error: expected one of `>`, a const expression, lifetime, or type, found `]` - --> $DIR/issue-84104.rs:3:13 - | -LL | #[i=i::<ښܖ< - | ^ expected one of `>`, a const expression, lifetime, or type - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-84148-2.rs b/tests/ui/parser/issues/issue-84148-2.rs index 2f6a7facf..e677abde5 100644 --- a/tests/ui/parser/issues/issue-84148-2.rs +++ b/tests/ui/parser/issues/issue-84148-2.rs @@ -1,3 +1,2 @@ // error-pattern: this file contains an unclosed delimiter -// error-pattern: invalid `?` in type fn f(t:for<>t? diff --git a/tests/ui/parser/issues/issue-84148-2.stderr b/tests/ui/parser/issues/issue-84148-2.stderr index 71d543f9b..20761180e 100644 --- a/tests/ui/parser/issues/issue-84148-2.stderr +++ b/tests/ui/parser/issues/issue-84148-2.stderr @@ -1,27 +1,10 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-84148-2.rs:3:16 + --> $DIR/issue-84148-2.rs:2:16 | LL | fn f(t:for<>t? | - ^ | | | unclosed delimiter -error: invalid `?` in type - --> $DIR/issue-84148-2.rs:3:14 - | -LL | fn f(t:for<>t? - | ^ `?` is only allowed on expressions, not types - | -help: if you meant to express that the type might not contain a value, use the `Option` wrapper type - | -LL | fn f(t:Option<for<>t> - | +++++++ ~ - -error: expected one of `->`, `where`, or `{`, found `<eof>` - --> $DIR/issue-84148-2.rs:3:16 - | -LL | fn f(t:for<>t? - | ^ expected one of `->`, `where`, or `{` - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.rs b/tests/ui/parser/issues/issue-87086-colon-path-sep.rs index 0b7b67496..e1ea38f27 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.rs +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.rs @@ -68,7 +68,6 @@ fn main() { Foo:Bar::Baz => {} //~^ ERROR: expected one of //~| HELP: maybe write a path separator here - //~| ERROR: failed to resolve: `Bar` is a variant, not a module } match myfoo { Foo::Bar => {} diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index 2050a16be..63b072ac4 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -2,89 +2,118 @@ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:17:12 | LL | Foo:Bar => {} - | ^ + | ^--- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | Foo::Bar => {} + | ~~ error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 | LL | qux::Foo:Bar => {} - | ^ + | ^--- specifying the type of a pattern isn't supported | | | expected one of 8 possible tokens - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | qux::Foo::Bar => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 | LL | qux:Foo::Baz => {} - | ^ + | ^-------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 | LL | qux: Foo::Baz if true => {} - | ^ + | ^ -------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | qux::Foo::Baz if true => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:40:15 | LL | if let Foo:Bar = f() { - | ^ + | ^--- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | if let Foo::Bar = f() { + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:48:16 | LL | ref qux: Foo::Baz => {} - | ^ + | ^ -------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | ref qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:57:16 | LL | mut qux: Foo::Baz => {} - | ^ + | ^ -------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | mut qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:68:12 | LL | Foo:Bar::Baz => {} - | ^ + | ^-------- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` + | +help: maybe write a path separator here + | +LL | Foo::Bar::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` - --> $DIR/issue-87086-colon-path-sep.rs:75:12 + --> $DIR/issue-87086-colon-path-sep.rs:74:12 | LL | Foo:Bar => {} - | ^ + | ^--- specifying the type of a pattern isn't supported | | | expected one of `@` or `|` - | help: maybe write a path separator here: `::` - -error[E0433]: failed to resolve: `Bar` is a variant, not a module - --> $DIR/issue-87086-colon-path-sep.rs:68:13 | -LL | Foo:Bar::Baz => {} - | ^^^ `Bar` is a variant, not a module +help: maybe write a path separator here + | +LL | Foo::Bar => {} + | ~~ -error: aborting due to 10 previous errors +error: aborting due to 9 previous errors -For more information about this error, try `rustc --explain E0433`. diff --git a/tests/ui/parser/issues/issue-87812-path.stderr b/tests/ui/parser/issues/issue-87812-path.stderr index f8ee05175..d045f4821 100644 --- a/tests/ui/parser/issues/issue-87812-path.stderr +++ b/tests/ui/parser/issues/issue-87812-path.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/issue-87812-path.rs:3:24 | LL | let _: usize = $f; - | ----- ^^ expected `usize`, found struct `Baz` + | ----- ^^ expected `usize`, found `Baz` | | | expected due to this ... diff --git a/tests/ui/parser/issues/issue-88770.rs b/tests/ui/parser/issues/issue-88770.rs index bb69951c7..9341415b2 100644 --- a/tests/ui/parser/issues/issue-88770.rs +++ b/tests/ui/parser/issues/issue-88770.rs @@ -1,9 +1,6 @@ // Regression test for the ICE described in #88770. // error-pattern:this file contains an unclosed delimiter -// error-pattern:expected one of -// error-pattern:missing `in` in `for` loop -// error-pattern:expected one of `!`, `)`, `,`, `.`, `::`, `;`, `?`, `{`, or an operator, found `e` fn m(){print!("",(c for&g u diff --git a/tests/ui/parser/issues/issue-88770.stderr b/tests/ui/parser/issues/issue-88770.stderr index 4e3a21613..836f44953 100644 --- a/tests/ui/parser/issues/issue-88770.stderr +++ b/tests/ui/parser/issues/issue-88770.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/issue-88770.rs:11:3 + --> $DIR/issue-88770.rs:8:3 | LL | fn m(){print!("",(c for&g | - - - unclosed delimiter @@ -10,51 +10,5 @@ LL | fn m(){print!("",(c for&g LL | e | ^ -error: this file contains an unclosed delimiter - --> $DIR/issue-88770.rs:11:3 - | -LL | fn m(){print!("",(c for&g - | - - - unclosed delimiter - | | | - | | unclosed delimiter - | unclosed delimiter -... -LL | e - | ^ - -error: this file contains an unclosed delimiter - --> $DIR/issue-88770.rs:11:3 - | -LL | fn m(){print!("",(c for&g - | - - - unclosed delimiter - | | | - | | unclosed delimiter - | unclosed delimiter -... -LL | e - | ^ - -error: missing `in` in `for` loop - --> $DIR/issue-88770.rs:8:26 - | -LL | fn m(){print!("",(c for&g - | __________________________^ -LL | | u - | |_ help: try adding `in` here - -error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found keyword `for` - --> $DIR/issue-88770.rs:8:21 - | -LL | fn m(){print!("",(c for&g - | ^^^ expected one of 8 possible tokens - -error: expected one of `!`, `)`, `,`, `.`, `::`, `;`, `?`, `{`, or an operator, found `e` - --> $DIR/issue-88770.rs:11:1 - | -LL | e - | - expected one of 9 possible tokens -LL | e - | ^ unexpected token - -error: aborting due to 6 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/macro-mismatched-delim-paren-brace.stderr b/tests/ui/parser/macro-mismatched-delim-paren-brace.stderr index 967a3e6fd..34217e21a 100644 --- a/tests/ui/parser/macro-mismatched-delim-paren-brace.stderr +++ b/tests/ui/parser/macro-mismatched-delim-paren-brace.stderr @@ -1,14 +1,3 @@ -error: unexpected closing delimiter: `}` - --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 - | -LL | fn main() { - | - this opening brace... -... -LL | } - | - ...matches this closing brace -LL | } - | ^ unexpected closing delimiter - error: mismatched closing delimiter: `}` --> $DIR/macro-mismatched-delim-paren-brace.rs:2:10 | @@ -18,5 +7,16 @@ LL | bar, "baz", 1, 2.0 LL | } | ^ mismatched closing delimiter +error: unexpected closing delimiter: `}` + --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 + | +LL | fn main() { + | - this delimiter might not be properly closed... +... +LL | } + | - ...as it matches this but it has different indentation +LL | } + | ^ unexpected closing delimiter + error: aborting due to 2 previous errors diff --git a/tests/ui/parser/match-arm-without-braces.stderr b/tests/ui/parser/match-arm-without-braces.stderr index 37d55aa53..ee1c8e562 100644 --- a/tests/ui/parser/match-arm-without-braces.stderr +++ b/tests/ui/parser/match-arm-without-braces.stderr @@ -2,10 +2,14 @@ error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:26:27 | LL | Some(Val::Foo) => 3; - | -- ^- help: use a comma to end a `match` arm expression: `,` - | | | - | | this statement is not surrounded by a body + | -- ^ this statement is not surrounded by a body + | | | while parsing the `match` arm starting here + | +help: replace `;` with `,` to end a `match` arm expression + | +LL | Some(Val::Foo) => 3, + | ~ error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:31:11 diff --git a/tests/ui/parser/mbe_missing_right_paren.rs b/tests/ui/parser/mbe_missing_right_paren.rs index 689176b3e..9a92e67da 100644 --- a/tests/ui/parser/mbe_missing_right_paren.rs +++ b/tests/ui/parser/mbe_missing_right_paren.rs @@ -1,3 +1,3 @@ // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 3 previous errors +// error-pattern: this file contains an unclosed delimiter macro_rules! abc(ؼ
\ No newline at end of file diff --git a/tests/ui/parser/mbe_missing_right_paren.stderr b/tests/ui/parser/mbe_missing_right_paren.stderr index ccaf77d39..d2af94683 100644 --- a/tests/ui/parser/mbe_missing_right_paren.stderr +++ b/tests/ui/parser/mbe_missing_right_paren.stderr @@ -6,26 +6,5 @@ LL | macro_rules! abc(ؼ | | | unclosed delimiter -error: macros that expand to items must be delimited with braces or followed by a semicolon - --> $DIR/mbe_missing_right_paren.rs:3:17 - | -LL | macro_rules! abc(ؼ - | ^^ - | -help: change the delimiters to curly braces - | -LL | macro_rules! abc { /* items */ } - | ~~~~~~~~~~~~~~~ -help: add a semicolon - | -LL | macro_rules! abc(ؼ; - | + - -error: unexpected end of macro invocation - --> $DIR/mbe_missing_right_paren.rs:3:19 - | -LL | macro_rules! abc(ؼ - | ^ missing tokens in macro arguments - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs index 8f46970b1..79de98d8b 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs @@ -1,13 +1,13 @@ fn main() {} -impl T for () { //~ ERROR cannot find trait `T` in this scope +impl T for () { fn foo(&self) {} -trait T { //~ ERROR trait is not supported in `trait`s or `impl`s +trait T { fn foo(&self); } -pub(crate) struct Bar<T>(); //~ ERROR struct is not supported in `trait`s or `impl`s +pub(crate) struct Bar<T>(); //~ ERROR this file contains an unclosed delimiter 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 cc7cc0c55..d91a7f054 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,28 +7,5 @@ LL | impl T for () { LL | | ^ -error: trait is not supported in `trait`s or `impl`s - --> $DIR/missing-close-brace-in-impl-trait.rs:7:1 - | -LL | trait T { - | ^^^^^^^ - | - = help: consider moving the trait out to a nearby module scope - -error: struct is not supported in `trait`s or `impl`s - --> $DIR/missing-close-brace-in-impl-trait.rs:11:1 - | -LL | pub(crate) struct Bar<T>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider moving the struct out to a nearby module scope - -error[E0405]: cannot find trait `T` in this scope - --> $DIR/missing-close-brace-in-impl-trait.rs:3:6 - | -LL | impl T for () { - | ^ not found in this scope - -error: aborting due to 4 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0405`. diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs index 090a17b41..88bc72576 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs @@ -1,7 +1,7 @@ pub(crate) struct Bar<T> { foo: T, -trait T { //~ ERROR expected identifier, found keyword `trait` +trait T { fn foo(&self); } 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 ad1e90e43..d01d9ed60 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,14 +7,5 @@ LL | pub(crate) struct Bar<T> { LL | fn main() {} | ^ -error: expected identifier, found keyword `trait` - --> $DIR/missing-close-brace-in-struct.rs:4:1 - | -LL | pub(crate) struct Bar<T> { - | --- while parsing this struct -... -LL | trait T { - | ^^^^^ expected identifier, found keyword - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs index b6932deb5..a05d6aa8e 100644 --- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs +++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs @@ -2,10 +2,9 @@ trait T { fn foo(&self); pub(crate) struct Bar<T>(); -//~^ ERROR struct is not supported in `trait`s or `impl`s impl T for Bar<usize> { -//~^ ERROR implementation is not supported in `trait`s or `impl`s + fn foo(&self) {} } 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 7c6254356..7418dd64c 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 @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/missing-close-brace-in-trait.rs:12:65 + --> $DIR/missing-close-brace-in-trait.rs:11:65 | LL | trait T { | - unclosed delimiter @@ -7,21 +7,5 @@ LL | trait T { LL | fn main() {} | ^ -error: struct is not supported in `trait`s or `impl`s - --> $DIR/missing-close-brace-in-trait.rs:4:1 - | -LL | pub(crate) struct Bar<T>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider moving the struct out to a nearby module scope - -error: implementation is not supported in `trait`s or `impl`s - --> $DIR/missing-close-brace-in-trait.rs:7:1 - | -LL | impl T for Bar<usize> { - | ^^^^^^^^^^^^^^^^^^^^^ - | - = help: consider moving the implementation out to a nearby module scope - -error: aborting due to 3 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.rs b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.rs index da95c1bfa..a56cd1777 100644 --- a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.rs +++ b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.rs @@ -17,7 +17,7 @@ fn test2<T1, T2>(arg1 : T1, arg2 : T2) { fn test3<'a>(arg : &'a u32) { let v : Vec<'a = vec![]; //~^ ERROR: expected one of - //~| ERROR: type annotations needed for `Vec<T>` + //~| ERROR: type annotations needed for `Vec<_>` } fn main() {} 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 bad241634..b2448774a 100644 --- a/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr +++ b/tests/ui/parser/missing-closing-angle-bracket-eq-constraint.stderr @@ -39,26 +39,26 @@ help: you might have meant to end the type parameters here LL | let v : Vec<'a> = vec![]; | + -error[E0282]: type annotations needed for `Vec<T>` +error[E0282]: type annotations needed for `Vec<_>` --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:7:7 | LL | let v : Vec<(u32,_) = vec![]; | ^ | -help: consider giving `v` an explicit type, where the type for type parameter `T` is specified +help: consider giving `v` an explicit type, where the placeholders `_` are specified | -LL | let v: Vec<T> : Vec<(u32,_) = vec![]; +LL | let v: Vec<_> : Vec<(u32,_) = vec![]; | ++++++++ -error[E0282]: type annotations needed for `Vec<T>` +error[E0282]: type annotations needed for `Vec<_>` --> $DIR/missing-closing-angle-bracket-eq-constraint.rs:18:7 | LL | let v : Vec<'a = vec![]; | ^ | -help: consider giving `v` an explicit type, where the type for type parameter `T` is specified +help: consider giving `v` an explicit type, where the placeholders `_` are specified | -LL | let v: Vec<T> : Vec<'a = vec![]; +LL | let v: Vec<_> : Vec<'a = vec![]; | ++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/parser/missing-expression-in-for-loop.rs b/tests/ui/parser/missing-expression-in-for-loop.rs new file mode 100644 index 000000000..518a89a0e --- /dev/null +++ b/tests/ui/parser/missing-expression-in-for-loop.rs @@ -0,0 +1,5 @@ +fn main() { + for i in { + //~^ ERROR missing expression to iterate on in `for` loop + } +} diff --git a/tests/ui/parser/missing-expression-in-for-loop.stderr b/tests/ui/parser/missing-expression-in-for-loop.stderr new file mode 100644 index 000000000..74a7c4224 --- /dev/null +++ b/tests/ui/parser/missing-expression-in-for-loop.stderr @@ -0,0 +1,13 @@ +error: missing expression to iterate on in `for` loop + --> $DIR/missing-expression-in-for-loop.rs:2:14 + | +LL | for i in { + | ^ + | +help: try adding an expression to the `for` loop + | +LL | for i in /* expression */ { + | ++++++++++++++++ + +error: aborting due to previous error + diff --git a/tests/ui/parser/missing_right_paren.rs b/tests/ui/parser/missing_right_paren.rs index 810dee957..e240f8c67 100644 --- a/tests/ui/parser/missing_right_paren.rs +++ b/tests/ui/parser/missing_right_paren.rs @@ -1,3 +1,4 @@ // ignore-tidy-trailing-newlines -// error-pattern: aborting due to 4 previous errors +// error-pattern: this file contains an unclosed delimiter +// error-pattern: aborting due to 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 3fe0d0f42..994ce4d85 100644 --- a/tests/ui/parser/missing_right_paren.stderr +++ b/tests/ui/parser/missing_right_paren.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/missing_right_paren.rs:3:11 + --> $DIR/missing_right_paren.rs:4:11 | LL | fn main((ؼ | -- ^ @@ -7,26 +7,5 @@ LL | fn main((ؼ | |unclosed delimiter | unclosed delimiter -error: this file contains an unclosed delimiter - --> $DIR/missing_right_paren.rs:3:11 - | -LL | fn main((ؼ - | -- ^ - | || - | |unclosed delimiter - | unclosed delimiter - -error: expected one of `:` or `|`, found `)` - --> $DIR/missing_right_paren.rs:3:11 - | -LL | fn main((ؼ - | ^ expected one of `:` or `|` - -error: expected one of `->`, `where`, or `{`, found `<eof>` - --> $DIR/missing_right_paren.rs:3:11 - | -LL | fn main((ؼ - | ^ expected one of `->`, `where`, or `{` - -error: aborting due to 4 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/parser-recovery-1.rs b/tests/ui/parser/parser-recovery-1.rs index 7e26b4f2b..5f729665c 100644 --- a/tests/ui/parser/parser-recovery-1.rs +++ b/tests/ui/parser/parser-recovery-1.rs @@ -3,11 +3,8 @@ trait Foo { fn bar() { let x = foo(); - //~^ ERROR cannot find function `foo` in this scope } fn main() { let x = y.; - //~^ ERROR unexpected token - //~| ERROR cannot find value `y` in this scope } //~ ERROR this file contains an unclosed delimiter diff --git a/tests/ui/parser/parser-recovery-1.stderr b/tests/ui/parser/parser-recovery-1.stderr index 0cb771ea3..7045b6f5b 100644 --- a/tests/ui/parser/parser-recovery-1.stderr +++ b/tests/ui/parser/parser-recovery-1.stderr @@ -1,35 +1,16 @@ error: this file contains an unclosed delimiter - --> $DIR/parser-recovery-1.rs:13:54 + --> $DIR/parser-recovery-1.rs:10:54 | LL | trait Foo { | - unclosed delimiter LL | fn bar() { | - this delimiter might not be properly closed... -... +LL | let x = foo(); LL | } | - ...as it matches this but it has different indentation ... LL | } | ^ -error: unexpected token: `;` - --> $DIR/parser-recovery-1.rs:10:15 - | -LL | let x = y.; - | ^ - -error[E0425]: cannot find value `y` in this scope - --> $DIR/parser-recovery-1.rs:10:13 - | -LL | let x = y.; - | ^ not found in this scope - -error[E0425]: cannot find function `foo` in this scope - --> $DIR/parser-recovery-1.rs:5:17 - | -LL | let x = foo(); - | ^^^ not found in this scope - -error: aborting due to 4 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/parser/parser-recovery-2.rs b/tests/ui/parser/parser-recovery-2.rs index 48b22afff..203d8aac6 100644 --- a/tests/ui/parser/parser-recovery-2.rs +++ b/tests/ui/parser/parser-recovery-2.rs @@ -2,11 +2,10 @@ trait Foo { fn bar() { - let x = foo(); //~ ERROR cannot find function `foo` in this scope + let x = foo(); ) //~ ERROR mismatched closing delimiter: `)` } fn main() { - let x = y.; //~ ERROR unexpected token - //~^ ERROR cannot find value `y` in this scope + let x = y.; } diff --git a/tests/ui/parser/parser-recovery-2.stderr b/tests/ui/parser/parser-recovery-2.stderr index 8829cf4c1..f396e5fde 100644 --- a/tests/ui/parser/parser-recovery-2.stderr +++ b/tests/ui/parser/parser-recovery-2.stderr @@ -1,9 +1,3 @@ -error: unexpected token: `;` - --> $DIR/parser-recovery-2.rs:10:15 - | -LL | let x = y.; - | ^ - error: mismatched closing delimiter: `)` --> $DIR/parser-recovery-2.rs:4:14 | @@ -13,18 +7,5 @@ LL | let x = foo(); LL | ) | ^ mismatched closing delimiter -error[E0425]: cannot find value `y` in this scope - --> $DIR/parser-recovery-2.rs:10:13 - | -LL | let x = y.; - | ^ not found in this scope - -error[E0425]: cannot find function `foo` in this scope - --> $DIR/parser-recovery-2.rs:5:17 - | -LL | let x = foo(); - | ^^^ not found in this scope - -error: aborting due to 4 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/parser/raw/too-many-hash.rs b/tests/ui/parser/raw/too-many-hash.rs new file mode 100644 index 000000000..f3d3b207f --- /dev/null +++ b/tests/ui/parser/raw/too-many-hash.rs @@ -0,0 +1,6 @@ +// ignore-tidy-linelength + +fn main() { + let s: &str = r################################################################################################################################################################################################################################################################"very raw"################################################################################################################################################################################################################################################################; + //~^ ERROR too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 +} diff --git a/tests/ui/parser/raw/too-many-hash.stderr b/tests/ui/parser/raw/too-many-hash.stderr new file mode 100644 index 000000000..29ec17842 --- /dev/null +++ b/tests/ui/parser/raw/too-many-hash.stderr @@ -0,0 +1,8 @@ +error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 + --> $DIR/too-many-hash.rs:4:19 + | +LL | ... = r################################################################################################################################################################################################################################################################"very raw"##############################################################################################################################################################################################################################################################... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/parser/recover-fn-ptr-with-generics.stderr b/tests/ui/parser/recover-fn-ptr-with-generics.stderr index 1da9c1857..069fcffe9 100644 --- a/tests/ui/parser/recover-fn-ptr-with-generics.stderr +++ b/tests/ui/parser/recover-fn-ptr-with-generics.stderr @@ -88,12 +88,6 @@ error: expected identifier, found `>` LL | type QuiteBroken = fn<const>(); | ^ expected identifier -error: lifetime bounds cannot be used in this context - --> $DIR/recover-fn-ptr-with-generics.rs:22:26 - | -LL | let _: extern fn<'a: 'static>(); - | ^^^^^^^ - error[E0412]: cannot find type `T` in this scope --> $DIR/recover-fn-ptr-with-generics.rs:5:27 | @@ -106,6 +100,12 @@ error[E0412]: cannot find type `T` in this scope LL | type Identity = fn<T>(T) -> T; | ^ not found in this scope +error: lifetime bounds cannot be used in this context + --> $DIR/recover-fn-ptr-with-generics.rs:22:26 + | +LL | let _: extern fn<'a: 'static>(); + | ^^^^^^^ + error: aborting due to 12 previous errors For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/parser/recover-quantified-closure.rs b/tests/ui/parser/recover-quantified-closure.rs index df22f5e06..10af39b70 100644 --- a/tests/ui/parser/recover-quantified-closure.rs +++ b/tests/ui/parser/recover-quantified-closure.rs @@ -7,6 +7,6 @@ fn main() { enum Foo { Bar } fn foo(x: impl Iterator<Item = Foo>) { for <Foo>::Bar in x {} - //~^ ERROR expected one of `const`, `move`, `static`, `|` + //~^ ERROR expected one of `move`, `static`, `|` //~^^ ERROR `for<...>` binders for closures are experimental } diff --git a/tests/ui/parser/recover-quantified-closure.stderr b/tests/ui/parser/recover-quantified-closure.stderr index 9ec4d2c03..39eec80f6 100644 --- a/tests/ui/parser/recover-quantified-closure.stderr +++ b/tests/ui/parser/recover-quantified-closure.stderr @@ -1,8 +1,8 @@ -error: expected one of `const`, `move`, `static`, `|`, or `||`, found `::` +error: expected one of `move`, `static`, `|`, or `||`, found `::` --> $DIR/recover-quantified-closure.rs:9:14 | LL | for <Foo>::Bar in x {} - | ^^ expected one of `const`, `move`, `static`, `|`, or `||` + | ^^ expected one of `move`, `static`, `|`, or `||` error[E0658]: `for<...>` binders for closures are experimental --> $DIR/recover-quantified-closure.rs:2:5 diff --git a/tests/ui/parser/recover-range-pats.stderr b/tests/ui/parser/recover-range-pats.stderr index c54f13e01..5b69ca5cd 100644 --- a/tests/ui/parser/recover-range-pats.stderr +++ b/tests/ui/parser/recover-range-pats.stderr @@ -314,7 +314,7 @@ error[E0308]: mismatched types LL | if let X.. .0 = 0 {} | - ^^ - this expression has type `u8` | | | - | | expected integer, found floating-point number + | | expected `u8`, found floating-point number | this is of type `u8` | = note: expected type `u8` @@ -351,7 +351,7 @@ error[E0308]: mismatched types LL | if let X..=.0 = 0 {} | - ^^ - this expression has type `u8` | | | - | | expected integer, found floating-point number + | | expected `u8`, found floating-point number | this is of type `u8` | = note: expected type `u8` @@ -388,7 +388,7 @@ error[E0308]: mismatched types LL | if let X... .0 = 0 {} | - ^^ - this expression has type `u8` | | | - | | expected integer, found floating-point number + | | expected `u8`, found floating-point number | this is of type `u8` | = note: expected type `u8` diff --git a/tests/ui/parser/suggest_misplaced_generics/enum.fixed b/tests/ui/parser/suggest_misplaced_generics/enum.fixed new file mode 100644 index 000000000..3332118a1 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/enum.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +enum Foo<T> { Variant(T) } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the enum name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/enum.rs b/tests/ui/parser/suggest_misplaced_generics/enum.rs new file mode 100644 index 000000000..5a2289c5c --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/enum.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +enum<T> Foo { Variant(T) } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the enum name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/enum.stderr b/tests/ui/parser/suggest_misplaced_generics/enum.stderr new file mode 100644 index 000000000..5f5947627 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/enum.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/enum.rs:5:5 + | +LL | enum<T> Foo { Variant(T) } + | ^ expected identifier + | +help: place the generic parameter name after the enum name + | +LL - enum<T> Foo { Variant(T) } +LL + enum Foo<T> { Variant(T) } + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/existing_generics.rs b/tests/ui/parser/suggest_misplaced_generics/existing_generics.rs new file mode 100644 index 000000000..1dc182398 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/existing_generics.rs @@ -0,0 +1,9 @@ +// Issue: 103366 +// there is already an existing generic on f, so don't show a suggestion + +#[allow(unused)] +fn<'a, B: 'a + std::ops::Add<Output = u32>> f<T>(_x: B) { } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr b/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr new file mode 100644 index 000000000..89716e6f1 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/existing_generics.stderr @@ -0,0 +1,10 @@ +error: expected identifier, found `<` + --> $DIR/existing_generics.rs:5:3 + | +LL | fn<'a, B: 'a + std::ops::Add<Output = u32>> f<T>(_x: B) { } + | ^ expected identifier + | + = help: place the generic parameter name after the fn name + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.fixed b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.fixed new file mode 100644 index 000000000..84bf64bd6 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +fn f<'a, B: 'a + std::ops::Add<Output = u32>>(_x: B) { } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.rs b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.rs new file mode 100644 index 000000000..d0684397e --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +fn<'a, B: 'a + std::ops::Add<Output = u32>> f(_x: B) { } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr new file mode 100644 index 000000000..061d0910a --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-complex-generics.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/fn-complex-generics.rs:5:3 + | +LL | fn<'a, B: 'a + std::ops::Add<Output = u32>> f(_x: B) { } + | ^ expected identifier + | +help: place the generic parameter name after the fn name + | +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 + diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.rs b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.rs new file mode 100644 index 000000000..7fcb6a82c --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.rs @@ -0,0 +1,8 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// The generics fail to parse here, so don't make any suggestions/help + +#[allow(unused)] +fn<~>()> id(x: T) -> T { x } +//~^ ERROR expected identifier, found `<` + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr new file mode 100644 index 000000000..47e120169 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-invalid-generics.stderr @@ -0,0 +1,8 @@ +error: expected identifier, found `<` + --> $DIR/fn-invalid-generics.rs:5:3 + | +LL | fn<~>()> id(x: T) -> T { x } + | ^ expected identifier + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-simple.fixed b/tests/ui/parser/suggest_misplaced_generics/fn-simple.fixed new file mode 100644 index 000000000..cbfd5f2d3 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-simple.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +fn id<T>(x: T) -> T { x } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-simple.rs b/tests/ui/parser/suggest_misplaced_generics/fn-simple.rs new file mode 100644 index 000000000..b207cf70d --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-simple.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +fn<T> id(x: T) -> T { x } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the fn name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr b/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr new file mode 100644 index 000000000..e749f1a0d --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/fn-simple.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/fn-simple.rs:5:3 + | +LL | fn<T> id(x: T) -> T { x } + | ^ expected identifier + | +help: place the generic parameter name after the fn name + | +LL - fn<T> id(x: T) -> T { x } +LL + fn id<T>(x: T) -> T { x } + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/struct.fixed b/tests/ui/parser/suggest_misplaced_generics/struct.fixed new file mode 100644 index 000000000..fec05bdec --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/struct.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +struct Foo<T> { x: T } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the struct name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/struct.rs b/tests/ui/parser/suggest_misplaced_generics/struct.rs new file mode 100644 index 000000000..6b80150d5 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/struct.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +struct<T> Foo { x: T } +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the struct name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/struct.stderr b/tests/ui/parser/suggest_misplaced_generics/struct.stderr new file mode 100644 index 000000000..2b6509070 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/struct.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/struct.rs:5:7 + | +LL | struct<T> Foo { x: T } + | ^ expected identifier + | +help: place the generic parameter name after the struct name + | +LL - struct<T> Foo { x: T } +LL + struct Foo<T> { x: T } + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/trait.fixed b/tests/ui/parser/suggest_misplaced_generics/trait.fixed new file mode 100644 index 000000000..a471a078a --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/trait.fixed @@ -0,0 +1,11 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +trait Foo<T> { + //~^ ERROR expected identifier, found `<` + //~| HELP place the generic parameter name after the trait name +} + + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/trait.rs b/tests/ui/parser/suggest_misplaced_generics/trait.rs new file mode 100644 index 000000000..55355f451 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/trait.rs @@ -0,0 +1,11 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +trait<T> Foo { + //~^ ERROR expected identifier, found `<` + //~| HELP place the generic parameter name after the trait name +} + + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/trait.stderr b/tests/ui/parser/suggest_misplaced_generics/trait.stderr new file mode 100644 index 000000000..ac86cfa46 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/trait.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/trait.rs:5:6 + | +LL | trait<T> Foo { + | ^ expected identifier + | +help: place the generic parameter name after the trait name + | +LL - trait<T> Foo { +LL + trait Foo<T> { + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/suggest_misplaced_generics/type.fixed b/tests/ui/parser/suggest_misplaced_generics/type.fixed new file mode 100644 index 000000000..a97b9e66d --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/type.fixed @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +type Foo<T> = T; +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the type name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/type.rs b/tests/ui/parser/suggest_misplaced_generics/type.rs new file mode 100644 index 000000000..17e200536 --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/type.rs @@ -0,0 +1,9 @@ +// Issue: 103366 , Suggest fix for misplaced generic params +// run-rustfix + +#[allow(unused)] +type<T> Foo = T; +//~^ ERROR expected identifier, found `<` +//~| HELP place the generic parameter name after the type name + +fn main() {} diff --git a/tests/ui/parser/suggest_misplaced_generics/type.stderr b/tests/ui/parser/suggest_misplaced_generics/type.stderr new file mode 100644 index 000000000..22744f6cf --- /dev/null +++ b/tests/ui/parser/suggest_misplaced_generics/type.stderr @@ -0,0 +1,14 @@ +error: expected identifier, found `<` + --> $DIR/type.rs:5:5 + | +LL | type<T> Foo = T; + | ^ expected identifier + | +help: place the generic parameter name after the type name + | +LL - type<T> Foo = T; +LL + type Foo<T> = T; + | + +error: aborting due to previous error + diff --git a/tests/ui/parser/trait-object-delimiters.rs b/tests/ui/parser/trait-object-delimiters.rs index cc04ac052..c41cda187 100644 --- a/tests/ui/parser/trait-object-delimiters.rs +++ b/tests/ui/parser/trait-object-delimiters.rs @@ -5,6 +5,8 @@ fn foo1(_: &dyn Drop + AsRef<str>) {} //~ ERROR ambiguous `+` in a type fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds +fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds + fn foo3(_: &dyn {Drop + AsRef<str>}) {} //~ ERROR expected parameter name, found `{` //~^ ERROR expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{` //~| ERROR at least one trait is required for an object type diff --git a/tests/ui/parser/trait-object-delimiters.stderr b/tests/ui/parser/trait-object-delimiters.stderr index 99c451545..ccce3a805 100644 --- a/tests/ui/parser/trait-object-delimiters.stderr +++ b/tests/ui/parser/trait-object-delimiters.stderr @@ -13,17 +13,29 @@ LL | fn foo2(_: &dyn (Drop + AsRef<str>)) {} help: remove 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 + --> $DIR/trait-object-delimiters.rs:8:25 + | +LL | fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} + | ^ ^ + | +help: remove the parentheses + | +LL - fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} +LL + fn foo2_no_space(_: &dyn Drop + AsRef<str>) {} | error: expected parameter name, found `{` - --> $DIR/trait-object-delimiters.rs:8:17 + --> $DIR/trait-object-delimiters.rs:10:17 | LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {} | ^ expected parameter name error: expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{` - --> $DIR/trait-object-delimiters.rs:8:17 + --> $DIR/trait-object-delimiters.rs:10:17 | LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {} | -^ expected one of 10 possible tokens @@ -31,13 +43,13 @@ LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {} | help: missing `,` error: expected identifier, found `<` - --> $DIR/trait-object-delimiters.rs:12:17 + --> $DIR/trait-object-delimiters.rs:14:17 | LL | fn foo4(_: &dyn <Drop + AsRef<str>>) {} | ^ expected identifier error: invalid `dyn` keyword - --> $DIR/trait-object-delimiters.rs:14:25 + --> $DIR/trait-object-delimiters.rs:16:25 | LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {} | ^^^ help: remove this keyword @@ -56,13 +68,13 @@ LL | fn foo1(_: &dyn Drop + AsRef<str>) {} = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> error[E0224]: at least one trait is required for an object type - --> $DIR/trait-object-delimiters.rs:8:13 + --> $DIR/trait-object-delimiters.rs:10:13 | LL | fn foo3(_: &dyn {Drop + AsRef<str>}) {} | ^^^ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/trait-object-delimiters.rs:14:29 + --> $DIR/trait-object-delimiters.rs:16:29 | LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {} | ---- ^^^^^^^^^^ additional non-auto trait @@ -72,7 +84,7 @@ LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {} = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits> -error: aborting due to 9 previous errors +error: aborting due to 10 previous errors Some errors have detailed explanations: E0224, E0225. For more information about an error, try `rustc --explain E0224`. diff --git a/tests/ui/parser/type-ascription-in-pattern.rs b/tests/ui/parser/type-ascription-in-pattern.rs new file mode 100644 index 000000000..fec168afb --- /dev/null +++ b/tests/ui/parser/type-ascription-in-pattern.rs @@ -0,0 +1,16 @@ +fn foo(x: bool) -> i32 { + match x { + x: i32 => x, //~ ERROR expected + //~^ ERROR mismatched types + true => 42., + false => 0.333, + } +} + +fn main() { + match foo(true) { + 42: i32 => (), //~ ERROR expected + _: f64 => (), //~ ERROR expected + x: i32 => (), //~ ERROR expected + } +} diff --git a/tests/ui/parser/type-ascription-in-pattern.stderr b/tests/ui/parser/type-ascription-in-pattern.stderr new file mode 100644 index 000000000..091907549 --- /dev/null +++ b/tests/ui/parser/type-ascription-in-pattern.stderr @@ -0,0 +1,54 @@ +error: expected one of `@` or `|`, found `:` + --> $DIR/type-ascription-in-pattern.rs:3:10 + | +LL | x: i32 => x, + | ^ --- specifying the type of a pattern isn't supported + | | + | expected one of `@` or `|` + | +help: maybe write a path separator here + | +LL | x::i32 => x, + | ~~ + +error: expected one of `...`, `..=`, `..`, or `|`, found `:` + --> $DIR/type-ascription-in-pattern.rs:12:11 + | +LL | 42: i32 => (), + | ^ --- specifying the type of a pattern isn't supported + | | + | expected one of `...`, `..=`, `..`, or `|` + +error: expected `|`, found `:` + --> $DIR/type-ascription-in-pattern.rs:13:10 + | +LL | _: f64 => (), + | ^ --- specifying the type of a pattern isn't supported + | | + | expected `|` + +error: expected one of `@` or `|`, found `:` + --> $DIR/type-ascription-in-pattern.rs:14:10 + | +LL | x: i32 => (), + | ^ --- specifying the type of a pattern isn't supported + | | + | expected one of `@` or `|` + | +help: maybe write a path separator here + | +LL | x::i32 => (), + | ~~ + +error[E0308]: mismatched types + --> $DIR/type-ascription-in-pattern.rs:3:19 + | +LL | fn foo(x: bool) -> i32 { + | --- expected `i32` because of return type +LL | match x { +LL | x: i32 => x, + | ^ expected `i32`, found `bool` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.rs b/tests/ui/parser/unclosed-delimiter-in-dep.rs index 6db1b66e9..4de83ee64 100644 --- a/tests/ui/parser/unclosed-delimiter-in-dep.rs +++ b/tests/ui/parser/unclosed-delimiter-in-dep.rs @@ -2,5 +2,4 @@ mod unclosed_delim_mod; fn main() { let _: usize = unclosed_delim_mod::new(); - //~^ ERROR mismatched types } diff --git a/tests/ui/parser/unclosed-delimiter-in-dep.stderr b/tests/ui/parser/unclosed-delimiter-in-dep.stderr index 1366ef1bb..a46d020b9 100644 --- a/tests/ui/parser/unclosed-delimiter-in-dep.stderr +++ b/tests/ui/parser/unclosed-delimiter-in-dep.stderr @@ -9,17 +9,5 @@ LL | } LL | } | ^ mismatched closing delimiter -error[E0308]: mismatched types - --> $DIR/unclosed-delimiter-in-dep.rs:4:20 - | -LL | let _: usize = unclosed_delim_mod::new(); - | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `usize`, found enum `Result` - | | - | expected due to this - | - = note: expected type `usize` - found enum `Result<Value, ()>` - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/parser/use-unclosed-brace.rs b/tests/ui/parser/use-unclosed-brace.rs index 41742f37f..fcfe95b26 100644 --- a/tests/ui/parser/use-unclosed-brace.rs +++ b/tests/ui/parser/use-unclosed-brace.rs @@ -1,6 +1,4 @@ -// error-pattern: expected one of `,`, `::`, `as`, or `}`, found `;` // error-pattern: this file contains an unclosed delimiter -// error-pattern: expected item, found `}` use foo::{bar, baz; use std::fmt::Display; diff --git a/tests/ui/parser/use-unclosed-brace.stderr b/tests/ui/parser/use-unclosed-brace.stderr index 438fe9c47..ad5bb2de1 100644 --- a/tests/ui/parser/use-unclosed-brace.stderr +++ b/tests/ui/parser/use-unclosed-brace.stderr @@ -1,5 +1,5 @@ error: this file contains an unclosed delimiter - --> $DIR/use-unclosed-brace.rs:12:14 + --> $DIR/use-unclosed-brace.rs:10:14 | LL | use foo::{bar, baz; | - unclosed delimiter @@ -7,21 +7,5 @@ LL | use foo::{bar, baz; LL | fn main() {} | ^ -error: expected one of `,`, `::`, `as`, or `}`, found `;` - --> $DIR/use-unclosed-brace.rs:4:10 - | -LL | use foo::{bar, baz; - | ^ ^ - | | | - | | expected one of `,`, `::`, `as`, or `}` - | | help: `}` may belong here - | unclosed delimiter - -error: expected item, found `}` - --> $DIR/use-unclosed-brace.rs:12:14 - | -LL | fn main() {} - | ^ expected item - -error: aborting due to 3 previous errors +error: aborting due to previous error |