summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/issues
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
commit023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch)
tree60fc59477c605c72b0a1051409062ddecc43f877 /tests/ui/parser/issues
parentAdding debian version 1.72.1+dfsg1-1. (diff)
downloadrustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.tar.xz
rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/parser/issues')
-rw-r--r--tests/ui/parser/issues/issue-113203.rs7
-rw-r--r--tests/ui/parser/issues/issue-113203.stderr8
-rw-r--r--tests/ui/parser/issues/issue-114219.rs4
-rw-r--r--tests/ui/parser/issues/issue-114219.stderr8
-rw-r--r--tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs21
-rw-r--r--tests/ui/parser/issues/issue-22647.rs2
-rw-r--r--tests/ui/parser/issues/issue-22647.stderr9
-rw-r--r--tests/ui/parser/issues/issue-22712.rs2
-rw-r--r--tests/ui/parser/issues/issue-22712.stderr9
-rw-r--r--tests/ui/parser/issues/issue-70583-block-is-empty-2.rs8
-rw-r--r--tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr3
11 files changed, 72 insertions, 9 deletions
diff --git a/tests/ui/parser/issues/issue-113203.rs b/tests/ui/parser/issues/issue-113203.rs
new file mode 100644
index 000000000..1103251c1
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113203.rs
@@ -0,0 +1,7 @@
+// Checks what happens when we attempt to use the await keyword as a prefix. Span
+// incorrectly emitted an `.await` in E0277 which does not exist
+// edition:2018
+fn main() {
+ await {}()
+ //~^ ERROR incorrect use of `await`
+}
diff --git a/tests/ui/parser/issues/issue-113203.stderr b/tests/ui/parser/issues/issue-113203.stderr
new file mode 100644
index 000000000..97304a89c
--- /dev/null
+++ b/tests/ui/parser/issues/issue-113203.stderr
@@ -0,0 +1,8 @@
+error: incorrect use of `await`
+ --> $DIR/issue-113203.rs:5:5
+ |
+LL | await {}()
+ | ^^^^^^^^ help: `await` is a postfix operation: `{}.await`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-114219.rs b/tests/ui/parser/issues/issue-114219.rs
new file mode 100644
index 000000000..332258b62
--- /dev/null
+++ b/tests/ui/parser/issues/issue-114219.rs
@@ -0,0 +1,4 @@
+fn main() {
+ async move {};
+ //~^ ERROR `async move` blocks are only allowed in Rust 2018 or later
+}
diff --git a/tests/ui/parser/issues/issue-114219.stderr b/tests/ui/parser/issues/issue-114219.stderr
new file mode 100644
index 000000000..90dcdc427
--- /dev/null
+++ b/tests/ui/parser/issues/issue-114219.stderr
@@ -0,0 +1,8 @@
+error: `async move` blocks are only allowed in Rust 2018 or later
+ --> $DIR/issue-114219.rs:2:5
+ |
+LL | async move {};
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs b/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs
new file mode 100644
index 000000000..3421333b8
--- /dev/null
+++ b/tests/ui/parser/issues/issue-115780-pat-lt-bracket-in-macro-call.rs
@@ -0,0 +1,21 @@
+// Regression test for issue #115780.
+// Ensure that we don't emit a parse error for the token sequence `Ident "<" Ty` in pattern position
+// if we are inside a macro call since it can be valid input for a subsequent macro rule.
+// See also #103534.
+
+// check-pass
+
+macro_rules! mdo {
+ ($p: pat =<< $e: expr ; $( $t: tt )*) => {
+ $e.and_then(|$p| mdo! { $( $t )* })
+ };
+ (ret<$ty: ty> $e: expr;) => { Some::<$ty>($e) };
+}
+
+fn main() {
+ mdo! {
+ x_val =<< Some(0);
+ y_val =<< Some(1);
+ ret<(i32, i32)> (x_val, y_val);
+ };
+}
diff --git a/tests/ui/parser/issues/issue-22647.rs b/tests/ui/parser/issues/issue-22647.rs
index a68614106..163cbc69d 100644
--- a/tests/ui/parser/issues/issue-22647.rs
+++ b/tests/ui/parser/issues/issue-22647.rs
@@ -1,5 +1,5 @@
fn main() {
- let caller<F> = |f: F| //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+ let caller<F> = |f: F| //~ ERROR generic args in patterns require the turbofish syntax
where F: Fn() -> i32
{
let x = f();
diff --git a/tests/ui/parser/issues/issue-22647.stderr b/tests/ui/parser/issues/issue-22647.stderr
index 89b454d19..585e70266 100644
--- a/tests/ui/parser/issues/issue-22647.stderr
+++ b/tests/ui/parser/issues/issue-22647.stderr
@@ -1,8 +1,13 @@
-error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+error: generic args in patterns require the turbofish syntax
--> $DIR/issue-22647.rs:2:15
|
LL | let caller<F> = |f: F|
- | ^ expected one of `:`, `;`, `=`, `@`, or `|`
+ | ^
+ |
+help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
+ |
+LL | let caller::<F> = |f: F|
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-22712.rs b/tests/ui/parser/issues/issue-22712.rs
index 774de9c7e..92b12b8e1 100644
--- a/tests/ui/parser/issues/issue-22712.rs
+++ b/tests/ui/parser/issues/issue-22712.rs
@@ -3,7 +3,7 @@ struct Foo<B> {
}
fn bar() {
- let Foo<Vec<u8>> //~ ERROR expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+ let Foo<Vec<u8>> //~ ERROR generic args in patterns require the turbofish syntax
}
fn main() {}
diff --git a/tests/ui/parser/issues/issue-22712.stderr b/tests/ui/parser/issues/issue-22712.stderr
index 30fabac65..7f9d99d8e 100644
--- a/tests/ui/parser/issues/issue-22712.stderr
+++ b/tests/ui/parser/issues/issue-22712.stderr
@@ -1,8 +1,13 @@
-error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<`
+error: generic args in patterns require the turbofish syntax
--> $DIR/issue-22712.rs:6:12
|
LL | let Foo<Vec<u8>>
- | ^ expected one of `:`, `;`, `=`, `@`, or `|`
+ | ^
+ |
+help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments
+ |
+LL | let Foo::<Vec<u8>>
+ | ++
error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs b/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs
index 80f53338a..92ff0ef64 100644
--- a/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs
+++ b/tests/ui/parser/issues/issue-70583-block-is-empty-2.rs
@@ -6,9 +6,13 @@ pub enum ErrorHandled {
impl ErrorHandled {
pub fn assert_reported(self) {
match self {
+ //~^ NOTE this delimiter might not be properly closed...
ErrorHandled::Reported => {}}
- //^~ ERROR block is empty, you might have not meant to close it
+ //~^ NOTE block is empty, you might have not meant to close it
+ //~| NOTE as it matches this but it has different indentation
ErrorHandled::TooGeneric => panic!(),
}
}
-} //~ ERROR unexpected closing delimiter: `}`
+}
+//~^ ERROR unexpected closing delimiter: `}`
+//~| NOTE unexpected closing delimiter
diff --git a/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr b/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr
index 9ae94c701..c590e04bb 100644
--- a/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr
+++ b/tests/ui/parser/issues/issue-70583-block-is-empty-2.stderr
@@ -1,8 +1,9 @@
error: unexpected closing delimiter: `}`
- --> $DIR/issue-70583-block-is-empty-2.rs:14:1
+ --> $DIR/issue-70583-block-is-empty-2.rs:16:1
|
LL | match self {
| - this delimiter might not be properly closed...
+LL |
LL | ErrorHandled::Reported => {}}
| --- ...as it matches this but it has different indentation
| |