]> git.lizzy.rs Git - rust.git/commitdiff
Yield is an expression form, not a statement.
authorDonough Liu <ldm2993593805@163.com>
Mon, 23 Dec 2019 13:07:13 +0000 (21:07 +0800)
committerDonough Liu <ldm2993593805@163.com>
Mon, 23 Dec 2019 13:07:13 +0000 (21:07 +0800)
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/path_utils.rs
src/librustc_typeck/check/expr.rs
src/test/ui/feature-gates/feature-gate-generators.rs
src/test/ui/feature-gates/feature-gate-generators.stderr
src/test/ui/generator/yield-in-const.rs
src/test/ui/generator/yield-in-const.stderr
src/test/ui/generator/yield-in-function.rs
src/test/ui/generator/yield-in-function.stderr
src/test/ui/generator/yield-in-static.rs
src/test/ui/generator/yield-in-static.stderr

index 4a6379e3bc155b157b849b6c4b85473e6330255b..0d136bd7d9cf9a437e5ea7fc7a0727113f01c00f 100644 (file)
@@ -1424,7 +1424,7 @@ fn check_for_invalidation_at_exit(
     }
 
     /// Reports an error if this is a borrow of local data.
-    /// This is called for all Yield statements on movable generators
+    /// This is called for all Yield expressions on movable generators
     fn check_for_local_borrow(&mut self, borrow: &BorrowData<'tcx>, yield_span: Span) {
         debug!("check_for_local_borrow({:?})", borrow);
 
index ea541bd93bc94d97cd7ee2fed7dfc7cac0265de2..23b4799643a6cfb6282b167ee692cb3c6425c6ab 100644 (file)
@@ -131,7 +131,7 @@ pub(super) fn is_active<'tcx>(
 }
 
 /// Determines if a given borrow is borrowing local data
-/// This is called for all Yield statements on movable generators
+/// This is called for all Yield expressions on movable generators
 pub(super) fn borrow_of_local_data(place: &Place<'_>) -> bool {
     match place.base {
         PlaceBase::Static(_) => false,
index 6ecf3ccd6e7ed65abf470a985cfad859cb201a75..479536a1c8f01900738d345e292cb004857114d0 100644 (file)
@@ -1775,7 +1775,7 @@ fn check_expr_yield(
                     self.tcx.sess,
                     expr.span,
                     E0627,
-                    "yield statement outside of generator literal"
+                    "yield expression outside of generator literal"
                 )
                 .emit();
             }
index 382d891feed8437b8a65397d8a83b8da7a516785..931fee13471267771c795ba0908c12b1db17efbf 100644 (file)
@@ -1,6 +1,6 @@
 fn main() {
     yield true; //~ ERROR yield syntax is experimental
-                //~^ ERROR yield statement outside of generator literal
+                //~^ ERROR yield expression outside of generator literal
 }
 
 #[cfg(FALSE)]
index 24b814b410c9d5582d41b76ffa40e8dfa51d769a..4adc21efc6a2125f21fb2bad85244725769e827b 100644 (file)
@@ -25,7 +25,7 @@ LL |     yield 0;
    = note: for more information, see https://github.com/rust-lang/rust/issues/43122
    = help: add `#![feature(generators)]` to the crate attributes to enable
 
-error[E0627]: yield statement outside of generator literal
+error[E0627]: yield expression outside of generator literal
   --> $DIR/feature-gate-generators.rs:2:5
    |
 LL |     yield true;
@@ -33,4 +33,5 @@ LL |     yield true;
 
 error: aborting due to 4 previous errors
 
-For more information about this error, try `rustc --explain E0658`.
+Some errors have detailed explanations: E0627, E0658.
+For more information about an error, try `rustc --explain E0627`.
index f6f11b9cb13dd639ae467a74a7df009dc0d2c459..fe5ca822ceca1ce39e09cb24b9b9a24aa3e34817 100644 (file)
@@ -1,6 +1,6 @@
 #![feature(generators)]
 
 const A: u8 = { yield 3u8; 3u8};
-//~^ ERROR yield statement outside
+//~^ ERROR yield expression outside
 
 fn main() {}
index 663bb70d7a07fd93018005c963d4c283c11ce83b..dcf4fe63e64bcf9622d83a768b8516df262ca495 100644 (file)
@@ -1,4 +1,4 @@
-error[E0627]: yield statement outside of generator literal
+error[E0627]: yield expression outside of generator literal
   --> $DIR/yield-in-const.rs:3:17
    |
 LL | const A: u8 = { yield 3u8; 3u8};
@@ -6,3 +6,4 @@ LL | const A: u8 = { yield 3u8; 3u8};
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0627`.
index b737d3b224035fb50908a9e5ef17640f6d43095d..29b811621de1efecb5d6472f9b20b7f7a88cb32b 100644 (file)
@@ -1,4 +1,4 @@
 #![feature(generators)]
 
 fn main() { yield; }
-//~^ ERROR yield statement outside
+//~^ ERROR yield expression outside
index e12b0e6843e41e6a593102cbe881b578184ed749..51cce198ca3b45a7d4da74f4274639f9a7f97707 100644 (file)
@@ -1,4 +1,4 @@
-error[E0627]: yield statement outside of generator literal
+error[E0627]: yield expression outside of generator literal
   --> $DIR/yield-in-function.rs:3:13
    |
 LL | fn main() { yield; }
@@ -6,3 +6,4 @@ LL | fn main() { yield; }
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0627`.
index 12c9ccea4cb78e5e3dbe052ccebc6ed3654a4d7c..d27fbb33ba10acfa67191812fa701543ef4719a3 100644 (file)
@@ -1,6 +1,6 @@
 #![feature(generators)]
 
 static B: u8 = { yield 3u8; 3u8};
-//~^ ERROR yield statement outside
+//~^ ERROR yield expression outside
 
 fn main() {}
index 220520c3862ca9821102223b55e535e0b223495f..d867f3ad345288b4fede56c3b6ab7e747650df40 100644 (file)
@@ -1,4 +1,4 @@
-error[E0627]: yield statement outside of generator literal
+error[E0627]: yield expression outside of generator literal
   --> $DIR/yield-in-static.rs:3:18
    |
 LL | static B: u8 = { yield 3u8; 3u8};
@@ -6,3 +6,4 @@ LL | static B: u8 = { yield 3u8; 3u8};
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0627`.