@@ -54,80 +54,97 @@ fn borrow_after_move() {
5454fn move_after_borrow ( ) {
5555 let a: Box < _ > = box B { x : box 0 , y : box 1 } ;
5656 let _x = & a. x ;
57+ //~^ NOTE borrow of `a.x` occurs here
5758 let _y = a. y ; //~ ERROR cannot move
5859}
5960
6061fn copy_after_mut_borrow ( ) {
6162 let mut a: Box < _ > = box A { x : box 0 , y : 1 } ;
6263 let _x = & mut a. x ;
64+ //~^ NOTE borrow of `a.x` occurs here
6365 let _y = a. y ; //~ ERROR cannot use
6466}
6567
6668fn move_after_mut_borrow ( ) {
6769 let mut a: Box < _ > = box B { x : box 0 , y : box 1 } ;
6870 let _x = & mut a. x ;
71+ //~^ NOTE borrow of `a.x` occurs here
6972 let _y = a. y ; //~ ERROR cannot move
7073}
7174
7275fn borrow_after_mut_borrow ( ) {
7376 let mut a: Box < _ > = box A { x : box 0 , y : 1 } ;
7477 let _x = & mut a. x ;
78+ //~^ NOTE previous borrow of `a` occurs here (through borrowing `a.x`);
7579 let _y = & a. y ; //~ ERROR cannot borrow
7680}
81+ //~^ NOTE previous borrow ends here
7782
7883fn mut_borrow_after_borrow ( ) {
7984 let mut a: Box < _ > = box A { x : box 0 , y : 1 } ;
8085 let _x = & a. x ;
86+ //~^ NOTE previous borrow of `a` occurs here (through borrowing `a.x`)
8187 let _y = & mut a. y ; //~ ERROR cannot borrow
8288}
89+ //~^ NOTE previous borrow ends here
8390
8491fn copy_after_move_nested ( ) {
8592 let a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
8693 let _x = a. x . x ;
94+ //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
8795 let _y = a. y ; //~ ERROR use of collaterally moved
8896}
8997
9098fn move_after_move_nested ( ) {
9199 let a: Box < _ > = box D { x : box A { x : box 0 , y : 1 } , y : box 2 } ;
92100 let _x = a. x . x ;
101+ //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
93102 let _y = a. y ; //~ ERROR use of collaterally moved
94103}
95104
96105fn borrow_after_move_nested ( ) {
97106 let a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
98107 let _x = a. x . x ;
108+ //~^ NOTE `a.x.x` moved here because it has type `Box<isize>`, which is moved by default
99109 let _y = & a. y ; //~ ERROR use of collaterally moved
100110}
101111
102112fn move_after_borrow_nested ( ) {
103113 let a: Box < _ > = box D { x : box A { x : box 0 , y : 1 } , y : box 2 } ;
104114 let _x = & a. x . x ;
115+ //~^ NOTE borrow of `a.x.x` occurs here
105116 let _y = a. y ; //~ ERROR cannot move
106117}
107118
108119fn copy_after_mut_borrow_nested ( ) {
109120 let mut a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
110121 let _x = & mut a. x . x ;
122+ //~^ NOTE borrow of `a.x.x` occurs here
111123 let _y = a. y ; //~ ERROR cannot use
112124}
113125
114126fn move_after_mut_borrow_nested ( ) {
115127 let mut a: Box < _ > = box D { x : box A { x : box 0 , y : 1 } , y : box 2 } ;
116128 let _x = & mut a. x . x ;
129+ //~^ NOTE borrow of `a.x.x` occurs here
117130 let _y = a. y ; //~ ERROR cannot move
118131}
119132
120133fn borrow_after_mut_borrow_nested ( ) {
121134 let mut a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
122135 let _x = & mut a. x . x ;
136+ //~^ NOTE previous borrow of `a.x.x` occurs here; the mutable borrow prevents
123137 let _y = & a. y ; //~ ERROR cannot borrow
124138}
139+ //~^ NOTE previous borrow ends here
125140
126141fn mut_borrow_after_borrow_nested ( ) {
127142 let mut a: Box < _ > = box C { x : box A { x : box 0 , y : 1 } , y : 2 } ;
128143 let _x = & a. x . x ;
144+ //~^ NOTE previous borrow of `a.x.x` occurs here; the immutable borrow prevents
129145 let _y = & mut a. y ; //~ ERROR cannot borrow
130146}
147+ //~^ NOTE previous borrow ends here
131148
132149fn main ( ) {
133150 copy_after_move ( ) ;
0 commit comments