about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2017-07-15 23:32:52 +0200
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2017-07-28 15:46:27 +0200
commit6106f6c5c15e11a8a4eb8e021bab48d1fd3d42c7 (patch)
tree51cf91566132e3d1744c90bdbdb00c83acab48d6
parent0a8b81a568864c16a887cc3b82a39b4f15495d39 (diff)
downloadrust-6106f6c5c15e11a8a4eb8e021bab48d1fd3d42c7.tar.gz
rust-6106f6c5c15e11a8a4eb8e021bab48d1fd3d42c7.zip
Fix error message tests
-rw-r--r--src/librustc_borrowck/diagnostics.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc_borrowck/diagnostics.rs b/src/librustc_borrowck/diagnostics.rs
index 69b07912e57..f8511bc9c7d 100644
--- a/src/librustc_borrowck/diagnostics.rs
+++ b/src/librustc_borrowck/diagnostics.rs
@@ -1189,6 +1189,7 @@ yield point.
 
 ```compile_fail,E0624
 # #![feature(generators)]
+# use std::ops::Generator;
 let mut b = || {
     let a = &3; // <-- This borrow...
     yield (); // ...is still in scope here, when the yield occurs.
@@ -1206,6 +1207,7 @@ the integer by value:
 
 ```
 # #![feature(generators)]
+# use std::ops::Generator;
 let mut b = || {
     let a = 3;
     yield ();
@@ -1222,6 +1224,7 @@ This error also frequently arises with iteration:
 
 ```compile_fail,E0624
 # #![feature(generators)]
+# use std::ops::Generator;
 let mut b = || {
   let v = vec![1,2,3];
   for &x in &v { // <-- borrow of `v` is still in scope...
@@ -1236,6 +1239,7 @@ Such cases can sometimes be resolved by iterating "by value" (or using
 
 ```
 # #![feature(generators)]
+# use std::ops::Generator;
 let mut b = || {
   let v = vec![1,2,3];
   for x in v { // <-- Take ownership of the values instead!
@@ -1249,6 +1253,7 @@ If taking ownership is not an option, using indices can work too:
 
 ```
 # #![feature(generators)]
+# use std::ops::Generator;
 let mut b = || {
   let v = vec![1,2,3];
   let len = v.len(); // (*)