You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/test/ui/generator/borrowing.nll.stderr
+9-2
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,17 @@ error[E0597]: `a` does not live long enough
2
2
--> $DIR/borrowing.rs:18:18
3
3
|
4
4
LL | unsafe { (|| yield &a).resume() }
5
-
| ^^^^^^^^^^^^^ borrowed value does not live long enough
5
+
| ^^^^^^^^^^^^^
6
+
| |
7
+
| borrowed value does not live long enough
8
+
| a temporary with access to the borrow is created here ...
6
9
LL | //~^ ERROR: `a` does not live long enough
7
10
LL | };
8
-
| - `a` dropped here while still borrowed
11
+
| -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator
12
+
| |
13
+
| `a` dropped here while still borrowed
14
+
|
15
+
= note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. 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.
Copy file name to clipboardExpand all lines: src/test/ui/issues/issue-18783.nll.stderr
+2-2
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ LL | c.push(Box::new(|| y = 0));
11
11
| second mutable borrow occurs here
12
12
LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time
13
13
LL | }
14
-
| - first borrow later used here, when `c` is dropped
14
+
| - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell<std::vec::Vec<std::boxed::Box<dyn std::ops::FnMut()>>>`
15
15
16
16
error[E0499]: cannot borrow `y` as mutable more than once at a time
LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time
28
28
LL | }
29
-
| - first borrow later used here, when `c` is dropped
29
+
| - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell<std::vec::Vec<std::boxed::Box<dyn std::ops::FnMut()>>>`
| - ... and the mutable borrow might be used here, when that temporary is dropped and runs the destructor for type `(std::option::Option<std::collections::binary_heap::PeekMut<'_, i32>>, ())`
Copy file name to clipboardExpand all lines: src/test/ui/span/destructor-restrictions.nll.stderr
+9-2
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,16 @@ error[E0597]: `*a` does not live long enough
2
2
--> $DIR/destructor-restrictions.rs:18:10
3
3
|
4
4
LL | *a.borrow() + 1
5
-
| ^ borrowed value does not live long enough
5
+
| ^---------
6
+
| |
7
+
| borrowed value does not live long enough
8
+
| a temporary with access to the borrow is created here ...
6
9
LL | }; //~^ ERROR `*a` does not live long enough
7
-
| - `*a` dropped here while still borrowed
10
+
| -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, i32>`
11
+
| |
12
+
| `*a` dropped here while still borrowed
13
+
|
14
+
= note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. 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.
| a temporary with access to the borrow is created here ...
6
9
LL | }
7
-
| - `y` dropped here while still borrowed
10
+
| -
11
+
| |
12
+
| `y` dropped here while still borrowed
13
+
| ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, std::string::String>`
14
+
|
15
+
= note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. 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.
| a temporary with access to the borrow is created here ...
14
25
LL | };
15
-
| - `y` dropped here while still borrowed
26
+
| -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, std::string::String>`
27
+
| |
28
+
| `y` dropped here while still borrowed
29
+
|
30
+
= note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. 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.
0 commit comments