summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/issues
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/issues')
-rw-r--r--tests/ui/parser/issues/issue-111148.rs2
-rw-r--r--tests/ui/parser/issues/issue-111148.stderr8
-rw-r--r--tests/ui/parser/issues/issue-111416.rs3
-rw-r--r--tests/ui/parser/issues/issue-111416.stderr18
-rw-r--r--tests/ui/parser/issues/issue-33418.fixed19
-rw-r--r--tests/ui/parser/issues/issue-33418.rs8
-rw-r--r--tests/ui/parser/issues/issue-33418.stderr38
-rw-r--r--tests/ui/parser/issues/issue-35813-postfix-after-cast.rs78
-rw-r--r--tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr338
-rw-r--r--tests/ui/parser/issues/issue-44406.rs1
-rw-r--r--tests/ui/parser/issues/issue-44406.stderr13
-rw-r--r--tests/ui/parser/issues/issue-62913.rs2
-rw-r--r--tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed9
-rw-r--r--tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs3
-rw-r--r--tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr32
-rw-r--r--tests/ui/parser/issues/issue-91461.rs5
-rw-r--r--tests/ui/parser/issues/issue-91461.stderr25
17 files changed, 257 insertions, 345 deletions
diff --git a/tests/ui/parser/issues/issue-111148.rs b/tests/ui/parser/issues/issue-111148.rs
new file mode 100644
index 000000000..2502beab4
--- /dev/null
+++ b/tests/ui/parser/issues/issue-111148.rs
@@ -0,0 +1,2 @@
+fn a<<i<Y<w<>#
+//~^ ERROR expected one of `#`, `>`, `const`, identifier, or lifetime, found `<`
diff --git a/tests/ui/parser/issues/issue-111148.stderr b/tests/ui/parser/issues/issue-111148.stderr
new file mode 100644
index 000000000..e6595a5cb
--- /dev/null
+++ b/tests/ui/parser/issues/issue-111148.stderr
@@ -0,0 +1,8 @@
+error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `<`
+ --> $DIR/issue-111148.rs:1:6
+ |
+LL | fn a<<i<Y<w<>#
+ | ^ expected one of `#`, `>`, `const`, identifier, or lifetime
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-111416.rs b/tests/ui/parser/issues/issue-111416.rs
new file mode 100644
index 000000000..cfd1b6b99
--- /dev/null
+++ b/tests/ui/parser/issues/issue-111416.rs
@@ -0,0 +1,3 @@
+fn main() {
+ let my = monad_bind(mx, T: Try); //~ ERROR invalid `struct` delimiters or `fn` call arguments
+}
diff --git a/tests/ui/parser/issues/issue-111416.stderr b/tests/ui/parser/issues/issue-111416.stderr
new file mode 100644
index 000000000..ddacf4d6d
--- /dev/null
+++ b/tests/ui/parser/issues/issue-111416.stderr
@@ -0,0 +1,18 @@
+error: invalid `struct` delimiters or `fn` call arguments
+ --> $DIR/issue-111416.rs:2:14
+ |
+LL | let my = monad_bind(mx, T: Try);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: if `monad_bind` is a struct, use braces as delimiters
+ |
+LL | let my = monad_bind { mx, T: Try };
+ | ~ ~
+help: if `monad_bind` is a function, use the arguments directly
+ |
+LL - let my = monad_bind(mx, T: Try);
+LL + let my = monad_bind(mx, Try);
+ |
+
+error: aborting due to previous error
+
diff --git a/tests/ui/parser/issues/issue-33418.fixed b/tests/ui/parser/issues/issue-33418.fixed
deleted file mode 100644
index ed885ae14..000000000
--- a/tests/ui/parser/issues/issue-33418.fixed
+++ /dev/null
@@ -1,19 +0,0 @@
-// run-rustfix
-
-trait Tr {}
-//~^ ERROR negative bounds are not supported
-trait Tr2: SuperA {}
-//~^ ERROR negative bounds are not supported
-trait Tr3: SuperB {}
-//~^ ERROR negative bounds are not supported
-trait Tr4: SuperB + SuperD {}
-//~^ ERROR negative bounds are not supported
-trait Tr5 {}
-//~^ ERROR negative bounds are not supported
-
-trait SuperA {}
-trait SuperB {}
-trait SuperC {}
-trait SuperD {}
-
-fn main() {}
diff --git a/tests/ui/parser/issues/issue-33418.rs b/tests/ui/parser/issues/issue-33418.rs
index 9934284ab..4ebd5871e 100644
--- a/tests/ui/parser/issues/issue-33418.rs
+++ b/tests/ui/parser/issues/issue-33418.rs
@@ -1,5 +1,3 @@
-// run-rustfix
-
trait Tr: !SuperA {}
//~^ ERROR negative bounds are not supported
trait Tr2: SuperA + !SuperB {}
@@ -7,10 +5,12 @@ trait Tr2: SuperA + !SuperB {}
trait Tr3: !SuperA + SuperB {}
//~^ ERROR negative bounds are not supported
trait Tr4: !SuperA + SuperB
- + !SuperC + SuperD {}
+//~^ ERROR negative bounds are not supported
++ !SuperC + SuperD {}
//~^ ERROR negative bounds are not supported
trait Tr5: !SuperA
- + !SuperB {}
+//~^ ERROR negative bounds are not supported
++ !SuperB {}
//~^ ERROR negative bounds are not supported
trait SuperA {}
diff --git a/tests/ui/parser/issues/issue-33418.stderr b/tests/ui/parser/issues/issue-33418.stderr
index 9a8733e89..b111bcfd2 100644
--- a/tests/ui/parser/issues/issue-33418.stderr
+++ b/tests/ui/parser/issues/issue-33418.stderr
@@ -1,36 +1,44 @@
error: negative bounds are not supported
- --> $DIR/issue-33418.rs:3:9
+ --> $DIR/issue-33418.rs:1:11
|
LL | trait Tr: !SuperA {}
- | ^^^^^^^^^ negative bounds are not supported
+ | ^
error: negative bounds are not supported
- --> $DIR/issue-33418.rs:5:19
+ --> $DIR/issue-33418.rs:3:21
|
LL | trait Tr2: SuperA + !SuperB {}
- | ^^^^^^^^^ negative bounds are not supported
+ | ^
error: negative bounds are not supported
- --> $DIR/issue-33418.rs:7:10
+ --> $DIR/issue-33418.rs:5:12
|
LL | trait Tr3: !SuperA + SuperB {}
- | ^^^^^^^^^ negative bounds are not supported
+ | ^
error: negative bounds are not supported
- --> $DIR/issue-33418.rs:9:10
+ --> $DIR/issue-33418.rs:7:12
|
LL | trait Tr4: !SuperA + SuperB
- | ^^^^^^^^^
-LL | + !SuperC + SuperD {}
- | ^^^^^^^^^ negative bounds are not supported
+ | ^
error: negative bounds are not supported
- --> $DIR/issue-33418.rs:12:10
+ --> $DIR/issue-33418.rs:9:3
+ |
+LL | + !SuperC + SuperD {}
+ | ^
+
+error: negative bounds are not supported
+ --> $DIR/issue-33418.rs:11:12
|
LL | trait Tr5: !SuperA
- | ^^^^^^^^^
-LL | + !SuperB {}
- | ^^^^^^^^^ negative bounds are not supported
+ | ^
+
+error: negative bounds are not supported
+ --> $DIR/issue-33418.rs:13:3
+ |
+LL | + !SuperB {}
+ | ^
-error: aborting due to 5 previous errors
+error: aborting due to 7 previous errors
diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs b/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs
index 7bd4b3a16..3d110adef 100644
--- a/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs
+++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs
@@ -10,14 +10,14 @@ pub fn index_after_as_cast() {
vec![1, 2, 3] as Vec<i32>[0];
//~^ ERROR: cast cannot be followed by indexing
vec![1, 2, 3]: Vec<i32>[0];
- //~^ ERROR: type ascription cannot be followed by indexing
+ //~^ ERROR: expected one of
}
pub fn index_after_cast_to_index() {
(&[0]) as &[i32][0];
//~^ ERROR: cast cannot be followed by indexing
(&[0i32]): &[i32; 1][0];
- //~^ ERROR: type ascription cannot be followed by indexing
+ //~^ ERROR: expected one of
}
pub fn cast_after_cast() {
@@ -25,7 +25,7 @@ pub fn cast_after_cast() {
}
if 5u64: u64: u64 == 0u64 {
-
+ //~^ ERROR expected `{`, found `:`
}
let _ = 5u64: u64: u64 as u8 as i8 == 9i8;
let _ = 0i32: i32: i32;
@@ -36,26 +36,46 @@ pub fn cast_after_cast() {
}
pub fn cast_cast_method_call() {
- let _ = 0i32: i32: i32.count_ones();
- //~^ ERROR: type ascription cannot be followed by a method call
- let _ = 0 as i32: i32.count_ones();
- //~^ ERROR: type ascription cannot be followed by a method call
- let _ = 0i32: i32 as i32.count_ones();
- //~^ ERROR: cast cannot be followed by a method call
+ let _ = 0i32: i32: i32.count_ones(); //~ ERROR expected one of
+}
+
+pub fn cast_cast_method_call_2() {
+ let _ = 0 as i32: i32.count_ones(); //~ ERROR expected one of
+}
+
+pub fn cast_cast_method_call_3() {
+ let _ = 0i32: i32 as i32.count_ones(); //~ ERROR expected one of
+}
+
+pub fn cast_cast_method_call_4() {
let _ = 0 as i32 as i32.count_ones();
//~^ ERROR: cast cannot be followed by a method call
- let _ = 0i32: i32: i32 as u32 as i32.count_ones();
- //~^ ERROR: cast cannot be followed by a method call
- let _ = 0i32: i32.count_ones(): u32;
- //~^ ERROR: type ascription cannot be followed by a method call
- let _ = 0 as i32.count_ones(): u32;
+}
+
+pub fn cast_cast_method_call_5() {
+ let _ = 0i32: i32: i32 as u32 as i32.count_ones(); //~ ERROR expected one of
+}
+
+pub fn cast_cast_method_call_6() {
+ let _ = 0i32: i32.count_ones(): u32; //~ ERROR expected one of
+}
+
+pub fn cast_cast_method_call_7() {
+ let _ = 0 as i32.count_ones(): u32; //~ ERROR expected one of
//~^ ERROR: cast cannot be followed by a method call
- let _ = 0i32: i32.count_ones() as u32;
- //~^ ERROR: type ascription cannot be followed by a method call
+}
+
+pub fn cast_cast_method_call_8() {
+ let _ = 0i32: i32.count_ones() as u32; //~ ERROR expected one of
+}
+
+pub fn cast_cast_method_call_9() {
let _ = 0 as i32.count_ones() as u32;
//~^ ERROR: cast cannot be followed by a method call
- let _ = 0i32: i32: i32.count_ones() as u32 as i32;
- //~^ ERROR: type ascription cannot be followed by a method call
+}
+
+pub fn cast_cast_method_call_10() {
+ let _ = 0i32: i32: i32.count_ones() as u32 as i32; //~ ERROR expected one of
}
pub fn multiline_error() {
@@ -74,8 +94,7 @@ pub fn precedence() {
pub fn method_calls() {
0 as i32.max(0);
//~^ ERROR: cast cannot be followed by a method call
- 0: i32.max(0);
- //~^ ERROR: type ascription cannot be followed by a method call
+ 0: i32.max(0); //~ ERROR expected one of
}
pub fn complex() {
@@ -84,7 +103,7 @@ pub fn complex() {
if true { 33 } else { 44 } as i32.max(0),
//~^ ERROR: cast cannot be followed by a method call
if true { 33 } else { 44 }: i32.max(0)
- //~^ ERROR: type ascription cannot be followed by a method call
+ //~^ ERROR: expected one of
);
}
@@ -93,7 +112,7 @@ pub fn in_condition() {
//~^ ERROR: cast cannot be followed by a method call
}
if 5u64: u64.max(0) == 0 {
- //~^ ERROR: type ascription cannot be followed by a method call
+ //~^ ERROR: expected `{`, found `:`
}
}
@@ -104,7 +123,7 @@ pub fn inside_block() {
} else { false };
let _ = if true {
5u64: u64.max(0) == 0
- //~^ ERROR: type ascription cannot be followed by a method call
+ //~^ ERROR: expected one of
} else { false };
}
@@ -112,14 +131,14 @@ static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
//~^ ERROR: cast cannot be followed by indexing
static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
-//~^ ERROR: type ascription cannot be followed by indexing
+//~^ ERROR: expected one of
pub fn cast_then_try() -> Result<u64,u64> {
Err(0u64) as Result<u64,u64>?;
//~^ ERROR: cast cannot be followed by `?`
Err(0u64): Result<u64,u64>?;
- //~^ ERROR: type ascription cannot be followed by `?`
+ //~^ ERROR: expected one of
Ok(1)
}
@@ -131,13 +150,14 @@ pub fn cast_then_call() {
drop as F();
//~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214]
drop_ptr: F();
- //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214]
+ //~^ ERROR: expected identifier, found `:`
}
pub fn cast_to_fn_should_work() {
let drop_ptr = drop as fn(u8);
drop as fn(u8);
drop_ptr: fn(u8);
+ //~^ ERROR expected one of
}
pub fn parens_after_cast_error() {
@@ -145,7 +165,7 @@ pub fn parens_after_cast_error() {
drop as fn(u8)(0);
//~^ ERROR: cast cannot be followed by a function call
drop_ptr: fn(u8)(0);
- //~^ ERROR: type ascription cannot be followed by a function call
+ //~^ ERROR: expected one of
}
pub async fn cast_then_await() {
@@ -153,7 +173,7 @@ pub async fn cast_then_await() {
//~^ ERROR: cast cannot be followed by `.await`
Box::pin(noop()): Pin<Box<_>>.await;
- //~^ ERROR: type ascription cannot be followed by `.await`
+ //~^ ERROR: expected one of
}
pub async fn noop() {}
@@ -167,5 +187,5 @@ pub fn struct_field() {
Foo::default() as Foo.bar;
//~^ ERROR: cannot be followed by a field access
Foo::default(): Foo.bar;
- //~^ ERROR: type ascription cannot be followed by a field access
+ //~^ ERROR expected one of
}
diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr
index 0c328bde2..d313c888e 100644
--- a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr
+++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr
@@ -9,21 +9,11 @@ help: try surrounding the expression in parentheses
LL | (vec![1, 2, 3] as Vec<i32>)[0];
| + +
-error: type ascription cannot be followed by indexing
- --> $DIR/issue-35813-postfix-after-cast.rs:12:5
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:12:18
|
LL | vec![1, 2, 3]: Vec<i32>[0];
- | ^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | (vec![1, 2, 3]: Vec<i32>)[0];
- | + +
-help: alternatively, remove the type ascription
- |
-LL - vec![1, 2, 3]: Vec<i32>[0];
-LL + vec![1, 2, 3][0];
- |
+ | ^ expected one of `.`, `;`, `?`, `}`, or an operator
error: cast cannot be followed by indexing
--> $DIR/issue-35813-postfix-after-cast.rs:17:5
@@ -36,67 +26,50 @@ help: try surrounding the expression in parentheses
LL | ((&[0]) as &[i32])[0];
| + +
-error: type ascription cannot be followed by indexing
- --> $DIR/issue-35813-postfix-after-cast.rs:19:5
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:19:14
|
LL | (&[0i32]): &[i32; 1][0];
- | ^^^^^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
+ | ^ expected one of `.`, `;`, `?`, `}`, or an operator
+
+error: expected `{`, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:27:12
|
-LL | ((&[0i32]): &[i32; 1])[0];
- | + +
-help: alternatively, remove the type ascription
+LL | if 5u64: u64: u64 == 0u64 {
+ | ^ expected `{`
|
-LL - (&[0i32]): &[i32; 1][0];
-LL + (&[0i32])[0];
+note: the `if` expression is missing a block after this condition
+ --> $DIR/issue-35813-postfix-after-cast.rs:27:8
|
+LL | if 5u64: u64: u64 == 0u64 {
+ | ^^^^
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:39:13
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:39:17
|
LL | let _ = 0i32: i32: i32.count_ones();
- | ^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | let _ = (0i32: i32: i32).count_ones();
- | + +
-help: alternatively, remove the type ascription
- |
-LL - let _ = 0i32: i32: i32.count_ones();
-LL + let _ = 0i32: i32.count_ones();
+ | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:41:13
+error: expected one of `!`, `(`, `.`, `::`, `;`, `<`, `?`, or `else`, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:43:21
|
LL | let _ = 0 as i32: i32.count_ones();
- | ^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | let _ = (0 as i32: i32).count_ones();
- | + +
-help: alternatively, remove the type ascription
- |
-LL - let _ = 0 as i32: i32.count_ones();
-LL + let _ = 0 as i32.count_ones();
+ | ^ expected one of 8 possible tokens
|
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
-error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:43:13
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:47:17
|
LL | let _ = 0i32: i32 as i32.count_ones();
- | ^^^^^^^^^^^^^^^^
+ | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
-help: try surrounding the expression in parentheses
- |
-LL | let _ = (0i32: i32 as i32).count_ones();
- | + +
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:45:13
+ --> $DIR/issue-35813-postfix-after-cast.rs:51:13
|
LL | let _ = 0 as i32 as i32.count_ones();
| ^^^^^^^^^^^^^^^
@@ -106,35 +79,24 @@ help: try surrounding the expression in parentheses
LL | let _ = (0 as i32 as i32).count_ones();
| + +
-error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:47:13
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:56:17
|
LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
+ | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
-LL | let _ = (0i32: i32: i32 as u32 as i32).count_ones();
- | + +
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:49:13
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:60:17
|
LL | let _ = 0i32: i32.count_ones(): u32;
- | ^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | let _ = (0i32: i32).count_ones(): u32;
- | + +
-help: alternatively, remove the type ascription
- |
-LL - let _ = 0i32: i32.count_ones(): u32;
-LL + let _ = 0i32.count_ones(): u32;
+ | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:51:13
+ --> $DIR/issue-35813-postfix-after-cast.rs:64:13
|
LL | let _ = 0 as i32.count_ones(): u32;
| ^^^^^^^^
@@ -144,24 +106,24 @@ help: try surrounding the expression in parentheses
LL | let _ = (0 as i32).count_ones(): u32;
| + +
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:53:13
+error: expected one of `.`, `;`, `?`, or `else`, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:64:34
|
-LL | let _ = 0i32: i32.count_ones() as u32;
- | ^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
+LL | let _ = 0 as i32.count_ones(): u32;
+ | ^ expected one of `.`, `;`, `?`, or `else`
|
-LL | let _ = (0i32: i32).count_ones() as u32;
- | + +
-help: alternatively, remove the type ascription
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
+
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:69:17
|
-LL - let _ = 0i32: i32.count_ones() as u32;
-LL + let _ = 0i32.count_ones() as u32;
+LL | let _ = 0i32: i32.count_ones() as u32;
+ | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:55:13
+ --> $DIR/issue-35813-postfix-after-cast.rs:73:13
|
LL | let _ = 0 as i32.count_ones() as u32;
| ^^^^^^^^
@@ -171,24 +133,16 @@ help: try surrounding the expression in parentheses
LL | let _ = (0 as i32).count_ones() as u32;
| + +
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:57:13
+error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:78:17
|
LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32;
- | ^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | let _ = (0i32: i32: i32).count_ones() as u32 as i32;
- | + +
-help: alternatively, remove the type ascription
- |
-LL - let _ = 0i32: i32: i32.count_ones() as u32 as i32;
-LL + let _ = 0i32: i32.count_ones() as u32 as i32;
+ | ^ expected one of `.`, `;`, `?`, `else`, or an operator
|
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:62:13
+ --> $DIR/issue-35813-postfix-after-cast.rs:82:13
|
LL | let _ = 0
| _____________^
@@ -202,7 +156,7 @@ LL ~ as i32)
|
error: cast cannot be followed by indexing
- --> $DIR/issue-35813-postfix-after-cast.rs:70:18
+ --> $DIR/issue-35813-postfix-after-cast.rs:90:18
|
LL | let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -213,7 +167,7 @@ LL | let x: i32 = (&vec![1, 2, 3] as &Vec<i32>)[0];
| + +
error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:75:5
+ --> $DIR/issue-35813-postfix-after-cast.rs:95:5
|
LL | 0 as i32.max(0);
| ^^^^^^^^
@@ -223,24 +177,14 @@ help: try surrounding the expression in parentheses
LL | (0 as i32).max(0);
| + +
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:77:5
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:97:6
|
LL | 0: i32.max(0);
- | ^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | (0: i32).max(0);
- | + +
-help: alternatively, remove the type ascription
- |
-LL - 0: i32.max(0);
-LL + 0.max(0);
- |
+ | ^ expected one of `.`, `;`, `?`, `}`, or an operator
error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:92:8
+ --> $DIR/issue-35813-postfix-after-cast.rs:111:8
|
LL | if 5u64 as i32.max(0) == 0 {
| ^^^^^^^^^^^
@@ -250,24 +194,20 @@ help: try surrounding the expression in parentheses
LL | if (5u64 as i32).max(0) == 0 {
| + +
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:95:8
+error: expected `{`, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:114:12
|
LL | if 5u64: u64.max(0) == 0 {
- | ^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | if (5u64: u64).max(0) == 0 {
- | + +
-help: alternatively, remove the type ascription
+ | ^ expected `{`
|
-LL - if 5u64: u64.max(0) == 0 {
-LL + if 5u64.max(0) == 0 {
+note: the `if` expression is missing a block after this condition
+ --> $DIR/issue-35813-postfix-after-cast.rs:114:8
|
+LL | if 5u64: u64.max(0) == 0 {
+ | ^^^^
error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:102:9
+ --> $DIR/issue-35813-postfix-after-cast.rs:121:9
|
LL | 5u64 as u32.max(0) == 0
| ^^^^^^^^^^^
@@ -277,24 +217,14 @@ help: try surrounding the expression in parentheses
LL | (5u64 as u32).max(0) == 0
| + +
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:106:9
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:125:13
|
LL | 5u64: u64.max(0) == 0
- | ^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | (5u64: u64).max(0) == 0
- | + +
-help: alternatively, remove the type ascription
- |
-LL - 5u64: u64.max(0) == 0
-LL + 5u64.max(0) == 0
- |
+ | ^ expected one of `.`, `;`, `?`, `}`, or an operator
error: cast cannot be followed by indexing
- --> $DIR/issue-35813-postfix-after-cast.rs:111:24
+ --> $DIR/issue-35813-postfix-after-cast.rs:130:24
|
LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
| ^^^^^^^^^^^^^^^^^^
@@ -304,24 +234,14 @@ help: try surrounding the expression in parentheses
LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]);
| + +
-error: type ascription cannot be followed by indexing
- --> $DIR/issue-35813-postfix-after-cast.rs:114:25
+error: expected one of `)`, `,`, `.`, `?`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:133:36
|
LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
- | ^^^^^^^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | static bar2: &[i32] = &((&[1i32,2,3]: &[i32; 3])[0..1]);
- | + +
-help: alternatively, remove the type ascription
- |
-LL - static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]);
-LL + static bar2: &[i32] = &(&[1i32,2,3][0..1]);
- |
+ | ^ expected one of `)`, `,`, `.`, `?`, or an operator
error: cast cannot be followed by `?`
- --> $DIR/issue-35813-postfix-after-cast.rs:119:5
+ --> $DIR/issue-35813-postfix-after-cast.rs:138:5
|
LL | Err(0u64) as Result<u64,u64>?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -331,24 +251,28 @@ help: try surrounding the expression in parentheses
LL | (Err(0u64) as Result<u64,u64>)?;
| + +
-error: type ascription cannot be followed by `?`
- --> $DIR/issue-35813-postfix-after-cast.rs:121:5
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:140:14
|
LL | Err(0u64): Result<u64,u64>?;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
+ | ^ expected one of `.`, `;`, `?`, `}`, or an operator
+
+error: expected identifier, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:152:13
|
-LL | (Err(0u64): Result<u64,u64>)?;
- | + +
-help: alternatively, remove the type ascription
+LL | drop_ptr: F();
+ | ^ expected identifier
|
-LL - Err(0u64): Result<u64,u64>?;
-LL + Err(0u64)?;
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
+
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:159:13
|
+LL | drop_ptr: fn(u8);
+ | ^ expected one of 8 possible tokens
error: cast cannot be followed by a function call
- --> $DIR/issue-35813-postfix-after-cast.rs:145:5
+ --> $DIR/issue-35813-postfix-after-cast.rs:165:5
|
LL | drop as fn(u8)(0);
| ^^^^^^^^^^^^^^
@@ -358,24 +282,14 @@ help: try surrounding the expression in parentheses
LL | (drop as fn(u8))(0);
| + +
-error: type ascription cannot be followed by a function call
- --> $DIR/issue-35813-postfix-after-cast.rs:147:5
+error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:167:13
|
LL | drop_ptr: fn(u8)(0);
- | ^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | (drop_ptr: fn(u8))(0);
- | + +
-help: alternatively, remove the type ascription
- |
-LL - drop_ptr: fn(u8)(0);
-LL + drop_ptr(0);
- |
+ | ^ expected one of 8 possible tokens
error: cast cannot be followed by `.await`
- --> $DIR/issue-35813-postfix-after-cast.rs:152:5
+ --> $DIR/issue-35813-postfix-after-cast.rs:172:5
|
LL | Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -385,24 +299,14 @@ help: try surrounding the expression in parentheses
LL | (Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>).await;
| + +
-error: type ascription cannot be followed by `.await`
- --> $DIR/issue-35813-postfix-after-cast.rs:155:5
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:175:21
|
LL | Box::pin(noop()): Pin<Box<_>>.await;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | (Box::pin(noop()): Pin<Box<_>>).await;
- | + +
-help: alternatively, remove the type ascription
- |
-LL - Box::pin(noop()): Pin<Box<_>>.await;
-LL + Box::pin(noop()).await;
- |
+ | ^ expected one of `.`, `;`, `?`, `}`, or an operator
error: cast cannot be followed by a field access
- --> $DIR/issue-35813-postfix-after-cast.rs:167:5
+ --> $DIR/issue-35813-postfix-after-cast.rs:187:5
|
LL | Foo::default() as Foo.bar;
| ^^^^^^^^^^^^^^^^^^^^^
@@ -412,24 +316,14 @@ help: try surrounding the expression in parentheses
LL | (Foo::default() as Foo).bar;
| + +
-error: type ascription cannot be followed by a field access
- --> $DIR/issue-35813-postfix-after-cast.rs:169:5
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:189:19
|
LL | Foo::default(): Foo.bar;
- | ^^^^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | (Foo::default(): Foo).bar;
- | + +
-help: alternatively, remove the type ascription
- |
-LL - Foo::default(): Foo.bar;
-LL + Foo::default().bar;
- |
+ | ^ expected one of `.`, `;`, `?`, `}`, or an operator
error: cast cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:84:9
+ --> $DIR/issue-35813-postfix-after-cast.rs:103:9
|
LL | if true { 33 } else { 44 } as i32.max(0),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -439,34 +333,18 @@ help: try surrounding the expression in parentheses
LL | (if true { 33 } else { 44 } as i32).max(0),
| + +
-error: type ascription cannot be followed by a method call
- --> $DIR/issue-35813-postfix-after-cast.rs:86:9
+error: expected one of `,`, `.`, `?`, or an operator, found `:`
+ --> $DIR/issue-35813-postfix-after-cast.rs:105:35
|
LL | if true { 33 } else { 44 }: i32.max(0)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: try surrounding the expression in parentheses
- |
-LL | (if true { 33 } else { 44 }: i32).max(0)
- | + +
-help: alternatively, remove the type ascription
- |
-LL - if true { 33 } else { 44 }: i32.max(0)
-LL + if true { 33 } else { 44 }.max(0)
- |
+ | ^ expected one of `,`, `.`, `?`, or an operator
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
- --> $DIR/issue-35813-postfix-after-cast.rs:131:13
+ --> $DIR/issue-35813-postfix-after-cast.rs:150:13
|
LL | drop as F();
| ^^^ only `Fn` traits may use parentheses
-error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
- --> $DIR/issue-35813-postfix-after-cast.rs:133:15
- |
-LL | drop_ptr: F();
- | ^^^ only `Fn` traits may use parentheses
-
-error: aborting due to 36 previous errors
+error: aborting due to 39 previous errors
For more information about this error, try `rustc --explain E0214`.
diff --git a/tests/ui/parser/issues/issue-44406.rs b/tests/ui/parser/issues/issue-44406.rs
index a5b7e83a0..6719e5828 100644
--- a/tests/ui/parser/issues/issue-44406.rs
+++ b/tests/ui/parser/issues/issue-44406.rs
@@ -6,5 +6,4 @@ macro_rules! foo {
fn main() {
foo!(true);
- //~^ ERROR expected identifier, found keyword
}
diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr
index de02ea85b..69ff64c27 100644
--- a/tests/ui/parser/issues/issue-44406.stderr
+++ b/tests/ui/parser/issues/issue-44406.stderr
@@ -1,14 +1,3 @@
-error: expected identifier, found keyword `true`
- --> $DIR/issue-44406.rs:8:10
- |
-LL | foo!(true);
- | ^^^^ expected identifier, found keyword
- |
-help: escape `true` to use it as an identifier
- |
-LL | foo!(r#true);
- | ++
-
error: invalid `struct` delimiters or `fn` call arguments
--> $DIR/issue-44406.rs:3:9
|
@@ -29,5 +18,5 @@ LL - bar(baz: $rest)
LL + bar(: $rest)
|
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/parser/issues/issue-62913.rs b/tests/ui/parser/issues/issue-62913.rs
index 0db06f636..a55ef5ac7 100644
--- a/tests/ui/parser/issues/issue-62913.rs
+++ b/tests/ui/parser/issues/issue-62913.rs
@@ -1,4 +1,4 @@
"\u\\"
//~^ ERROR incorrect unicode escape sequence
//~| ERROR invalid trailing slash in literal
-//~| ERROR expected item, found `"\u\\"`
+//~| ERROR expected item, found `"\u\"`
diff --git a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed
index 95019b278..2c42f9731 100644
--- a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed
+++ b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.fixed
@@ -6,9 +6,12 @@
fn main() {}
-pub fn f1<T>() {}
+pub fn f1<T: 'static>() {}
//~^ ERROR negative bounds are not supported
-pub fn f2<'a, T: Ord>() {}
+//~| ERROR `!` may only modify trait bounds, not lifetime bound
+pub fn f2<'a, T: Ord + 'a>() {}
//~^ ERROR negative bounds are not supported
-pub fn f3<'a, T: Ord>() {}
+//~| ERROR `!` may only modify trait bounds, not lifetime bound
+pub fn f3<'a, T: 'a + Ord>() {}
//~^ ERROR negative bounds are not supported
+//~| ERROR `!` may only modify trait bounds, not lifetime bound
diff --git a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs
index 82f54f8fa..e510efaae 100644
--- a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs
+++ b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.rs
@@ -8,7 +8,10 @@ fn main() {}
pub fn f1<T: !'static>() {}
//~^ ERROR negative bounds are not supported
+//~| ERROR `!` may only modify trait bounds, not lifetime bound
pub fn f2<'a, T: Ord + !'a>() {}
//~^ ERROR negative bounds are not supported
+//~| ERROR `!` may only modify trait bounds, not lifetime bound
pub fn f3<'a, T: !'a + Ord>() {}
//~^ ERROR negative bounds are not supported
+//~| ERROR `!` may only modify trait bounds, not lifetime bound
diff --git a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr
index a4a422948..91fe02db3 100644
--- a/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr
+++ b/tests/ui/parser/issues/issue-67146-negative-outlives-bound-syntactic-fail.stderr
@@ -1,20 +1,38 @@
+error: `!` may only modify trait bounds, not lifetime bounds
+ --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:14
+ |
+LL | pub fn f1<T: !'static>() {}
+ | ^
+
+error: `!` may only modify trait bounds, not lifetime bounds
+ --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:12:24
+ |
+LL | pub fn f2<'a, T: Ord + !'a>() {}
+ | ^
+
+error: `!` may only modify trait bounds, not lifetime bounds
+ --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:15:18
+ |
+LL | pub fn f3<'a, T: !'a + Ord>() {}
+ | ^
+
error: negative bounds are not supported
- --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:12
+ --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:14
|
LL | pub fn f1<T: !'static>() {}
- | ^^^^^^^^^^ negative bounds are not supported
+ | ^
error: negative bounds are not supported
- --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:22
+ --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:12:24
|
LL | pub fn f2<'a, T: Ord + !'a>() {}
- | ^^^^^ negative bounds are not supported
+ | ^
error: negative bounds are not supported
- --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:13:16
+ --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:15:18
|
LL | pub fn f3<'a, T: !'a + Ord>() {}
- | ^^^^^ negative bounds are not supported
+ | ^
-error: aborting due to 3 previous errors
+error: aborting due to 6 previous errors
diff --git a/tests/ui/parser/issues/issue-91461.rs b/tests/ui/parser/issues/issue-91461.rs
index 3e3c411c4..80e0940ad 100644
--- a/tests/ui/parser/issues/issue-91461.rs
+++ b/tests/ui/parser/issues/issue-91461.rs
@@ -1,6 +1,5 @@
fn main() {
a(_:b:,)
- //~^ ERROR: expected identifier, found reserved identifier `_`
- //~| ERROR: expected type, found `,`
- //~| ERROR: expected type, found `,`
+ //~^ ERROR expected identifier, found reserved identifier
+ //~| ERROR: expected one of
}
diff --git a/tests/ui/parser/issues/issue-91461.stderr b/tests/ui/parser/issues/issue-91461.stderr
index 94fcf1721..27e1b5cdc 100644
--- a/tests/ui/parser/issues/issue-91461.stderr
+++ b/tests/ui/parser/issues/issue-91461.stderr
@@ -4,28 +4,11 @@ error: expected identifier, found reserved identifier `_`
LL | a(_:b:,)
| ^ expected identifier, found reserved identifier
-error: expected type, found `,`
- --> $DIR/issue-91461.rs:2:11
+error: expected one of `)`, `,`, `.`, `?`, or an operator, found `:`
+ --> $DIR/issue-91461.rs:2:8
|
LL | a(_:b:,)
- | - -^ expected type
- | | |
- | | tried to parse a type due to this type ascription
- | while parsing this struct
- |
- = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
- = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
-
-error: expected type, found `,`
- --> $DIR/issue-91461.rs:2:11
- |
-LL | a(_:b:,)
- | -^ expected type
- | |
- | tried to parse a type due to this type ascription
- |
- = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `<expr>: <type>`
- = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
+ | ^ expected one of `)`, `,`, `.`, `?`, or an operator
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors