]> git.lizzy.rs Git - rust.git/commitdiff
Rename suspend to yield
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Mon, 10 Jul 2017 19:11:31 +0000 (21:11 +0200)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Fri, 28 Jul 2017 13:46:24 +0000 (15:46 +0200)
43 files changed:
src/librustc/cfg/construct.rs
src/librustc/hir/intravisit.rs
src/librustc/hir/lowering.rs
src/librustc/hir/mod.rs
src/librustc/hir/print.rs
src/librustc/ich/impls_hir.rs
src/librustc/ich/impls_mir.rs
src/librustc/ich/impls_ty.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/liveness.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/region.rs
src/librustc/mir/mod.rs
src/librustc/mir/visit.rs
src/librustc/traits/project.rs
src/librustc/traits/util.rs
src/librustc/ty/mod.rs
src/librustc/ty/structural_impls.rs
src/librustc/ty/sty.rs
src/librustc_mir/build/expr/as_lvalue.rs
src/librustc_mir/build/expr/as_rvalue.rs
src/librustc_mir/build/expr/category.rs
src/librustc_mir/build/expr/into.rs
src/librustc_mir/build/mod.rs
src/librustc_mir/dataflow/drop_flag_effects.rs
src/librustc_mir/dataflow/mod.rs
src/librustc_mir/dataflow/move_paths/mod.rs
src/librustc_mir/hair/cx/expr.rs
src/librustc_mir/hair/mod.rs
src/librustc_mir/transform/elaborate_drops.rs
src/librustc_mir/transform/generator.rs
src/librustc_mir/transform/inline.rs
src/librustc_mir/transform/no_landing_pads.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/type_check.rs
src/librustc_passes/consts.rs
src/librustc_passes/mir_stats.rs
src/librustc_trans/collector.rs
src/librustc_trans/common.rs
src/librustc_trans/mir/analyze.rs
src/librustc_trans/mir/block.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/writeback.rs

index 36aeaba0c5ec6499e0fb5a6f97273784b3da6d7c..fb205655df29c36f4cacee0b2ffa4d72411d882a 100644 (file)
@@ -389,7 +389,7 @@ fn expr(&mut self, expr: &hir::Expr, pred: CFGIndex) -> CFGIndex {
             hir::ExprUnary(_, ref e) |
             hir::ExprField(ref e, _) |
             hir::ExprTupField(ref e, _) |
-            hir::ExprSuspend(ref e) |
+            hir::ExprYield(ref e) |
             hir::ExprRepeat(ref e, _) => {
                 self.straightline(expr, pred, Some(&**e).into_iter())
             }
index 47a0f67a640746f68e9b84676a675ebbae17f21c..9e4117033724f412310bec12d7e6dc7c16575b7f 100644 (file)
@@ -1045,7 +1045,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
                 visitor.visit_expr(input)
             }
         }
