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())
}
visitor.visit_expr(input)
}
}
- ExprSuspend(ref subexpression) => {
+ ExprYield(ref subexpression) => {
visitor.visit_expr(subexpression);
}
ExprImplArg(id) => {
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 => {
/// 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),
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(_) => {
hir::ExprBreak(..) |
hir::ExprAgain(..) |
hir::ExprRet(..) |
- hir::ExprSuspend(..) |
+ hir::ExprYield(..) |
hir::ExprImplArg(..) |
hir::ExprInlineAsm(..) |
hir::ExprRepeat(..) |
ExprInlineAsm(asm, inputs, outputs),
ExprStruct(path, fields, base),
ExprRepeat(val, times),
- ExprSuspend(val),
+ ExprYield(val),
ExprImplArg(id)
});
mir::TerminatorKind::Unreachable |
mir::TerminatorKind::Drop { .. } |
mir::TerminatorKind::DropAndReplace { .. } |
- mir::TerminatorKind::Suspend { .. } |
+ mir::TerminatorKind::Yield { .. } |
mir::TerminatorKind::Call { .. } => false,
};
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);
impl_stable_hash_for!(struct ty::GenSig<'tcx> {
impl_arg_ty,
- suspend_ty,
+ yield_ty,
return_ty
});
self.consume_expr(&base);
}
- hir::ExprSuspend(ref value) => {
+ hir::ExprYield(ref value) => {
self.consume_expr(&value);
}
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);
}
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)
}
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);
}
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(..) |
}
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
- if let hir::ExprSuspend(..) = expr.node {
+ if let hir::ExprYield(..) = expr.node {
self.0 = true;
}
/// 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>>>,
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>,
visibility_scopes,
promoted,
return_ty,
- suspend_ty,
+ yield_ty,
generator_drop: None,
generator_layout: None,
local_decls,
visibility_scopes,
promoted,
return_ty,
- suspend_ty,
+ yield_ty,
generator_drop,
generator_layout,
local_decls,
},
/// A suspend point
- Suspend {
+ Yield {
/// The value to return
value: Operand<'tcx>,
/// Where to resume to
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()
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, .. } |
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, .. } =>
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(_), .. } |
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),
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)
target,
unwind,
},
- Suspend { ref value, resume, drop } => Suspend {
+ Yield { ref value, resume, drop } => Yield {
value: value.fold_with(folder),
resume: resume,
drop: drop,
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 {
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);
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);
let ty = if name == Symbol::intern("Return") {
return_ty
} else if name == Symbol::intern("Yield") {
- suspend_ty
+ yield_ty
} else {
bug!()
};
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 {
hir::ExprBox(..) |
hir::ExprAddrOf(..) |
hir::ExprBinary(..) |
- hir::ExprSuspend(..) |
+ hir::ExprYield(..) |
hir::ExprCast(..) => {
false
}
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,
}
})
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)
}
}
#[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>,
}
#[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)
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) {
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,
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,
ExprKind::Borrow { .. } |
ExprKind::Assign { .. } |
ExprKind::AssignOp { .. } |
- ExprKind::Suspend { .. } |
+ ExprKind::Yield { .. } |
ExprKind::InlineAsm { .. } =>
Some(Category::Rvalue(RvalueFunc::AsRvalue)),
ExprKind::Index { .. } |
ExprKind::Deref { .. } |
ExprKind::Literal { .. } |
- ExprKind::Suspend { .. } |
+ ExprKind::Yield { .. } |
ExprKind::ImplArg |
ExprKind::Field { .. } => {
debug_assert!(match Category::of(&expr.kind).unwrap() {
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)
};
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>
}).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
}
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() {
self.visibility_scopes,
IndexVec::new(),
return_ty,
- suspend_ty,
+ yield_ty,
self.local_decls,
self.arg_count,
upvar_decls,
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))
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);
}
// 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);
}
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 {
inputs: Vec<ExprRef<'tcx>>
},
ImplArg,
- Suspend {
+ Yield {
value: ExprRef<'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,
};
let location = match terminator.kind {
TerminatorKind::Drop { ref location, .. } |
TerminatorKind::DropAndReplace { ref location, .. } => location,
- TerminatorKind::Suspend { .. } => &impl_arg,
+ TerminatorKind::Yield { .. } => &impl_arg,
_ => continue
};
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)),
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]);
}
}
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
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);
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);
}
// 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;
}
match *kind {
TerminatorKind::GeneratorDrop |
- TerminatorKind::Suspend { .. } => bug!(),
+ TerminatorKind::Yield { .. } => bug!(),
TerminatorKind::Goto { ref mut target} => {
*target = self.update_target(*target);
}
TerminatorKind::Return |
TerminatorKind::Unreachable |
TerminatorKind::GeneratorDrop |
- TerminatorKind::Suspend { .. } |
+ TerminatorKind::Yield { .. } |
TerminatorKind::SwitchInt { .. } => {
/* nothing to do */
},
TerminatorKind::DropAndReplace { .. } |
TerminatorKind::Resume |
TerminatorKind::GeneratorDrop |
- TerminatorKind::Suspend { .. } |
+ TerminatorKind::Yield { .. } |
TerminatorKind::Unreachable => None,
TerminatorKind::Return => {
}
}
}
- 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);
}
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 {
hir::ExprRet(_) |
// Generator expressions
- hir::ExprSuspend(_) |
+ hir::ExprYield(_) |
hir::ExprImplArg(_) |
// Expressions with side-effects.
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);
}
mir::TerminatorKind::Unreachable |
mir::TerminatorKind::Assert { .. } => {}
mir::TerminatorKind::GeneratorDrop |
- mir::TerminatorKind::Suspend { .. } => bug!(),
+ mir::TerminatorKind::Yield { .. } => bug!(),
}
self.super_terminator_kind(block, kind, location);
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);
TerminatorKind::GeneratorDrop |
TerminatorKind::Unreachable |
TerminatorKind::SwitchInt { .. } |
- TerminatorKind::Suspend { .. } => {
+ TerminatorKind::Yield { .. } => {
/* nothing to do */
}
TerminatorKind::Call { cleanup: unwind, .. } |
cleanup);
}
mir::TerminatorKind::GeneratorDrop |
- mir::TerminatorKind::Suspend { .. } => bug!("generator ops in trans"),
+ mir::TerminatorKind::Yield { .. } => bug!("generator ops in trans"),
}
}
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>,
// 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)));
}
}
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));
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)),
}
}
}
- 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);
}
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);