]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr
Rollup merge of #71217 - estebank:tail-borrow-sugg, r=pnkfelix
[rust.git] / src / test / ui / nll / issue-54556-used-vs-unused-tails.stderr
1 error[E0597]: `_t1` does not live long enough
2   --> $DIR/issue-54556-used-vs-unused-tails.rs:10:55
3    |
4 LL |     {              let mut _t1 = D(Box::new("t1")); D(&_t1).end()    } ; // suggest `;`
5    |                                                     --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
6    |                                                     | |              |
7    |                                                     | |              `_t1` dropped here while still borrowed
8    |                                                     | borrowed value does not live long enough
9    |                                                     a temporary with access to the borrow is created here ...
10    |
11 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
12    |
13 LL |     {              let mut _t1 = D(Box::new("t1")); D(&_t1).end();    } ; // suggest `;`
14    |                                                                  ^
15
16 error[E0597]: `_t1` does not live long enough
17   --> $DIR/issue-54556-used-vs-unused-tails.rs:13:55
18    |
19 LL |     {            { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }  } ; // suggest `;`
20    |                                                     --^^^^-       -    - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
21    |                                                     | |           |
22    |                                                     | |           `_t1` dropped here while still borrowed
23    |                                                     | borrowed value does not live long enough
24    |                                                     a temporary with access to the borrow is created here ...
25    |
26 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
27    |
28 LL |     {            { let mut _t1 = D(Box::new("t1")); D(&_t1).end(); }  } ; // suggest `;`
29    |                                                                  ^
30
31 error[E0597]: `_t1` does not live long enough
32   --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55
33    |
34 LL |     {            { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; }   // suggest `;`
35    |                                                     --^^^^-       -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
36    |                                                     | |           |
37    |                                                     | |           `_t1` dropped here while still borrowed
38    |                                                     | borrowed value does not live long enough
39    |                                                     a temporary with access to the borrow is created here ...
40    |
41 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
42    |
43 LL |     {            { let mut _t1 = D(Box::new("t1")); D(&_t1).end(); }; }   // suggest `;`
44    |                                                                  ^
45
46 error[E0597]: `_t1` does not live long enough
47   --> $DIR/issue-54556-used-vs-unused-tails.rs:19:55
48    |
49 LL |     let _ =      { let mut _t1 = D(Box::new("t1")); D(&_t1).end()    } ; // suggest `;`
50    |                                                     --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
51    |                                                     | |              |
52    |                                                     | |              `_t1` dropped here while still borrowed
53    |                                                     | borrowed value does not live long enough
54    |                                                     a temporary with access to the borrow is created here ...
55    |
56 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
57    |
58 LL |     let _ =      { let mut _t1 = D(Box::new("t1")); D(&_t1).end();    } ; // suggest `;`
59    |                                                                  ^
60
61 error[E0597]: `_t1` does not live long enough
62   --> $DIR/issue-54556-used-vs-unused-tails.rs:22:55
63    |
64 LL |     let _u =     { let mut _t1 = D(Box::new("t1")); D(&_t1).unit()   } ; // suggest `;`
65    |                                                     --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
66    |                                                     | |              |
67    |                                                     | |              `_t1` dropped here while still borrowed
68    |                                                     | borrowed value does not live long enough
69    |                                                     a temporary with access to the borrow is created here ...
70    |
71 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
72    |
73 LL |     let _u =     { let mut _t1 = D(Box::new("t1")); D(&_t1).unit();   } ; // suggest `;`
74    |                                                                   ^
75
76 error[E0597]: `_t1` does not live long enough
77   --> $DIR/issue-54556-used-vs-unused-tails.rs:25:55
78    |
79 LL |     let _x =     { let mut _t1 = D(Box::new("t1")); D(&_t1).end()    } ; // `let x = ...; x`
80    |                                                     --^^^^-          - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
81    |                                                     | |              |
82    |                                                     | |              `_t1` dropped here while still borrowed
83    |                                                     | borrowed value does not live long enough
84    |                                                     a temporary with access to the borrow is created here ...
85    |
86    = note: the temporary is part of an expression at the end of a block;
87            consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
88 help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
89    |
90 LL |     let _x =     { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x    } ; // `let x = ...; x`
91    |                                                     ^^^^^^^              ^^^
92
93 error[E0597]: `_t1` does not live long enough
94   --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55
95    |
96 LL |     _y =         { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x`
97    |                                                     --^^^^-       - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
98    |                                                     | |           |
99    |                                                     | |           `_t1` dropped here while still borrowed
100    |                                                     | borrowed value does not live long enough
101    |                                                     a temporary with access to the borrow is created here ...
102    |
103    = note: the temporary is part of an expression at the end of a block;
104            consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
105 help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
106    |
107 LL |     _y =         { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x } ; // `let x = ...; x`
108    |                                                     ^^^^^^^              ^^^
109
110 error[E0597]: `_t1` does not live long enough
111   --> $DIR/issue-54556-used-vs-unused-tails.rs:37:55
112    |
113 LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit()   }  // suggest `;`
114    |                                                     --^^^^-          -
115    |                                                     | |              |
116    |                                                     | |              `_t1` dropped here while still borrowed
117    |                                                     | |              ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
118    |                                                     | borrowed value does not live long enough
119    |                                                     a temporary with access to the borrow is created here ...
120    |
121 help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
122    |
123 LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit();   }  // suggest `;`
124    |                                                                   ^
125
126 error[E0597]: `_t1` does not live long enough
127   --> $DIR/issue-54556-used-vs-unused-tails.rs:40:55
128    |
129 LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end()   }   // `let x = ...; x`
130    |                                                     --^^^^-         -
131    |                                                     | |             |
132    |                                                     | |             `_t1` dropped here while still borrowed
133    |                                                     | |             ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D`
134    |                                                     | borrowed value does not live long enough
135    |                                                     a temporary with access to the borrow is created here ...
136    |
137    = note: the temporary is part of an expression at the end of a block;
138            consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
139 help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
140    |
141 LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x   }   // `let x = ...; x`
142    |                                                     ^^^^^^^              ^^^
143
144 error: aborting due to 9 previous errors
145
146 For more information about this error, try `rustc --explain E0597`.