@@ -8,16 +8,16 @@ use std::pin::Pin;
88// errors and parse such that further code gives useful errors.
99pub fn index_after_as_cast ( ) {
1010 vec ! [ 1 , 2 , 3 ] as Vec < i32 > [ 0 ] ;
11- //~^ ERROR: casts cannot be followed by indexing
11+ //~^ ERROR: cast cannot be followed by indexing
1212 vec ! [ 1 , 2 , 3 ] : Vec <i32>[ 0 ] ;
13- //~^ ERROR: casts cannot be followed by indexing
13+ //~^ ERROR: type ascription cannot be followed by indexing
1414}
1515
1616pub fn index_after_cast_to_index ( ) {
1717 ( & [ 0 ] ) as & [ i32 ] [ 0 ] ;
18- //~^ ERROR: casts cannot be followed by indexing
18+ //~^ ERROR: cast cannot be followed by indexing
1919 ( & [ 0i32 ] ) : & [ i32; 1 ] [ 0 ] ;
20- //~^ ERROR: casts cannot be followed by indexing
20+ //~^ ERROR: type ascription cannot be followed by indexing
2121}
2222
2323pub fn cast_after_cast ( ) {
@@ -37,89 +37,89 @@ pub fn cast_after_cast() {
3737
3838pub fn cast_cast_method_call ( ) {
3939 let _ = 0i32 : i32 : i32. count_ones ( ) ;
40- //~^ ERROR: casts cannot be followed by a method call
40+ //~^ ERROR: type ascription cannot be followed by a method call
4141 let _ = 0 as i32 : i32 . count_ones ( ) ;
42- //~^ ERROR: casts cannot be followed by a method call
42+ //~^ ERROR: type ascription cannot be followed by a method call
4343 let _ = 0i32 : i32 as i32 . count_ones ( ) ;
44- //~^ ERROR: casts cannot be followed by a method call
44+ //~^ ERROR: cast cannot be followed by a method call
4545 let _ = 0 as i32 as i32 . count_ones ( ) ;
46- //~^ ERROR: casts cannot be followed by a method call
46+ //~^ ERROR: cast cannot be followed by a method call
4747 let _ = 0i32 : i32 : i32 as u32 as i32 . count_ones ( ) ;
48- //~^ ERROR: casts cannot be followed by a method call
48+ //~^ ERROR: cast cannot be followed by a method call
4949 let _ = 0i32 : i32 . count_ones ( ) : u32 ;
50- //~^ ERROR: casts cannot be followed by a method call
50+ //~^ ERROR: type ascription cannot be followed by a method call
5151 let _ = 0 as i32 . count_ones ( ) : u32 ;
52- //~^ ERROR: casts cannot be followed by a method call
52+ //~^ ERROR: cast cannot be followed by a method call
5353 let _ = 0i32 : i32. count_ones ( ) as u32 ;
54- //~^ ERROR: casts cannot be followed by a method call
54+ //~^ ERROR: type ascription cannot be followed by a method call
5555 let _ = 0 as i32 . count_ones ( ) as u32 ;
56- //~^ ERROR: casts cannot be followed by a method call
56+ //~^ ERROR: cast cannot be followed by a method call
5757 let _ = 0i32 : i32 : i32. count_ones ( ) as u32 as i32 ;
58- //~^ ERROR: casts cannot be followed by a method call
58+ //~^ ERROR: type ascription cannot be followed by a method call
5959}
6060
6161pub fn multiline_error ( ) {
6262 let _ = 0
6363 as i32
6464 . count_ones ( ) ;
65- //~^^^ ERROR: casts cannot be followed by a method call
65+ //~^^^ ERROR: cast cannot be followed by a method call
6666}
6767
6868// this tests that the precedence for `!x as Y.Z` is still what we expect
6969pub fn precedence ( ) {
7070 let x: i32 = & vec ! [ 1 , 2 , 3 ] as & Vec < i32 > [ 0 ] ;
71- //~^ ERROR: casts cannot be followed by indexing
71+ //~^ ERROR: cast cannot be followed by indexing
7272}
7373
7474pub fn method_calls ( ) {
7575 0 as i32 . max ( 0 ) ;
76- //~^ ERROR: casts cannot be followed by a method call
76+ //~^ ERROR: cast cannot be followed by a method call
7777 0 : i32. max ( 0 ) ;
78- //~^ ERROR: casts cannot be followed by a method call
78+ //~^ ERROR: type ascription cannot be followed by a method call
7979}
8080
8181pub fn complex ( ) {
8282 let _ = format ! (
8383 "{} and {}" ,
8484 if true { 33 } else { 44 } as i32 . max( 0 ) ,
85- //~^ ERROR: casts cannot be followed by a method call
85+ //~^ ERROR: cast cannot be followed by a method call
8686 if true { 33 } else { 44 } : i32 . max( 0 )
87- //~^ ERROR: casts cannot be followed by a method call
87+ //~^ ERROR: type ascription cannot be followed by a method call
8888 ) ;
8989}
9090
9191pub fn in_condition ( ) {
9292 if 5u64 as i32 . max ( 0 ) == 0 {
93- //~^ ERROR: casts cannot be followed by a method call
93+ //~^ ERROR: cast cannot be followed by a method call
9494 }
9595 if 5u64 : u64. max ( 0 ) == 0 {
96- //~^ ERROR: casts cannot be followed by a method call
96+ //~^ ERROR: type ascription cannot be followed by a method call
9797 }
9898}
9999
100100pub fn inside_block ( ) {
101101 let _ = if true {
102102 5u64 as u32 . max ( 0 ) == 0
103- //~^ ERROR: casts cannot be followed by a method call
103+ //~^ ERROR: cast cannot be followed by a method call
104104 } else { false } ;
105105 let _ = if true {
106106 5u64 : u64. max ( 0 ) == 0
107- //~^ ERROR: casts cannot be followed by a method call
107+ //~^ ERROR: type ascription cannot be followed by a method call
108108 } else { false } ;
109109}
110110
111111static bar: & [ i32 ] = & ( & [ 1 , 2 , 3 ] as & [ i32 ] [ 0 ..1 ] ) ;
112- //~^ ERROR: casts cannot be followed by indexing
112+ //~^ ERROR: cast cannot be followed by indexing
113113
114114static bar2: & [ i32 ] = & ( & [ 1i32 , 2 , 3 ] : & [ i32; 3 ] [ 0 ..1 ] ) ;
115- //~^ ERROR: casts cannot be followed by indexing
115+ //~^ ERROR: type ascription cannot be followed by indexing
116116
117117
118118pub fn cast_then_try ( ) -> Result < u64 , u64 > {
119119 Err ( 0u64 ) as Result < u64 , u64 > ?;
120- //~^ ERROR: casts cannot be followed by `?`
120+ //~^ ERROR: cast cannot be followed by `?`
121121 Err ( 0u64 ) : Result <u64, u64>?;
122- //~^ ERROR: casts cannot be followed by `?`
122+ //~^ ERROR: type ascription cannot be followed by `?`
123123 Ok ( 1 )
124124}
125125
@@ -143,17 +143,17 @@ pub fn cast_to_fn_should_work() {
143143pub fn parens_after_cast_error ( ) {
144144 let drop_ptr = drop as fn ( u8 ) ;
145145 drop as fn ( u8 ) ( 0 ) ;
146- //~^ ERROR: casts cannot be followed by a function call
146+ //~^ ERROR: cast cannot be followed by a function call
147147 drop_ptr : fn ( u8) ( 0 ) ;
148- //~^ ERROR: casts cannot be followed by a function call
148+ //~^ ERROR: type ascription cannot be followed by a function call
149149}
150150
151151pub async fn cast_then_await ( ) {
152152 Box :: pin ( noop ( ) ) as Pin < Box < dyn Future < Output = ( ) > > > . await ;
153- //~^ ERROR: casts cannot be followed by `.await`
153+ //~^ ERROR: cast cannot be followed by `.await`
154154
155155 Box :: pin ( noop ( ) ) : Pin <Box <_>>. await ;
156- //~^ ERROR: casts cannot be followed by `.await`
156+ //~^ ERROR: type ascription cannot be followed by `.await`
157157}
158158
159159pub async fn noop ( ) { }
@@ -167,5 +167,5 @@ pub fn struct_field() {
167167 Foo :: default ( ) as Foo . bar ;
168168 //~^ ERROR: cannot be followed by a field access
169169 Foo :: default ( ) : Foo . bar ;
170- //~^ ERROR: cannot be followed by a field access
170+ //~^ ERROR: type ascription cannot be followed by a field access
171171}
0 commit comments