s/generator/coroutine/
This commit is contained in:
parent
60956837cf
commit
e96ce20b34
468 changed files with 2201 additions and 2197 deletions
|
@ -860,13 +860,13 @@ where
|
|||
let ty = self.place_ty(self.place);
|
||||
match ty.kind() {
|
||||
ty::Closure(_, args) => self.open_drop_for_tuple(&args.as_closure().upvar_tys()),
|
||||
// Note that `elaborate_drops` only drops the upvars of a generator,
|
||||
// Note that `elaborate_drops` only drops the upvars of a coroutine,
|
||||
// and this is ok because `open_drop` here can only be reached
|
||||
// within that own generator's resume function.
|
||||
// within that own coroutine's resume function.
|
||||
// This should only happen for the self argument on the resume function.
|
||||
// It effectively only contains upvars until the generator transformation runs.
|
||||
// See librustc_body/transform/generator.rs for more details.
|
||||
ty::Coroutine(_, args, _) => self.open_drop_for_tuple(&args.as_generator().upvar_tys()),
|
||||
// It effectively only contains upvars until the coroutine transformation runs.
|
||||
// See librustc_body/transform/coroutine.rs for more details.
|
||||
ty::Coroutine(_, args, _) => self.open_drop_for_tuple(&args.as_coroutine().upvar_tys()),
|
||||
ty::Tuple(fields) => self.open_drop_for_tuple(fields),
|
||||
ty::Adt(def, args) => self.open_drop_for_adt(*def, args),
|
||||
ty::Dynamic(..) => self.complete_drop(self.succ, self.unwind),
|
||||
|
|
|
@ -267,7 +267,7 @@ where
|
|||
|
||||
mir::TerminatorKind::Yield { resume, resume_arg, .. } => {
|
||||
self.write_row(w, "", "(on yield resume)", |this, w, fmt| {
|
||||
let state_on_generator_drop = this.results.get().clone();
|
||||
let state_on_coroutine_drop = this.results.get().clone();
|
||||
this.results.apply_custom_effect(|analysis, state| {
|
||||
analysis.apply_call_return_effect(
|
||||
state,
|
||||
|
@ -283,7 +283,7 @@ where
|
|||
fmt = fmt,
|
||||
diff = diff_pretty(
|
||||
this.results.get(),
|
||||
&state_on_generator_drop,
|
||||
&state_on_coroutine_drop,
|
||||
this.results.analysis()
|
||||
),
|
||||
)
|
||||
|
|
|
@ -114,7 +114,7 @@ pub trait AnalysisDomain<'tcx> {
|
|||
//
|
||||
// FIXME: For backward dataflow analyses, the initial state should be applied to every basic
|
||||
// block where control flow could exit the MIR body (e.g., those terminated with `return` or
|
||||
// `resume`). It's not obvious how to handle `yield` points in generators, however.
|
||||
// `resume`). It's not obvious how to handle `yield` points in coroutines, however.
|
||||
fn initialize_start_block(&self, body: &mir::Body<'tcx>, state: &mut Self::Domain);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{AnalysisDomain, GenKill, GenKillAnalysis};
|
|||
///
|
||||
/// At present, this is used as a very limited form of alias analysis. For example,
|
||||
/// `MaybeBorrowedLocals` is used to compute which locals are live during a yield expression for
|
||||
/// immovable generators.
|
||||
/// immovable coroutines.
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct MaybeBorrowedLocals;
|
||||
|
||||
|
|
|
@ -763,7 +763,7 @@ fn switch_on_enum_discriminant<'mir, 'tcx>(
|
|||
ty::Adt(def, _) => return Some((*discriminated, *def)),
|
||||
|
||||
// `Rvalue::Discriminant` is also used to get the active yield point for a
|
||||
// generator, but we do not need edge-specific effects in that case. This may
|
||||
// coroutine, but we do not need edge-specific effects in that case. This may
|
||||
// change in the future.
|
||||
ty::Coroutine(..) => return None,
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ where
|
|||
{
|
||||
fn visit_place(&mut self, place: &mir::Place<'tcx>, context: PlaceContext, location: Location) {
|
||||
if let PlaceContext::MutatingUse(MutatingUseContext::Yield) = context {
|
||||
// The resume place is evaluated and assigned to only after generator resumes, so its
|
||||
// The resume place is evaluated and assigned to only after coroutine resumes, so its
|
||||
// effect is handled separately in `call_resume_effect`.
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, '_, 'tcx> {
|
|||
|
||||
// Note that we do *not* gen the `resume_arg` of `Yield` terminators. The reason for
|
||||
// that is that a `yield` will return from the function, and `resume_arg` is written
|
||||
// only when the generator is later resumed. Unlike `Call`, this doesn't require the
|
||||
// only when the coroutine is later resumed. Unlike `Call`, this doesn't require the
|
||||
// place to have storage *before* the yield, only after.
|
||||
TerminatorKind::Yield { .. } => {}
|
||||
|
||||
|
|
|
@ -915,7 +915,7 @@ impl Map {
|
|||
) {
|
||||
for sibling in self.children(parent) {
|
||||
let elem = self.places[sibling].proj_elem;
|
||||
// Only invalidate variants and discriminant. Fields (for generators) are not
|
||||
// Only invalidate variants and discriminant. Fields (for coroutines) are not
|
||||
// invalidated by assignment to a variant.
|
||||
if let Some(TrackElem::Variant(..) | TrackElem::Discriminant) = elem
|
||||
// Only invalidate the other variants, the current one is fine.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue