diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 4a6379e3bc1..0d136bd7d9c 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1424,7 +1424,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } /// 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); diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index ea541bd93bc..23b4799643a 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -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, diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 6ecf3ccd6e7..479536a1c8f 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -1775,7 +1775,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.tcx.sess, expr.span, E0627, - "yield statement outside of generator literal" + "yield expression outside of generator literal" ) .emit(); } diff --git a/src/test/ui/feature-gates/feature-gate-generators.rs b/src/test/ui/feature-gates/feature-gate-generators.rs index 382d891feed..931fee13471 100644 --- a/src/test/ui/feature-gates/feature-gate-generators.rs +++ b/src/test/ui/feature-gates/feature-gate-generators.rs @@ -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)] diff --git a/src/test/ui/feature-gates/feature-gate-generators.stderr b/src/test/ui/feature-gates/feature-gate-generators.stderr index 24b814b410c..4adc21efc6a 100644 --- a/src/test/ui/feature-gates/feature-gate-generators.stderr +++ b/src/test/ui/feature-gates/feature-gate-generators.stderr @@ -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`. diff --git a/src/test/ui/generator/yield-in-const.rs b/src/test/ui/generator/yield-in-const.rs index f6f11b9cb13..fe5ca822cec 100644 --- a/src/test/ui/generator/yield-in-const.rs +++ b/src/test/ui/generator/yield-in-const.rs @@ -1,6 +1,6 @@ #![feature(generators)] const A: u8 = { yield 3u8; 3u8}; -//~^ ERROR yield statement outside +//~^ ERROR yield expression outside fn main() {} diff --git a/src/test/ui/generator/yield-in-const.stderr b/src/test/ui/generator/yield-in-const.stderr index 663bb70d7a0..dcf4fe63e64 100644 --- a/src/test/ui/generator/yield-in-const.stderr +++ b/src/test/ui/generator/yield-in-const.stderr @@ -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`. diff --git a/src/test/ui/generator/yield-in-function.rs b/src/test/ui/generator/yield-in-function.rs index b737d3b2240..29b811621de 100644 --- a/src/test/ui/generator/yield-in-function.rs +++ b/src/test/ui/generator/yield-in-function.rs @@ -1,4 +1,4 @@ #![feature(generators)] fn main() { yield; } -//~^ ERROR yield statement outside +//~^ ERROR yield expression outside diff --git a/src/test/ui/generator/yield-in-function.stderr b/src/test/ui/generator/yield-in-function.stderr index e12b0e6843e..51cce198ca3 100644 --- a/src/test/ui/generator/yield-in-function.stderr +++ b/src/test/ui/generator/yield-in-function.stderr @@ -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`. diff --git a/src/test/ui/generator/yield-in-static.rs b/src/test/ui/generator/yield-in-static.rs index 12c9ccea4cb..d27fbb33ba1 100644 --- a/src/test/ui/generator/yield-in-static.rs +++ b/src/test/ui/generator/yield-in-static.rs @@ -1,6 +1,6 @@ #![feature(generators)] static B: u8 = { yield 3u8; 3u8}; -//~^ ERROR yield statement outside +//~^ ERROR yield expression outside fn main() {} diff --git a/src/test/ui/generator/yield-in-static.stderr b/src/test/ui/generator/yield-in-static.stderr index 220520c3862..d867f3ad345 100644 --- a/src/test/ui/generator/yield-in-static.stderr +++ b/src/test/ui/generator/yield-in-static.stderr @@ -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`.