@@ -33,131 +33,131 @@ struct D {
33
33
fn copy_after_move ( ) {
34
34
let a: Box < _ > = box A { x : box 0 , y : 1 } ;
35
35
let _x = a. x ;
36
- //~^ value moved here
37
- let _y = a. y ; //~ ERROR use of moved
38
- //~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
39
- //~| value used here after move
36
+ //[ast] ~^ value moved here
37
+ let _y = a. y ; //[ast] ~ ERROR use of moved
38
+ //[ast] ~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
39
+ //[ast] ~| value used here after move
40
40
}
41
41
42
42
fn move_after_move ( ) {
43
43
let a: Box < _ > = box B { x : box 0 , y : box 1 } ;
44
44
let _x = a. x ;
45
- //~^ value moved here
46
- let _y = a. y ; //~ ERROR use of moved
47
- //~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
48
- //~| value used here after move
45
+ //[ast] ~^ value moved here
46
+ let _y = a. y ; //[ast] ~ ERROR use of moved
47
+ //[ast] ~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
48
+ //[ast] ~| value used here after move
49
49
}
50
50
51
51
fn borrow_after_move ( ) {
52
52
let a: Box < _ > = box A { x : box 0 , y : 1 } ;
53
53
let _x = a. x ;
54
- //~^ value moved here
55
- let _y = & a. y ; //~ ERROR use of moved
56
- //~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
57
- //~| value used here after move
54
+ //[ast] ~^ value moved here
55
+ let _y = & a. y ; //[ast] ~ ERROR use of moved
56
+ //[ast] ~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
57
+ //[ast] ~| value used here after move
58
58
}
59
59
60
60
fn move_after_borrow ( ) {
61
61
let a: Box < _ > = box B { x : box 0 , y : box 1 } ;
62
62
let _x = & a. x ;
63
63
let _y = a. y ;
64
- //~^ ERROR cannot move
65
- //~| move out of
64
+ //[ast] ~^ ERROR cannot move
65
+ //[ast] ~| move out of
66
66
use_imm ( _x) ;
67
67
}
68
68
fn copy_after_mut_borrow ( ) {
69
69
let mut a: Box < _ > = box A { x : box 0 , y : 1 } ;
70
70
let _x = & mut a. x ;
71
- let _y = a. y ; //~ ERROR cannot use
71
+ let _y = a. y ; //[ast] ~ ERROR cannot use
72
72
use_mut ( _x) ;
73
73
}
74
74
fn move_after_mut_borrow ( ) {
75
75
let mut a: Box < _ > = box B { x : box 0 , y : box 1 } ;
76
76
let _x = & mut a. x ;
77
77
let _y = a. y ;
78
- //~^ ERROR cannot move
79
- //~| move out of
78
+ //[ast] ~^ ERROR cannot move
79
+ //[ast] ~| move out of
80
80
use_mut ( _x) ;
81
81
}
82
82
fn borrow_after_mut_borrow ( ) {
83
83
let mut a: Box < _ > = box A { x : box 0 , y : 1 } ;
84
84
let _x = & mut a. x ;
85
- let _y = & a. y ; //~ ERROR cannot borrow
86
- //~^ immutable borrow occurs here (via `a.y`)
85
+ let _y = & a. y ; //[ast] ~ ERROR cannot borrow
86
+ //[ast] ~^ immutable borrow occurs here (via `a.y`)
87
87
use_mut ( _x) ;
88
88
}
89
89
fn mut_borrow_after_borrow ( ) {
90
90
let mut a: Box < _ > = box A { x : box 0 , y : 1 } ;
91
91
let _x = & a. x ;
92
- let _y = & mut a. y ; //~ ERROR cannot borrow
93
- //~^ mutable borrow occurs here (via `a.y`)
92
+ let _y = & mut a. y ; //[ast] ~ ERROR cannot borrow
93
+ //[ast] ~^ mutable borrow occurs here (via `a.y`)
94
94
use_imm ( _x) ;
95
95
}
96
96
fn copy_after_move_nested ( ) {
97
97
let a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
98
98
let _x = a. x . x ;
99
- //~^ value moved here
100
- let _y = a. y ; //~ ERROR use of collaterally moved
101
- //~| value used here after move
99
+ //[ast] ~^ value moved here
100
+ let _y = a. y ; //[ast] ~ ERROR use of collaterally moved
101
+ //[ast] ~| value used here after move
102
102
}
103
103
104
104
fn move_after_move_nested ( ) {
105
105
let a: Box < _ > = box D { x : box A { x : box 0 , y : 1 } , y : box 2 } ;
106
106
let _x = a. x . x ;
107
- //~^ value moved here
108
- let _y = a. y ; //~ ERROR use of collaterally moved
109
- //~| value used here after move
107
+ //[ast] ~^ value moved here
108
+ let _y = a. y ; //[ast] ~ ERROR use of collaterally moved
109
+ //[ast] ~| value used here after move
110
110
}
111
111
112
112
fn borrow_after_move_nested ( ) {
113
113
let a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
114
114
let _x = a. x . x ;
115
- //~^ value moved here
116
- let _y = & a. y ; //~ ERROR use of collaterally moved
117
- //~| value used here after move
115
+ //[ast] ~^ value moved here
116
+ let _y = & a. y ; //[ast] ~ ERROR use of collaterally moved
117
+ //[ast] ~| value used here after move
118
118
}
119
119
120
120
fn move_after_borrow_nested ( ) {
121
121
let a: Box < _ > = box D { x : box A { x : box 0 , y : 1 } , y : box 2 } ;
122
122
let _x = & a. x . x ;
123
- //~^ borrow of `a.x.x` occurs here
123
+ //[ast] ~^ borrow of `a.x.x` occurs here
124
124
let _y = a. y ;
125
- //~^ ERROR cannot move
126
- //~| move out of
125
+ //[ast] ~^ ERROR cannot move
126
+ //[ast] ~| move out of
127
127
use_imm ( _x) ;
128
128
}
129
129
fn copy_after_mut_borrow_nested ( ) {
130
130
let mut a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
131
131
let _x = & mut a. x . x ;
132
- let _y = a. y ; //~ ERROR cannot use
132
+ let _y = a. y ; //[ast] ~ ERROR cannot use
133
133
use_mut ( _x) ;
134
134
}
135
135
fn move_after_mut_borrow_nested ( ) {
136
136
let mut a: Box < _ > = box D { x : box A { x : box 0 , y : 1 } , y : box 2 } ;
137
137
let _x = & mut a. x . x ;
138
138
let _y = a. y ;
139
- //~^ ERROR cannot move
140
- //~| move out of
139
+ //[ast] ~^ ERROR cannot move
140
+ //[ast] ~| move out of
141
141
use_mut ( _x) ;
142
142
}
143
143
fn borrow_after_mut_borrow_nested ( ) {
144
144
let mut a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
145
145
let _x = & mut a. x . x ;
146
- //~^ mutable borrow occurs here
147
- let _y = & a. y ; //~ ERROR cannot borrow
148
- //~^ immutable borrow occurs here
146
+ //[ast] ~^ mutable borrow occurs here
147
+ let _y = & a. y ; //[ast] ~ ERROR cannot borrow
148
+ //[ast] ~^ immutable borrow occurs here
149
149
use_mut ( _x) ;
150
150
}
151
151
fn mut_borrow_after_borrow_nested ( ) {
152
152
let mut a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
153
153
let _x = & a. x . x ;
154
- //~^ immutable borrow occurs here
155
- let _y = & mut a. y ; //~ ERROR cannot borrow
156
- //~^ mutable borrow occurs here
154
+ //[ast] ~^ immutable borrow occurs here
155
+ let _y = & mut a. y ; //[ast] ~ ERROR cannot borrow
156
+ //[ast] ~^ mutable borrow occurs here
157
157
use_imm ( _x) ;
158
158
}
159
159
#[ rustc_error]
160
- fn main ( ) {
160
+ fn main ( ) { //[mir]~ ERROR compilation successful
161
161
copy_after_move ( ) ;
162
162
move_after_move ( ) ;
163
163
borrow_after_move ( ) ;
0 commit comments