diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-01-11 19:49:26 +0100 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2018-01-23 05:10:39 +0100 |
| commit | bae2988e6f12560ebe86bbff9daa75a7e81d59dc (patch) | |
| tree | 20b3602174bb3d88677cc1b0b698c9be02ccf5be | |
| parent | 9b57e60f030e9a6b8b633e7ddfaaed611a8a9a36 (diff) | |
| download | rust-bae2988e6f12560ebe86bbff9daa75a7e81d59dc.tar.gz rust-bae2988e6f12560ebe86bbff9daa75a7e81d59dc.zip | |
Fix yield-while-local-borrowed.rs test
| -rw-r--r-- | src/test/ui/generator/yield-while-local-borrowed.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/generator/yield-while-local-borrowed.stderr | 38 |
2 files changed, 42 insertions, 8 deletions
diff --git a/src/test/ui/generator/yield-while-local-borrowed.rs b/src/test/ui/generator/yield-while-local-borrowed.rs index 504f3e8739f..11bd4ed05ca 100644 --- a/src/test/ui/generator/yield-while-local-borrowed.rs +++ b/src/test/ui/generator/yield-while-local-borrowed.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// compile-flags: -Z borrowck=compare + #![feature(generators, generator_trait)] use std::ops::{GeneratorState, Generator}; @@ -19,7 +21,9 @@ fn borrow_local_inline() { // (This error occurs because the region shows up in the type of // `b` and gets extended by region inference.) let mut b = move || { - let a = &3; + let a = &mut 3; + //~^ ERROR borrow may still be in use when generator yields (Ast) + //~| ERROR borrow may still be in use when generator yields (Mir) yield(); println!("{}", a); }; @@ -30,7 +34,7 @@ fn borrow_local_inline_done() { // No error here -- `a` is not in scope at the point of `yield`. let mut b = move || { { - let a = &3; + let a = &mut 3; } yield(); }; @@ -45,7 +49,9 @@ fn borrow_local() { let mut b = move || { let a = 3; { - let b = &a; //~ ERROR + let b = &a; + //~^ ERROR borrow may still be in use when generator yields (Ast) + //~| ERROR borrow may still be in use when generator yields (Mir) yield(); println!("{}", b); } diff --git a/src/test/ui/generator/yield-while-local-borrowed.stderr b/src/test/ui/generator/yield-while-local-borrowed.stderr index 2fe6c686ce3..7961dd97441 100644 --- a/src/test/ui/generator/yield-while-local-borrowed.stderr +++ b/src/test/ui/generator/yield-while-local-borrowed.stderr @@ -1,10 +1,38 @@ -error[E0626]: borrow may still be in use when generator yields - --> $DIR/yield-while-local-borrowed.rs:48:22 +error[E0626]: borrow may still be in use when generator yields (Mir) + --> $DIR/yield-while-local-borrowed.rs:24:17 | -48 | let b = &a; //~ ERROR +24 | let a = &mut 3; + | ^^^^^^ +... +27 | yield(); + | ------- possible yield occurs here + +error[E0626]: borrow may still be in use when generator yields (Ast) + --> $DIR/yield-while-local-borrowed.rs:24:22 + | +24 | let a = &mut 3; + | ^ +... +27 | yield(); + | ------- possible yield occurs here + +error[E0626]: borrow may still be in use when generator yields (Ast) + --> $DIR/yield-while-local-borrowed.rs:52:22 + | +52 | let b = &a; | ^ -49 | yield(); +... +55 | yield(); + | ------- possible yield occurs here + +error[E0626]: borrow may still be in use when generator yields (Mir) + --> $DIR/yield-while-local-borrowed.rs:52:21 + | +52 | let b = &a; + | ^^ +... +55 | yield(); | ------- possible yield occurs here -error: aborting due to previous error +error: aborting due to 4 previous errors |
