s/generator/coroutine/
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
//! Functions for reading and writing discriminants of multi-variant layouts (enums and generators).
|
||||
//! Functions for reading and writing discriminants of multi-variant layouts (enums and coroutines).
|
||||
|
||||
use rustc_middle::ty::layout::{LayoutOf, PrimitiveExt, TyAndLayout};
|
||||
use rustc_middle::{mir, ty};
|
||||
@@ -171,10 +171,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
adt.discriminants(*self.tcx).find(|(_, var)| var.val == discr_bits)
|
||||
}
|
||||
ty::Coroutine(def_id, args, _) => {
|
||||
let args = args.as_generator();
|
||||
let args = args.as_coroutine();
|
||||
args.discriminants(def_id, *self.tcx).find(|(_, var)| var.val == discr_bits)
|
||||
}
|
||||
_ => span_bug!(self.cur_span(), "tagged layout for non-adt non-generator"),
|
||||
_ => span_bug!(self.cur_span(), "tagged layout for non-adt non-coroutine"),
|
||||
}
|
||||
.ok_or_else(|| err_ub!(InvalidTag(Scalar::from_uint(tag_bits, tag_layout.size))))?;
|
||||
// Return the cast value, and the index.
|
||||
|
||||
@@ -42,10 +42,10 @@ where
|
||||
let index = index
|
||||
.try_into()
|
||||
.expect("more generic parameters than can fit into a `u32`");
|
||||
// Only recurse when generic parameters in fns, closures and generators
|
||||
// Only recurse when generic parameters in fns, closures and coroutines
|
||||
// are used and have to be instantiated.
|
||||
//
|
||||
// Just in case there are closures or generators within this subst,
|
||||
// Just in case there are closures or coroutines within this subst,
|
||||
// recurse.
|
||||
if unused_params.is_used(index) && subst.has_param() {
|
||||
return subst.visit_with(self);
|
||||
|
||||
@@ -171,8 +171,8 @@ fn write_path(out: &mut String, path: &[PathElem]) {
|
||||
Field(name) => write!(out, ".{name}"),
|
||||
EnumTag => write!(out, ".<enum-tag>"),
|
||||
Variant(name) => write!(out, ".<enum-variant({name})>"),
|
||||
CoroutineTag => write!(out, ".<generator-tag>"),
|
||||
CoroutineState(idx) => write!(out, ".<generator-state({})>", idx.index()),
|
||||
CoroutineTag => write!(out, ".<coroutine-tag>"),
|
||||
CoroutineState(idx) => write!(out, ".<coroutine-state({})>", idx.index()),
|
||||
CapturedVar(name) => write!(out, ".<captured-var({name})>"),
|
||||
TupleElem(idx) => write!(out, ".{idx}"),
|
||||
ArrayElem(idx) => write!(out, "[{idx}]"),
|
||||
@@ -216,7 +216,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
|
||||
|
||||
// Now we know we are projecting to a field, so figure out which one.
|
||||
match layout.ty.kind() {
|
||||
// generators and closures.
|
||||
// coroutines and closures.
|
||||
ty::Closure(def_id, _) | ty::Coroutine(def_id, _, _) => {
|
||||
let mut name = None;
|
||||
// FIXME this should be more descriptive i.e. CapturePlace instead of CapturedVar
|
||||
@@ -225,7 +225,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
|
||||
let captures = self.ecx.tcx.closure_captures(local_def_id);
|
||||
if let Some(captured_place) = captures.get(field) {
|
||||
// Sometimes the index is beyond the number of upvars (seen
|
||||
// for a generator).
|
||||
// for a coroutine).
|
||||
let var_hir_id = captured_place.get_root_variable();
|
||||
let node = self.ecx.tcx.hir().get(var_hir_id);
|
||||
if let hir::Node::Pat(pat) = node {
|
||||
|
||||
Reference in New Issue
Block a user