Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created June 28, 2018 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikomatsakis/9087bf03e4d061252005267808ab7f00 to your computer and use it in GitHub Desktop.
Save nikomatsakis/9087bf03e4d061252005267808ab7f00 to your computer and use it in GitHub Desktop.
modified src/test/ui/generator/borrowing.nll.stderr
@@ -2,15 +2,10 @@ error[E0597]: `a` does not live long enough
--> $DIR/borrowing.rs:18:18
|
LL | unsafe { (|| yield &a).resume() }
- | ^^^^^^^^^^^^^
- | |
- | borrowed value does not live long enough
- | borrow may end up in a temporary, created here
+ | ^^^^^^^^^^^^^ borrowed value does not live long enough
LL | //~^ ERROR: `a` does not live long enough
LL | };
- | -- temporary later dropped here, potentially using the reference
- | |
- | borrowed value only lives until here
+ | - borrowed value only lives until here
error[E0597]: `a` does not live long enough
--> $DIR/borrowing.rs:24:9
modified src/test/ui/generator/ref-escapes-but-not-over-yield.nll.stderr
@@ -1,19 +1,11 @@
error[E0597]: `b` does not live long enough
--> $DIR/ref-escapes-but-not-over-yield.rs:24:13
|
-LL | let mut b = move || {
- | _________________-
-LL | | yield();
-LL | | let b = 5;
-LL | | a = &b;
- | | ^^ borrowed value does not live long enough
-LL | | //~^ ERROR `b` does not live long enough
-LL | | };
- | | -
- | | |
- | | borrowed value only lives until here
- | |_____temporary later dropped here, potentially using the reference
- | borrow may end up in a temporary, created here
+LL | a = &b;
+ | ^^ borrowed value does not live long enough
+LL | //~^ ERROR `b` does not live long enough
+LL | };
+ | - borrowed value only lives until here
error: aborting due to previous error
modified src/test/ui/generator/yield-while-iterating.nll.stderr
@@ -19,7 +19,8 @@ LL | | };
LL | println!("{}", x[0]); //~ ERROR
| ^ immutable borrow occurs here
LL | b.resume();
- | - borrow later used here
+LL | }
+ | - borrow later used here, when `b` is dropped
error: aborting due to 2 previous errors
modified src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr
@@ -11,7 +11,8 @@ LL | | };
LL | println!("{}", x); //~ ERROR
| ^ borrow occurs here
LL | b.resume();
- | - borrow later used here
+LL | }
+ | - borrow later used here, when `b` is dropped
error: aborting due to previous error
modified src/test/ui/issue-47646.stderr
@@ -3,15 +3,9 @@ error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as m
|
LL | let borrow = heap.peek_mut();
| ---- mutable borrow occurs here
-LL |
-LL | match (borrow, ()) {
- | ------------ borrow may end up in a temporary, created here
-LL | (Some(_), ()) => {
+...
LL | println!("{:?}", heap); //~ ERROR cannot borrow `heap` as immutable
| ^^^^ immutable borrow occurs here
-...
-LL | };
- | - temporary later dropped here, potentially using the reference
error: aborting due to previous error
modified src/test/ui/span/destructor-restrictions.nll.stderr
@@ -2,14 +2,9 @@ error[E0597]: `*a` does not live long enough
--> $DIR/destructor-restrictions.rs:18:10
|
LL | *a.borrow() + 1
- | ^---------
- | |
- | borrowed value does not live long enough
- | borrow may end up in a temporary, created here
+ | ^ borrowed value does not live long enough
LL | }; //~^ ERROR `*a` does not live long enough
- | -- temporary later dropped here, potentially using the reference
- | |
- | borrowed value only lives until here
+ | - borrowed value only lives until here
error: aborting due to previous error
modified src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr
@@ -2,28 +2,17 @@ error[E0597]: `y` does not live long enough
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5
|
LL | y.borrow().clone()
- | ^---------
- | |
- | borrowed value does not live long enough
- | borrow may end up in a temporary, created here
+ | ^ borrowed value does not live long enough
LL | }
- | -
- | |
- | borrowed value only lives until here
- | temporary later dropped here, potentially using the reference
+ | - borrowed value only lives until here
error[E0597]: `y` does not live long enough
--> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9
|
LL | y.borrow().clone()
- | ^---------
- | |
- | borrowed value does not live long enough
- | borrow may end up in a temporary, created here
+ | ^ borrowed value does not live long enough
LL | };
- | -- temporary later dropped here, potentially using the reference
- | |
- | borrowed value only lives until here
+ | - borrowed value only lives until here
error: aborting due to 2 previous errors
modified src/test/ui/span/send-is-not-static-std-sync.nll.stderr
@@ -50,8 +50,8 @@ LL | tx.send(&*y);
LL | drop(y); //~ ERROR cannot move out
| ^ move out of `y` occurs here
...
-LL | tx.send(&z).unwrap();
- | -- borrow later used here
+LL | }
+ | - borrow later used here, when `tx` is dropped
error[E0597]: `z` does not live long enough
--> $DIR/send-is-not-static-std-sync.rs:56:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment