summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr')
-rw-r--r--tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr472
1 files changed, 472 insertions, 0 deletions
diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr
new file mode 100644
index 000000000..0c328bde2
--- /dev/null
+++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr
@@ -0,0 +1,472 @@
+error: cast cannot be followed by indexing
+ --> $DIR/issue-35813-postfix-after-cast.rs:10:5
+ |
+LL | vec![1, 2, 3] as Vec<i32>[0];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+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
+ |
+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];
+ |
+
+error: cast cannot be followed by indexing
+ --> $DIR/issue-35813-postfix-after-cast.rs:17:5
+ |
+LL | (&[0]) as &[i32][0];
+ | ^^^^^^^^^^^^^^^^
+ |
+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
+ |
+LL | (&[0i32]): &[i32; 1][0];
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+help: try surrounding the expression in parentheses
+ |
+LL | ((&[0i32]): &[i32; 1])[0];
+ | + +
+help: alternatively, remove the type ascription
+ |
+LL - (&[0i32]): &[i32; 1][0];
+LL + (&[0i32])[0];
+ |
+
+error: type ascription cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:39:13
+ |
+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();
+ |
+
+error: type ascription cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:41:13
+ |
+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();
+ |
+
+error: cast cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:43:13
+ |
+LL | let _ = 0i32: i32 as i32.count_ones();
+ | ^^^^^^^^^^^^^^^^
+ |
+help: try surrounding the expression in parentheses
+ |
+LL | let _ = (0i32: i32 as i32).count_ones();
+ | + +
+
+error: cast cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:45:13
+ |
+LL | let _ = 0 as i32 as i32.count_ones();
+ | ^^^^^^^^^^^^^^^
+ |
+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
+ |
+LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: try surrounding the expression in parentheses
+ |
+LL | let _ = (0i32: i32: i32 as u32 as i32).count_ones();
+ | + +
+
+error: type ascription cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:49:13
+ |
+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;
+ |
+
+error: cast cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:51:13
+ |
+LL | let _ = 0 as i32.count_ones(): u32;
+ | ^^^^^^^^
+ |
+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
+ |
+LL | let _ = 0i32: i32.count_ones() as u32;
+ | ^^^^^^^^^
+ |
+help: try surrounding the expression in parentheses
+ |
+LL | let _ = (0i32: i32).count_ones() as u32;
+ | + +
+help: alternatively, remove the type ascription
+ |
+LL - let _ = 0i32: i32.count_ones() as u32;
+LL + let _ = 0i32.count_ones() as u32;
+ |
+
+error: cast cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:55:13
+ |
+LL | let _ = 0 as i32.count_ones() as u32;
+ | ^^^^^^^^
+ |
+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
+ |
+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;
+ |
+
+error: cast cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:62:13
+ |
+LL | let _ = 0
+ | _____________^
+LL | | as i32
+ | |______________^
+ |
+help: try surrounding the expression in parentheses
+ |
+LL ~ let _ = (0
+LL ~ as i32)
+ |
+
+error: cast cannot be followed by indexing
+ --> $DIR/issue-35813-postfix-after-cast.rs:70:18
+ |
+LL | let x: i32 = &vec![1, 2, 3] as &Vec<i32>[0];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: try surrounding the expression in parentheses
+ |
+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
+ |
+LL | 0 as i32.max(0);
+ | ^^^^^^^^
+ |
+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
+ |
+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);
+ |
+
+error: cast cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:92:8
+ |
+LL | if 5u64 as i32.max(0) == 0 {
+ | ^^^^^^^^^^^
+ |
+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
+ |
+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
+ |
+LL - if 5u64: u64.max(0) == 0 {
+LL + if 5u64.max(0) == 0 {
+ |
+
+error: cast cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:102:9
+ |
+LL | 5u64 as u32.max(0) == 0
+ | ^^^^^^^^^^^
+ |
+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
+ |
+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
+ |
+
+error: cast cannot be followed by indexing
+ --> $DIR/issue-35813-postfix-after-cast.rs:111:24
+ |
+LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]);
+ | ^^^^^^^^^^^^^^^^^^
+ |
+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
+ |
+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]);
+ |
+
+error: cast cannot be followed by `?`
+ --> $DIR/issue-35813-postfix-after-cast.rs:119:5
+ |
+LL | Err(0u64) as Result<u64,u64>?;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+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
+ |
+LL | Err(0u64): Result<u64,u64>?;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+help: try surrounding the expression in parentheses
+ |
+LL | (Err(0u64): Result<u64,u64>)?;
+ | + +
+help: alternatively, remove the type ascription
+ |
+LL - Err(0u64): Result<u64,u64>?;
+LL + Err(0u64)?;
+ |
+
+error: cast cannot be followed by a function call
+ --> $DIR/issue-35813-postfix-after-cast.rs:145:5
+ |
+LL | drop as fn(u8)(0);
+ | ^^^^^^^^^^^^^^
+ |
+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
+ |
+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);
+ |
+
+error: cast cannot be followed by `.await`
+ --> $DIR/issue-35813-postfix-after-cast.rs:152:5
+ |
+LL | Box::pin(noop()) as Pin<Box<dyn Future<Output = ()>>>.await;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+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
+ |
+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;
+ |
+
+error: cast cannot be followed by a field access
+ --> $DIR/issue-35813-postfix-after-cast.rs:167:5
+ |
+LL | Foo::default() as Foo.bar;
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+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
+ |
+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;
+ |
+
+error: cast cannot be followed by a method call
+ --> $DIR/issue-35813-postfix-after-cast.rs:84:9
+ |
+LL | if true { 33 } else { 44 } as i32.max(0),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+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
+ |
+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)
+ |
+
+error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
+ --> $DIR/issue-35813-postfix-after-cast.rs:131: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
+
+For more information about this error, try `rustc --explain E0214`.