@@ -63,36 +63,36 @@ fn move_after_borrow() {
63
63
let _y = a. y ;
64
64
//~^ ERROR cannot move
65
65
//~| move out of
66
+ use_imm ( _x) ;
66
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
71
let _y = a. y ; //~ ERROR cannot use
72
+ use_mut ( _x) ;
72
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
78
//~^ ERROR cannot move
79
79
//~| move out of
80
+ use_mut ( _x) ;
80
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
85
let _y = & a. y ; //~ ERROR cannot borrow
86
86
//~^ immutable borrow occurs here (via `a.y`)
87
+ use_mut ( _x) ;
87
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
92
let _y = & mut a. y ; //~ ERROR cannot borrow
93
93
//~^ mutable borrow occurs here (via `a.y`)
94
+ use_imm ( _x) ;
94
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 ;
@@ -124,38 +124,38 @@ fn move_after_borrow_nested() {
124
124
let _y = a. y ;
125
125
//~^ ERROR cannot move
126
126
//~| move out of
127
+ use_imm ( _x) ;
127
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
132
let _y = a. y ; //~ ERROR cannot use
133
+ use_mut ( _x) ;
133
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
139
//~^ ERROR cannot move
140
140
//~| move out of
141
+ use_mut ( _x) ;
141
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
146
//~^ mutable borrow occurs here
147
147
let _y = & a. y ; //~ ERROR cannot borrow
148
148
//~^ immutable borrow occurs here
149
+ use_mut ( _x) ;
149
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
154
//~^ immutable borrow occurs here
155
155
let _y = & mut a. y ; //~ ERROR cannot borrow
156
156
//~^ mutable borrow occurs here
157
+ use_imm ( _x) ;
157
158
}
158
-
159
159
#[ rustc_error]
160
160
fn main ( ) {
161
161
copy_after_move ( ) ;
@@ -180,3 +180,6 @@ fn main() {
180
180
borrow_after_mut_borrow_nested ( ) ;
181
181
mut_borrow_after_borrow_nested ( ) ;
182
182
}
183
+
184
+ fn use_mut < T > ( _: & mut T ) { }
185
+ fn use_imm < T > ( _: & T ) { }
0 commit comments