-        ExprSuspend(ref subexpression) => {
+        ExprYield(ref subexpression) => {
             visitor.visit_expr(subexpression);
         }
         ExprImplArg(id) => {
index 50c8763600fa5efd9f463ce031da2a637bcc4d52..3aa7149933cbae2b114cff797c469b306c053814 100644 (file)
@@ -2108,7 +2108,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 let expr = opt_expr.as_ref().map(|x| self.lower_expr(x)).unwrap_or_else(|| {
                     self.expr(e.span, hir::ExprTup(hir_vec![]), ThinVec::new())
                 });
-                hir::ExprSuspend(P(expr))
+                hir::ExprYield(P(expr))
             }
 
             ExprKind::ImplArg => {
index 28d5cf2472d7a16f94ffdf3dea9b316eac02fe78..40a745bcebfb3c13d2f4aac5e45d2f3c5322213a 100644 (file)
@@ -1069,8 +1069,8 @@ pub enum Expr_ {
     /// to be repeated; the second is the number of times to repeat it.
     ExprRepeat(P<Expr>, BodyId),
 
-    /// A suspension point for generators
-    ExprSuspend(P<Expr>),
+    /// A suspension point for generators. This is `yield <expr>` in Rust.
+    ExprYield(P<Expr>),
 
     /// The argument to a generator
     ExprImplArg(NodeId),
index b076fb7ff8122ca36dc8e7227fb3a08c1dcae3bd..d513719146282a6b70028569d1fbbb7584c7d94b 100644 (file)
@@ -1461,8 +1461,8 @@ pub fn print_expr(&mut self, expr: &hir::Expr) -> io::Result<()> {
 
                 self.pclose()?;
             }
-            hir::ExprSuspend(ref expr) => {
-                word(&mut self.s, "suspend ")?;
+            hir::ExprYield(ref expr) => {
+                word(&mut self.s, "yield ")?;
                 self.print_expr(&expr)?;
             }
             hir::ExprImplArg(_) => {
index d2cc186bad4330e9818077062240bcdf9c209213..39fa0cb44d09d1e6ff348c0029b5929b2bbe7bf3 100644 (file)
@@ -573,7 +573,7 @@ fn hash_stable<W: StableHasherResult>(&self,
                 hir::ExprBreak(..)      |
                 hir::ExprAgain(..)      |
                 hir::ExprRet(..)        |
-                hir::ExprSuspend(..)    |
+                hir::ExprYield(..)    |
                 hir::ExprImplArg(..)    |
                 hir::ExprInlineAsm(..)  |
                 hir::ExprRepeat(..)     |
@@ -654,7 +654,7 @@ fn hash_stable<W: StableHasherResult>(&self,
     ExprInlineAsm(asm, inputs, outputs),
     ExprStruct(path, fields, base),
     ExprRepeat(val, times),
-    ExprSuspend(val),
+    ExprYield(val),
     ExprImplArg(id)
 });
 
index d273c6c9c42f15a9dc15c99a2e099b68d96f59f7..63100f4c11a2ccf9fb68b39ae24a5f3de9ece4ea 100644 (file)
@@ -58,7 +58,7 @@ fn hash_stable<W: StableHasherResult>(&self,
             mir::TerminatorKind::Unreachable |
             mir::TerminatorKind::Drop { .. } |
             mir::TerminatorKind::DropAndReplace { .. } |
-            mir::TerminatorKind::Suspend { .. } |
+            mir::TerminatorKind::Yield { .. } |
             mir::TerminatorKind::Call { .. } => false,
         };
 
@@ -164,7 +164,7 @@ fn hash_stable<W: StableHasherResult>(&self,
                 target.hash_stable(hcx, hasher);
                 unwind.hash_stable(hcx, hasher);
             }
-            mir::TerminatorKind::Suspend { ref value,
+            mir::TerminatorKind::Yield { ref value,
                                         resume,
                                         drop } => {
                 value.hash_stable(hcx, hasher);
index 22f202a35ecf7d385cd01a467e922d6d5b004fa2..29f201f84c995a959a2cfe86bef4fd5b496aeb95 100644 (file)
@@ -144,7 +144,7 @@ fn hash_stable<W: StableHasherResult>(&self,
 
 impl_stable_hash_for!(struct ty::GenSig<'tcx> {
     impl_arg_ty,
-    suspend_ty,
+    yield_ty,
     return_ty
 });
 
index 945b612027b9ee4802a9e68f956e1f74f7f6451e..1154c82cd2edf08ff171e19277c0c07b2dd979d7 100644 (file)
@@ -525,7 +525,7 @@ pub fn walk_expr(&mut self, expr: &hir::Expr) {
                 self.consume_expr(&base);
             }
 
-            hir::ExprSuspend(ref value) => {
+            hir::ExprYield(ref value) => {
                 self.consume_expr(&value);
             }
 
index 1487ae5908e5d40554e59ab791856c14f0d3034f..98e742c694e9f4f6eb89832c4d8dfbca4a625e1d 100644 (file)
@@ -470,7 +470,7 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) {
       hir::ExprAgain(_) | hir::ExprLit(_) | hir::ExprRet(..) |
       hir::ExprBlock(..) | hir::ExprAssign(..) | hir::ExprAssignOp(..) |
       hir::ExprStruct(..) | hir::ExprRepeat(..) |
-      hir::ExprInlineAsm(..) | hir::ExprBox(..) | hir::ExprSuspend(..) |
+      hir::ExprInlineAsm(..) | hir::ExprBox(..) | hir::ExprYield(..) |
       hir::ExprType(..) | hir::ExprPath(hir::QPath::TypeRelative(..)) => {
           intravisit::walk_expr(ir, expr);
       }
@@ -1129,7 +1129,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
           hir::ExprCast(ref e, _) |
           hir::ExprType(ref e, _) |
           hir::ExprUnary(_, ref e) |
-          hir::ExprSuspend(ref e) |
+          hir::ExprYield(ref e) |
           hir::ExprRepeat(ref e, _) => {
             self.propagate_through_expr(&e, succ)
           }
@@ -1420,7 +1420,7 @@ fn check_expr<'a, 'tcx>(this: &mut Liveness<'a, 'tcx>, expr: &'tcx Expr) {
       hir::ExprBreak(..) | hir::ExprAgain(..) | hir::ExprLit(_) |
       hir::ExprBlock(..) | hir::ExprAddrOf(..) |
       hir::ExprStruct(..) | hir::ExprRepeat(..) | hir::ExprImplArg(_) |
-      hir::ExprClosure(..) | hir::ExprPath(_) | hir::ExprSuspend(..) |
+      hir::ExprClosure(..) | hir::ExprPath(_) | hir::ExprYield(..) |
       hir::ExprBox(..) | hir::ExprType(..) => {
         intravisit::walk_expr(this, expr);
       }
index bf5263e75da28cea47a63d504d5e738e70c5d5b0..92883ca1b11aeef73de72b8ed2a456a4e21c5e42 100644 (file)
@@ -620,7 +620,7 @@ pub fn cat_expr_unadjusted(&self, expr: &hir::Expr) -> McResult<cmt<'tcx>> {
           hir::ExprAddrOf(..) | hir::ExprCall(..) |
           hir::ExprAssign(..) | hir::ExprAssignOp(..) |
           hir::ExprClosure(..) | hir::ExprRet(..) |
-          hir::ExprUnary(..) | hir::ExprSuspend(..) |
+          hir::ExprUnary(..) | hir::ExprYield(..) |
           hir::ExprMethodCall(..) | hir::ExprCast(..) |
           hir::ExprArray(..) | hir::ExprTup(..) | hir::ExprIf(..) |
           hir::ExprBinary(..) | hir::ExprWhile(..) |
index 2d0269e5845fae5496a980d8f46963d877a90f42..b8b8476d54b467021034cb9950444bd4685bb045 100644 (file)
@@ -1158,7 +1158,7 @@ fn visit_body(&mut self, _body: &'tcx hir::Body) {
     }
 
     fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
-        if let hir::ExprSuspend(..) = expr.node {
+        if let hir::ExprYield(..) = expr.node {
             self.0 = true;
         }
 
index 9bfd7f175c275afb739a0e012da894868834e0ae..2c500aa9c6fe903ce1f9e443e2f50d8b8ef31286 100644 (file)
@@ -104,8 +104,8 @@ pub struct Mir<'tcx> {
     /// Return type of the function.
     pub return_ty: Ty<'tcx>,
 
-    /// Suspend type of the function, if it is a generator.
-    pub suspend_ty: Option<Ty<'tcx>>,
+    /// Yield type of the function, if it is a generator.
+    pub yield_ty: Option<Ty<'tcx>>,
 
     /// Generator drop glue
     pub generator_drop: Option<Box<Mir<'tcx>>>,
@@ -153,7 +153,7 @@ pub fn new(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
                visibility_scopes: IndexVec<VisibilityScope, VisibilityScopeData>,
                promoted: IndexVec<Promoted, Mir<'tcx>>,
                return_ty: Ty<'tcx>,
-               suspend_ty: Option<Ty<'tcx>>,
+               yield_ty: Option<Ty<'tcx>>,
                local_decls: IndexVec<Local, LocalDecl<'tcx>>,
                arg_count: usize,
                upvar_decls: Vec<UpvarDecl>,
@@ -169,7 +169,7 @@ pub fn new(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
             visibility_scopes,
             promoted,
             return_ty,
-            suspend_ty,
+            yield_ty,
             generator_drop: None,
             generator_layout: None,
             local_decls,
@@ -287,7 +287,7 @@ pub fn make_statement_nop(&mut self, location: Location) {
     visibility_scopes,
     promoted,
     return_ty,
-    suspend_ty,
+    yield_ty,
     generator_drop,
     generator_layout,
     local_decls,
@@ -590,7 +590,7 @@ pub enum TerminatorKind<'tcx> {
     },
 
     /// A suspend point
-    Suspend {
+    Yield {
         /// The value to return
         value: Operand<'tcx>,
         /// Where to resume to
@@ -638,8 +638,8 @@ pub fn successors(&self) -> Cow<[BasicBlock]> {
                 slice::ref_slice(t).into_cow(),
             Call { destination: None, cleanup: Some(ref c), .. } => slice::ref_slice(c).into_cow(),
             Call { destination: None, cleanup: None, .. } => (&[]).into_cow(),
-            Suspend { resume: t, drop: Some(c), .. } => vec![t, c].into_cow(),
-            Suspend { resume: ref t, drop: None, .. } => slice::ref_slice(t).into_cow(),
+            Yield { resume: t, drop: Some(c), .. } => vec![t, c].into_cow(),
+            Yield { resume: ref t, drop: None, .. } => slice::ref_slice(t).into_cow(),
             DropAndReplace { target, unwind: Some(unwind), .. } |
             Drop { target, unwind: Some(unwind), .. } => {
                 vec![target, unwind].into_cow()
@@ -667,8 +667,8 @@ pub fn successors_mut(&mut self) -> Vec<&mut BasicBlock> {
             Call { destination: Some((_, ref mut t)), cleanup: None, .. } => vec![t],
             Call { destination: None, cleanup: Some(ref mut c), .. } => vec![c],
             Call { destination: None, cleanup: None, .. } => vec![],
-            Suspend { resume: ref mut t, drop: Some(ref mut c), .. } => vec![t, c],
-            Suspend { resume: ref mut t, drop: None, .. } => vec![t],
+            Yield { resume: ref mut t, drop: Some(ref mut c), .. } => vec![t, c],
+            Yield { resume: ref mut t, drop: None, .. } => vec![t],
             DropAndReplace { ref mut target, unwind: Some(ref mut unwind), .. } |
             Drop { ref mut target, unwind: Some(ref mut unwind), .. } => vec![target, unwind],
             DropAndReplace { ref mut target, unwind: None, .. } |
@@ -750,7 +750,7 @@ pub fn fmt_head<W: Write>(&self, fmt: &mut W) -> fmt::Result {
             Return => write!(fmt, "return"),
             GeneratorDrop => write!(fmt, "generator_drop"),
             Resume => write!(fmt, "resume"),
-            Suspend { ref value, .. } => write!(fmt, "_1 = suspend({:?})", value),
+            Yield { ref value, .. } => write!(fmt, "_1 = suspend({:?})", value),
             Unreachable => write!(fmt, "unreachable"),
             Drop { ref location, .. } => write!(fmt, "drop({:?})", location),
             DropAndReplace { ref location, ref value, .. } =>
@@ -818,9 +818,9 @@ pub fn fmt_successor_labels(&self) -> Vec<Cow<'static, str>> {
             Call { destination: Some(_), cleanup: None, .. } => vec!["return".into_cow()],
             Call { destination: None, cleanup: Some(_), .. } => vec!["unwind".into_cow()],
             Call { destination: None, cleanup: None, .. } => vec![],
-            Suspend { drop: Some(_), .. } =>
+            Yield { drop: Some(_), .. } =>
                 vec!["resume".into_cow(), "drop".into_cow()],
-            Suspend { drop: None, .. } => vec!["resume".into_cow()],
+            Yield { drop: None, .. } => vec!["resume".into_cow()],
             DropAndReplace { unwind: None, .. } |
             Drop { unwind: None, .. } => vec!["return".into_cow()],
             DropAndReplace { unwind: Some(_), .. } |
@@ -1526,7 +1526,7 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
             visibility_scopes: self.visibility_scopes.clone(),
             promoted: self.promoted.fold_with(folder),
             return_ty: self.return_ty.fold_with(folder),
-            suspend_ty: self.suspend_ty.fold_with(folder),
+            yield_ty: self.yield_ty.fold_with(folder),
             generator_drop: self.generator_drop.fold_with(folder),
             generator_layout: self.generator_layout.fold_with(folder),
             local_decls: self.local_decls.fold_with(folder),
@@ -1542,7 +1542,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
         self.basic_blocks.visit_with(visitor) ||
         self.generator_drop.visit_with(visitor) ||
         self.generator_layout.visit_with(visitor) ||
-        self.suspend_ty.visit_with(visitor) ||
+        self.yield_ty.visit_with(visitor) ||
         self.promoted.visit_with(visitor)     ||
         self.return_ty.visit_with(visitor)    ||
         self.local_decls.visit_with(visitor)
@@ -1665,7 +1665,7 @@ fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
                 target,
                 unwind,
             },
-            Suspend { ref value, resume, drop } => Suspend {
+            Yield { ref value, resume, drop } => Yield {
                 value: value.fold_with(folder),
                 resume: resume,
                 drop: drop,
@@ -1719,7 +1719,7 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
             Drop { ref location, ..} => location.visit_with(visitor),
             DropAndReplace { ref location, ref value, ..} =>
                 location.visit_with(visitor) || value.visit_with(visitor),
-            Suspend { ref value, ..} =>
+            Yield { ref value, ..} =>
                 value.visit_with(visitor),
             Call { ref func, ref args, ref destination, .. } => {
                 let dest = if let Some((ref loc, _)) = *destination {
index bd162c090f75b11fb3f05ed35bded3c7a2156f13..325c87fded61a1bfd00b278873478ce81b34c335 100644 (file)
@@ -448,7 +448,7 @@ fn super_terminator_kind(&mut self,
                         cleanup.map(|t| self.visit_branch(block, t));
                     }
 
-                    TerminatorKind::Suspend { ref $($mutability)* value,
+                    TerminatorKind::Yield { ref $($mutability)* value,
                                               resume,
                                               drop } => {
                         self.visit_operand(value, source_location);
index 35b8b935815515c4a37b7645a70e369dc0e7038c..91d6fac26f1bbc2c674d8b5f0940eb94982c994c 100644 (file)
@@ -1156,7 +1156,7 @@ fn confirm_generator_candidate<'cx, 'gcx, 'tcx>(
     let gen_def_id = tcx.lang_items.gen_trait().unwrap();
 
     // Note: we unwrap the binder here but re-create it below (1)
-    let ty::Binder((trait_ref, suspend_ty, return_ty)) =
+    let ty::Binder((trait_ref, yield_ty, return_ty)) =
         tcx.generator_trait_ref_and_outputs(gen_def_id,
                                             obligation.predicate.trait_ref.self_ty(),
                                             gen_sig);
@@ -1165,7 +1165,7 @@ fn confirm_generator_candidate<'cx, 'gcx, 'tcx>(
     let ty = if name == Symbol::intern("Return") {
         return_ty
     } else if name == Symbol::intern("Yield") {
-        suspend_ty
+        yield_ty
     } else {
         bug!()
     };
index dd3c0d66a9cc24951f4ce1673795081ecf2d89f5..f0b812ff9687d0cce260feaf0c9b42947b397277 100644 (file)
@@ -523,7 +523,7 @@ pub fn generator_trait_ref_and_outputs(self,
             def_id: fn_trait_def_id,
             substs: self.mk_substs_trait(self_ty, &[sig.skip_binder().impl_arg_ty]),
         };
-        ty::Binder((trait_ref, sig.skip_binder().suspend_ty, sig.skip_binder().return_ty))
+        ty::Binder((trait_ref, sig.skip_binder().yield_ty, sig.skip_binder().return_ty))
     }
 
     pub fn impl_is_default(self, node_item_def_id: DefId) -> bool {
index cfcb0c062ad22bd9068854904e8706cf7f265d30..21a98bceedff3bea6589098c88e2b60897324581 100644 (file)
@@ -2030,7 +2030,7 @@ pub fn expr_is_lval(self, expr: &hir::Expr) -> bool {
             hir::ExprBox(..) |
             hir::ExprAddrOf(..) |
             hir::ExprBinary(..) |
-            hir::ExprSuspend(..) |
+            hir::ExprYield(..) |
             hir::ExprCast(..) => {
                 false
             }
index 25552889620763ac0e5b48bb75c3396f9d303e09..c70831cd551cf9f96c7c5413adb1696e7853f901 100644 (file)
@@ -304,11 +304,11 @@ fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lif
 impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> {
     type Lifted = ty::GenSig<'tcx>;
     fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
-        tcx.lift(&(self.impl_arg_ty, self.suspend_ty, self.return_ty))
-            .map(|(impl_arg_ty, suspend_ty, return_ty)| {
+        tcx.lift(&(self.impl_arg_ty, self.yield_ty, self.return_ty))
+            .map(|(impl_arg_ty, yield_ty, return_ty)| {
                 ty::GenSig {
                     impl_arg_ty,
-                    suspend_ty,
+                    yield_ty,
                     return_ty,
                 }
             })
@@ -638,14 +638,14 @@ impl<'tcx> TypeFoldable<'tcx> for ty::GenSig<'tcx> {
     fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
         ty::GenSig {
             impl_arg_ty: self.impl_arg_ty.fold_with(folder),
-            suspend_ty: self.suspend_ty.fold_with(folder),
+            yield_ty: self.yield_ty.fold_with(folder),
             return_ty: self.return_ty.fold_with(folder),
         }
     }
 
     fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
         self.impl_arg_ty.visit_with(visitor) ||
-        self.suspend_ty.visit_with(visitor) ||
+        self.yield_ty.visit_with(visitor) ||
         self.return_ty.visit_with(visitor)
     }
 }
index 7d703ebc8541fadbbaa214d9f2cc1f0b47051319..bd5f6a8e262542b3e0b75f3ef28f127a50bf90cf 100644 (file)
@@ -643,7 +643,7 @@ pub fn self_ty(&self) -> Ty<'tcx> {
 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
 pub struct GenSig<'tcx> {
     pub impl_arg_ty: Ty<'tcx>,
-    pub suspend_ty: Ty<'tcx>,
+    pub yield_ty: Ty<'tcx>,
     pub return_ty: Ty<'tcx>,
 }
 
@@ -652,8 +652,8 @@ pub struct GenSig<'tcx> {
 
 #[allow(warnings)]
 impl<'tcx> PolyGenSig<'tcx> {
-    pub fn suspend_ty(&self) -> ty::Binder<Ty<'tcx>> {
-        self.map_bound_ref(|sig| sig.suspend_ty)
+    pub fn yield_ty(&self) -> ty::Binder<Ty<'tcx>> {
+        self.map_bound_ref(|sig| sig.yield_ty)
     }
     pub fn return_ty(&self) -> ty::Binder<Ty<'tcx>> {
         self.map_bound_ref(|sig| sig.return_ty)
index 78175e0535101000b888188e64340d6ba88419e2..659a5e60364bfc5628b27eec0977b4ff1d583f6b 100644 (file)
@@ -121,7 +121,7 @@ fn expr_as_lvalue(&mut self,
             ExprKind::Return { .. } |
             ExprKind::Literal { .. } |
             ExprKind::InlineAsm { .. } |
-            ExprKind::Suspend { .. } |
+            ExprKind::Yield { .. } |
             ExprKind::Call { .. } => {
                 // these are not lvalues, so we need to make a temporary.
                 debug_assert!(match Category::of(&expr.kind) {
index 6af7bd056b4a3180b78e68f2d0b0256dee33a800..024b1a3483acf53eadb0b0bf2947fa0cc1fb5439 100644 (file)
@@ -239,7 +239,7 @@ fn expr_as_rvalue(&mut self,
                 block = unpack!(this.stmt_expr(block, expr));
                 block.and(this.unit_rvalue())
             }
-            ExprKind::Suspend { value } => {
+            ExprKind::Yield { value } => {
                 let value = unpack!(block = this.as_operand(block, scope, value));
                 let impl_arg_ty = this.impl_arg_ty.unwrap();
                 block = unpack!(this.build_drop(block,
@@ -248,7 +248,7 @@ fn expr_as_rvalue(&mut self,
                     impl_arg_ty));
                 let resume = this.cfg.start_new_block();
                 let cleanup = this.generator_drop_cleanup(expr_span);
-                this.cfg.terminate(block, source_info, TerminatorKind::Suspend {
+                this.cfg.terminate(block, source_info, TerminatorKind::Yield {
                     value: value,
                     resume: resume,
                     drop: cleanup,
index 0208dbf70349f689ddb76b9256e8def91af0f4e9..7f576666dcdcf477f13f5419314715e318fb04e4 100644 (file)
@@ -78,7 +78,7 @@ pub fn of<'tcx>(ek: &ExprKind<'tcx>) -> Option<Category> {
             ExprKind::Borrow { .. } |
             ExprKind::Assign { .. } |
             ExprKind::AssignOp { .. } |
-            ExprKind::Suspend { .. } |
+            ExprKind::Yield { .. } |
             ExprKind::InlineAsm { .. } =>
                 Some(Category::Rvalue(RvalueFunc::AsRvalue)),
 
index ee5b04d03be317f6fbadd4590f8ccd90a5595ad5..ef7533e8d49e71647efbb6bc503ef986089c5fe9 100644 (file)
@@ -284,7 +284,7 @@ pub fn into_expr(&mut self,
             ExprKind::Index { .. } |
             ExprKind::Deref { .. } |
             ExprKind::Literal { .. } |
-            ExprKind::Suspend { .. } |
+            ExprKind::Yield { .. } |
             ExprKind::ImplArg |
             ExprKind::Field { .. } => {
                 debug_assert!(match Category::of(&expr.kind).unwrap() {
index c0bf46dd0fa7c6848346f4596966c03fc3f0015d..9a8c43e328638e4fb055ecf8140b618fbfacfd3b 100644 (file)
@@ -119,14 +119,14 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
 
             let arguments = implicit_argument.into_iter().chain(explicit_arguments);
 
-            let (suspend_ty, impl_arg_ty, return_ty) = if body.is_generator() {
+            let (yield_ty, impl_arg_ty, return_ty) = if body.is_generator() {
                 let gen_sig = cx.tables().generator_sigs[&id].clone().unwrap();
-                (Some(gen_sig.suspend_ty), Some(gen_sig.impl_arg_ty), gen_sig.return_ty)
+                (Some(gen_sig.yield_ty), Some(gen_sig.impl_arg_ty), gen_sig.return_ty)
             } else {
                 (None, None, fn_sig.output())
             };
 
-            build::construct_fn(cx, id, arguments, abi, return_ty, suspend_ty, impl_arg_ty, body)
+            build::construct_fn(cx, id, arguments, abi, return_ty, yield_ty, impl_arg_ty, body)
         } else {
             build::construct_const(cx, body_id)
         };
@@ -342,7 +342,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
                                    arguments: A,
                                    abi: Abi,
                                    return_ty: Ty<'gcx>,
-                                   suspend_ty: Option<Ty<'gcx>>,
+                                   yield_ty: Option<Ty<'gcx>>,
                                    impl_arg_ty: Option<Ty<'gcx>>,
                                    body: &'gcx hir::Body)
                                    -> Mir<'tcx>
@@ -411,7 +411,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>,
         }).collect()
     });
 
-    let mut mir = builder.finish(upvar_decls, return_ty, suspend_ty);
+    let mut mir = builder.finish(upvar_decls, return_ty, yield_ty);
     mir.spread_arg = spread_arg;
     mir
 }
@@ -487,7 +487,7 @@ fn new(hir: Cx<'a, 'gcx, 'tcx>,
     fn finish(self,
               upvar_decls: Vec<UpvarDecl>,
               return_ty: Ty<'tcx>,
-              suspend_ty: Option<Ty<'tcx>>)
+              yield_ty: Option<Ty<'tcx>>)
               -> Mir<'tcx> {
         for (index, block) in self.cfg.basic_blocks.iter().enumerate() {
             if block.terminator.is_none() {
@@ -499,7 +499,7 @@ fn finish(self,
                  self.visibility_scopes,
                  IndexVec::new(),
                  return_ty,
-                 suspend_ty,
+                 yield_ty,
                  self.local_decls,
                  self.arg_count,
                  upvar_decls,
index 2f8e932a7382a741ea88370d32c4c4a2d2779a09..0b740e5f028344bd1a12f543464b8f78ef4955c8 100644 (file)
@@ -299,7 +299,7 @@ pub(crate) fn drop_flag_effects_for_location<'a, 'tcx, F>(
                                           move_data.rev_lookup.find(location),
                                           |moi| callback(moi, DropFlagState::Present))
                 }
-                mir::TerminatorKind::Suspend { .. } => {
+                mir::TerminatorKind::Yield { .. } => {
                     on_lookup_result_bits(tcx, mir, move_data,
                                           move_data.rev_lookup.find(&Mir::impl_arg_lvalue()),
                                           |moi| callback(moi, DropFlagState::Present))
index 6eebe9da9f08036fd674365f82c365863c73702e..6392bde9eaeb447401f909b43fb68a8eecd7cf47 100644 (file)
@@ -456,14 +456,14 @@ fn propagate_bits_into_graph_successors_of(
             mir::TerminatorKind::Unreachable => {}
             mir::TerminatorKind::Goto { ref target } |
             mir::TerminatorKind::Assert { ref target, cleanup: None, .. } |
-            mir::TerminatorKind::Suspend { resume: ref target, drop: None, .. } |
+            mir::TerminatorKind::Yield { resume: ref target, drop: None, .. } |
             mir::TerminatorKind::Drop { ref target, location: _, unwind: None } |
             mir::TerminatorKind::DropAndReplace {
                 ref target, value: _, location: _, unwind: None
             } => {
                 self.propagate_bits_into_entry_set_for(in_out, changed, target);
             }
-            mir::TerminatorKind::Suspend { resume: ref target, drop: Some(ref drop), .. } => {
+            mir::TerminatorKind::Yield { resume: ref target, drop: Some(ref drop), .. } => {
                 self.propagate_bits_into_entry_set_for(in_out, changed, target);
                 self.propagate_bits_into_entry_set_for(in_out, changed, drop);
             }
index cc12ae6abfc14e3a34ca9a8f898fb6136fb064e6..dba396e813980498ed0bce885a7b5c517ba42ff8 100644 (file)
@@ -474,7 +474,7 @@ fn gather_terminator(&mut self, loc: Location, term: &Terminator<'tcx>) {
                 // branching terminators - these don't move anything
             }
 
-            TerminatorKind::Suspend { ref value,  .. } => {
+            TerminatorKind::Yield { ref value,  .. } => {
                 self.create_move_path(&Mir::impl_arg_lvalue());
                 self.gather_operand(loc, value);
             }
index ca634ffef54465b826a979aaa001da5dee1e5e75..4a223ce61f74455965aae46527ce48aeafece7ce 100644 (file)
@@ -568,7 +568,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
         hir::ExprTup(ref fields) => ExprKind::Tuple { fields: fields.to_ref() },
 
         hir::ExprImplArg(_) => ExprKind::ImplArg,
-        hir::ExprSuspend(ref v) => ExprKind::Suspend { value: v.to_ref() },
+        hir::ExprYield(ref v) => ExprKind::Yield { value: v.to_ref() },
     };
 
     Expr {
index dece9a974f172027b689e8963fd3d0113ed0a899..a2e9e5c40f945c285096b3e85e394ee2eaa2b321 100644 (file)
@@ -250,7 +250,7 @@ pub enum ExprKind<'tcx> {
         inputs: Vec<ExprRef<'tcx>>
     },
     ImplArg,
-    Suspend {
+    Yield {
         value: ExprRef<'tcx>,
     },
 }
index 387d769e01f67eec8d242260defffd5baa4b4b4a..472623ec20ab32f912bd4540d682193cde6d0299 100644 (file)
@@ -100,7 +100,7 @@ fn find_dead_unwinds<'a, 'tcx>(
         let location = match bb_data.terminator().kind {
             TerminatorKind::Drop { ref location, unwind: Some(_), .. } |
             TerminatorKind::DropAndReplace { ref location, unwind: Some(_), .. } => location,
-            TerminatorKind::Suspend { .. } => &impl_arg,
+            TerminatorKind::Yield { .. } => &impl_arg,
             _ => continue,
         };
 
@@ -348,7 +348,7 @@ fn collect_drop_flags(&mut self)
             let location = match terminator.kind {
                 TerminatorKind::Drop { ref location, .. } |
                 TerminatorKind::DropAndReplace { ref location, .. } => location,
-                TerminatorKind::Suspend { .. } => &impl_arg,
+                TerminatorKind::Yield { .. } => &impl_arg,
                 _ => continue
             };
 
index a2c1cf415974d3e71e2f8dfcfdd6b2302ceee331..fc5834d605332754ccd207a03b6577097f87269a 100644 (file)
@@ -159,7 +159,7 @@ fn visit_basic_block_data(&mut self,
                 self.return_block,
                 Operand::Consume(Lvalue::Local(self.new_ret_local)),
                 None)),
-            TerminatorKind::Suspend { ref value, resume, drop } => Some((0,
+            TerminatorKind::Yield { ref value, resume, drop } => Some((0,
                 resume,
                 value.clone(),
                 drop)),
@@ -325,7 +325,7 @@ fn locals_live_across_suspend_points<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     liveness::dump_mir(tcx, "generator_liveness", source, mir, &result);
 
     for (block, data) in mir.basic_blocks().iter_enumerated() {
-        if let TerminatorKind::Suspend { .. } = data.terminator().kind {
+        if let TerminatorKind::Yield { .. } = data.terminator().kind {
             set.union(&result.outs[block]);
         }
     }
@@ -742,8 +742,8 @@ fn run_pass<'a, 'tcx>(&self,
                     tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     source: MirSource,
                     mir: &mut Mir<'tcx>) {
-        let suspend_ty = if let Some(suspend_ty) = mir.suspend_ty {
-            suspend_ty
+        let yield_ty = if let Some(yield_ty) = mir.yield_ty {
+            yield_ty
         } else {
             // This only applies to generators
             return
@@ -758,7 +758,7 @@ fn run_pass<'a, 'tcx>(&self,
 
         let state_did = tcx.lang_items.gen_state().unwrap();
         let state_adt_ref = tcx.adt_def(state_did);
-        let state_substs = tcx.mk_substs([Kind::from(suspend_ty),
+        let state_substs = tcx.mk_substs([Kind::from(yield_ty),
             Kind::from(mir.return_ty)].iter());
         let ret_ty = tcx.mk_adt(state_adt_ref, state_substs);
 
@@ -787,7 +787,7 @@ fn run_pass<'a, 'tcx>(&self,
         transform.visit_mir(mir);
 
         mir.return_ty = ret_ty;
-        mir.suspend_ty = None;
+        mir.yield_ty = None;
         mir.arg_count = 2;
         mir.spread_arg = None;
         mir.generator_layout = Some(layout);
index 1353be0046de34850ee960eb0534cdb3071ab5a7..e7ee68b104b41b34f59766ec3be6c1d2e75945e3 100644 (file)
@@ -176,7 +176,7 @@ fn should_inline(&self,
         }
 
         // Cannot inline generators which haven't been transformed yet
-        if callee_mir.suspend_ty.is_some() {
+        if callee_mir.yield_ty.is_some() {
             return false;
         }
 
@@ -657,7 +657,7 @@ fn visit_terminator_kind(&mut self, block: BasicBlock,
 
         match *kind {
             TerminatorKind::GeneratorDrop |
-            TerminatorKind::Suspend { .. } => bug!(),
+            TerminatorKind::Yield { .. } => bug!(),
             TerminatorKind::Goto { ref mut target} => {
                 *target = self.update_target(*target);
             }
index d68d702696f513b1dc935c5d87c9dec4fa6406bc..fa6bb644871dced4e11184f0bfa68d6f9eac738c 100644 (file)
@@ -44,7 +44,7 @@ fn visit_terminator(&mut self,
             TerminatorKind::Return |
             TerminatorKind::Unreachable |
             TerminatorKind::GeneratorDrop |
-            TerminatorKind::Suspend { .. } |
+            TerminatorKind::Yield { .. } |
             TerminatorKind::SwitchInt { .. } => {
                 /* nothing to do */
             },
index cb75dd9a5299970069088a6e6b57eb663c93d9d1..3ae0f8f2e82a28b036a0254b6b907a5a2f6f52ad 100644 (file)
@@ -377,7 +377,7 @@ fn qualify_const(&mut self) -> Qualif {
                 TerminatorKind::DropAndReplace { .. } |
                 TerminatorKind::Resume |
                 TerminatorKind::GeneratorDrop |
-                TerminatorKind::Suspend { .. } |
+                TerminatorKind::Yield { .. } |
                 TerminatorKind::Unreachable => None,
 
                 TerminatorKind::Return => {
index b196d8aca1f4d7aa2d9ffd2a93fabbb64cf521ac..38b9454f8962b6fe86fe6ed26d45a22dcc44eb12 100644 (file)
@@ -512,14 +512,14 @@ fn check_terminator(&mut self,
                     }
                 }
             }
-            TerminatorKind::Suspend { ref value, .. } => {
+            TerminatorKind::Yield { ref value, .. } => {
                 let value_ty = value.ty(mir, tcx);
-                match mir.suspend_ty {
-                    None => span_mirbug!(self, term, "suspend in non-generator"),
+                match mir.yield_ty {
+                    None => span_mirbug!(self, term, "yield in non-generator"),
                     Some(ty) if ty != value_ty => {
                         span_mirbug!(self,
                             term,
-                            "type of suspend value is ({:?}, but the suspend type is ({:?}",
+                            "type of yield value is ({:?}, but the yield type is ({:?}",
                             value_ty,
                             ty);
                     }
@@ -657,9 +657,9 @@ fn check_iscleanup(&mut self, mir: &Mir<'tcx>, block: &BasicBlockData<'tcx>)
                     span_mirbug!(self, block, "generator_drop in cleanup block")
                 }
             }
-            TerminatorKind::Suspend { resume, drop, .. } => {
+            TerminatorKind::Yield { resume, drop, .. } => {
                 if is_cleanup {
-                    span_mirbug!(self, block, "suspend in cleanup block")
+                    span_mirbug!(self, block, "yield in cleanup block")
                 }
                 self.assert_iscleanup(mir, block, resume, is_cleanup);
                 if let Some(drop) = drop {
index e3d665c4bcb1bf4532ac47c14952973a1c4e910a..b85218338065255244294693e96aecb3706e9ee4 100644 (file)
@@ -436,7 +436,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
         hir::ExprRet(_) |
 
         // Generator expressions
-        hir::ExprSuspend(_) |
+        hir::ExprYield(_) |
         hir::ExprImplArg(_) |
 
         // Expressions with side-effects.
index cc7df7acb499fd94b9831bf9f94092bd44f320aa..2e3c594e43c59aefee2f48d6cdd8caa163c53a55 100644 (file)
@@ -159,7 +159,7 @@ fn visit_terminator_kind(&mut self,
             TerminatorKind::Call { .. } => "TerminatorKind::Call",
             TerminatorKind::Assert { .. } => "TerminatorKind::Assert",
             TerminatorKind::GeneratorDrop => "TerminatorKind::GeneratorDrop",
-            TerminatorKind::Suspend { .. } => "TerminatorKind::Suspend",
+            TerminatorKind::Yield { .. } => "TerminatorKind::Yield",
         }, kind);
         self.super_terminator_kind(block, kind, location);
     }
index 57edb14a42d4145b09b3f6699c55628e4558eea7..559acd53a360299923e921ebf206e9a38f046b03 100644 (file)
@@ -630,7 +630,7 @@ fn visit_terminator_kind(&mut self,
             mir::TerminatorKind::Unreachable |
             mir::TerminatorKind::Assert { .. } => {}
             mir::TerminatorKind::GeneratorDrop |
-            mir::TerminatorKind::Suspend { .. } => bug!(),
+            mir::TerminatorKind::Yield { .. } => bug!(),
         }
 
         self.super_terminator_kind(block, kind, location);
index ebadba51bcf28e0b342b358324d02d8f7acb7dca..8cf22e2e4fea5cd42432715187eebed3c45a3154 100644 (file)
@@ -538,7 +538,7 @@ pub fn ty_fn_sig<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             sig.map_bound(|sig| {
                 let state_did = tcx.lang_items.gen_state().unwrap();
                 let state_adt_ref = tcx.adt_def(state_did);
-                let state_substs = tcx.mk_substs([Kind::from(sig.suspend_ty),
+                let state_substs = tcx.mk_substs([Kind::from(sig.yield_ty),
                     Kind::from(sig.return_ty)].iter());
                 let ret_ty = tcx.mk_adt(state_adt_ref, state_substs);
 
index 54f2af3c179bd767ba61f33d9e588d948be862c4..9ff32bb7088017111078bc9ac681ed60f5779194 100644 (file)
@@ -218,7 +218,7 @@ fn discover_masters<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>,
                 TerminatorKind::GeneratorDrop |
                 TerminatorKind::Unreachable |
                 TerminatorKind::SwitchInt { .. } |
-                TerminatorKind::Suspend { .. }  => {
+                TerminatorKind::Yield { .. }  => {
                     /* nothing to do */
                 }
                 TerminatorKind::Call { cleanup: unwind, .. } |
index a0369b80df0d83c79ea499a0d4208ab7d38ac2c0..edf833a26307ec050e2655fb271e59af91d8148b 100644 (file)
@@ -579,7 +579,7 @@ fn trans_terminator(&mut self,
                         cleanup);
             }
             mir::TerminatorKind::GeneratorDrop |
-            mir::TerminatorKind::Suspend { .. } => bug!("generator ops in trans"),
+            mir::TerminatorKind::Yield { .. } => bug!("generator ops in trans"),
         }
     }
 
index 40693d4d0ea70088b835a13d857dcbd549e7142f..d8cedb81ac8ee38b0f98112e1dc4b5b6f29bf633 100644 (file)
@@ -506,7 +506,7 @@ pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
 
     ret_coercion: Option<RefCell<DynamicCoerceMany<'gcx, 'tcx>>>,
 
-    suspend_ty: Option<Ty<'tcx>>,
+    yield_ty: Option<Ty<'tcx>>,
     impl_arg_ty: Option<Ty<'tcx>>,
 
     ps: RefCell<UnsafetyState>,
@@ -1037,7 +1037,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
             // Write the type to the impl arg id
             fcx.write_ty(impl_arg.id, impl_arg_ty);
 
-            fcx.suspend_ty = Some(fcx.next_ty_var(TypeVariableOrigin::TypeInference(span)));
+            fcx.yield_ty = Some(fcx.next_ty_var(TypeVariableOrigin::TypeInference(span)));
         }
     }
 
@@ -1062,7 +1062,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
     let gen_ty = if can_be_generator && body.is_generator() {
         let gen_sig = ty::GenSig {
             impl_arg_ty: fcx.impl_arg_ty.unwrap(),
-            suspend_ty: fcx.suspend_ty.unwrap(),
+            yield_ty: fcx.yield_ty.unwrap(),
             return_ty: ret_ty,
         };
         inherited.tables.borrow_mut().generator_sigs.insert(fn_id, Some(gen_sig));
@@ -1750,7 +1750,7 @@ pub fn new(inh: &'a Inherited<'a, 'gcx, 'tcx>,
             param_env,
             err_count_on_creation: inh.tcx.sess.err_count(),
             ret_coercion: None,
-            suspend_ty: None,
+            yield_ty: None,
             impl_arg_ty: None,
             ps: RefCell::new(UnsafetyState::function(hir::Unsafety::Normal,
                                                      ast::CRATE_NODE_ID)),
@@ -4008,8 +4008,8 @@ fn check_expr_kind(&self,
                 }
             }
           }
-          hir::ExprSuspend(ref value) => {
-            match self.suspend_ty {
+          hir::ExprYield(ref value) => {
+            match self.yield_ty {
                 Some(ty) => {
                     self.check_expr_coercable_to_type(&value, ty);
                 }
index 2b166d2418b742839be2dd4f2f9b4fd9969a0062..5c397a984371615cefbf5389a92b5d7e8e2acc85 100644 (file)
@@ -329,7 +329,7 @@ fn visit_generator_sigs(&mut self) {
         for (&node_id, gen_sig) in self.fcx.tables.borrow().generator_sigs.iter() {
             let gen_sig = gen_sig.map(|s| ty::GenSig {
                 impl_arg_ty: self.resolve(&s.impl_arg_ty, &node_id),
-                suspend_ty: self.resolve(&s.suspend_ty, &node_id),
+                yield_ty: self.resolve(&s.yield_ty, &node_id),
                 return_ty: self.resolve(&s.return_ty, &node_id),
             });
             self.tables.generator_sigs.insert(node_id, gen_sig);