1
Fork 0

Remove GeneratorWitness and rename GeneratorWitnessMIR.

This commit is contained in:
Camille GILLOT 2023-08-03 13:47:04 +00:00
parent 855a75b6d6
commit 44ac8dcc71
60 changed files with 91 additions and 333 deletions

View file

@ -426,7 +426,6 @@ fn push_debuginfo_type_name<'tcx>(
| ty::Placeholder(..) | ty::Placeholder(..)
| ty::Alias(..) | ty::Alias(..)
| ty::Bound(..) | ty::Bound(..)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..) => { | ty::GeneratorWitness(..) => {
bug!( bug!(
"debuginfo: Trying to create type name for \ "debuginfo: Trying to create type name for \

View file

@ -152,7 +152,7 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
// FIXME(oli-obk): we can probably encode closures just like structs // FIXME(oli-obk): we can probably encode closures just like structs
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) |ty::GeneratorWitnessMIR(..)=> Err(ValTreeCreationError::NonSupportedType), | ty::GeneratorWitness(..) => Err(ValTreeCreationError::NonSupportedType),
} }
} }
@ -280,7 +280,6 @@ pub fn valtree_to_const_value<'tcx>(
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::FnPtr(_) | ty::FnPtr(_)
| ty::RawPtr(_) | ty::RawPtr(_)
| ty::Str | ty::Str

View file

@ -963,7 +963,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
| ty::Ref(..) | ty::Ref(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..) | ty::Array(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Never | ty::Never

View file

@ -100,8 +100,7 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
| ty::Dynamic(_, _, _) | ty::Dynamic(_, _, _)
| ty::Closure(_, _) | ty::Closure(_, _)
| ty::Generator(_, _, _) | ty::Generator(_, _, _)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(_, _)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Error(_) => ConstValue::from_target_usize(0u64, &tcx), | ty::Error(_) => ConstValue::from_target_usize(0u64, &tcx),

View file

@ -583,7 +583,6 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
| ty::Bound(..) | ty::Bound(..)
| ty::Param(..) | ty::Param(..)
| ty::Alias(..) | ty::Alias(..)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..) => bug!("Encountered invalid type {:?}", ty), | ty::GeneratorWitness(..) => bug!("Encountered invalid type {:?}", ty),
} }
} }

View file

@ -64,8 +64,7 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
ty::Alias(ty::Weak, _) => bug!("type_name: unexpected weak projection"), ty::Alias(ty::Weak, _) => bug!("type_name: unexpected weak projection"),
ty::Alias(ty::Inherent, _) => bug!("type_name: unexpected inherent projection"), ty::Alias(ty::Inherent, _) => bug!("type_name: unexpected inherent projection"),
ty::GeneratorWitness(_) => bug!("type_name: unexpected `GeneratorWitness`"), ty::GeneratorWitness(..) => bug!("type_name: unexpected `GeneratorWitness`"),
ty::GeneratorWitnessMIR(..) => bug!("type_name: unexpected `GeneratorWitnessMIR`"),
} }
} }

View file

@ -157,7 +157,6 @@ impl<'tcx> InherentCollect<'tcx> {
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Bound(..) | ty::Bound(..)
| ty::Placeholder(_) | ty::Placeholder(_)
| ty::Infer(_) => { | ty::Infer(_) => {

View file

@ -245,7 +245,6 @@ fn do_orphan_check_impl<'tcx>(
ty::Closure(..) ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Bound(..) | ty::Bound(..)
| ty::Placeholder(..) | ty::Placeholder(..)
| ty::Infer(..) => { | ty::Infer(..) => {

View file

@ -314,11 +314,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
// types, where we use Error as the Self type // types, where we use Error as the Self type
} }
ty::Placeholder(..) ty::Placeholder(..) | ty::GeneratorWitness(..) | ty::Bound(..) | ty::Infer(..) => {
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Bound(..)
| ty::Infer(..) => {
bug!("unexpected type encountered in variance inference: {}", ty); bug!("unexpected type encountered in variance inference: {}", ty);
} }
} }

View file

@ -129,7 +129,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
| ty::Float(_) | ty::Float(_)
| ty::Array(..) | ty::Array(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::RawPtr(_) | ty::RawPtr(_)
| ty::Ref(..) | ty::Ref(..)
| ty::FnDef(..) | ty::FnDef(..)

View file

@ -535,7 +535,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.tcx, self.tcx,
self.tcx.typeck_root_def_id(expr_def_id.to_def_id()), self.tcx.typeck_root_def_id(expr_def_id.to_def_id()),
); );
let witness = Ty::new_generator_witness_mir(self.tcx, expr_def_id.to_def_id(), args); let witness = Ty::new_generator_witness(self.tcx, expr_def_id.to_def_id(), args);
// Unify `interior` with `witness` and collect all the resulting obligations. // Unify `interior` with `witness` and collect all the resulting obligations.
let span = self.tcx.hir().body(body_id).value.span; let span = self.tcx.hir().body(body_id).value.span;

View file

@ -459,7 +459,6 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
ty::Closure(..) ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Bool | ty::Bool
| ty::Char | ty::Char
| ty::Int(..) | ty::Int(..)

View file

@ -119,26 +119,6 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
.obligations, .obligations,
); );
} }
// Optimization of GeneratorWitness relation since we know that all
// free regions are replaced with bound regions during construction.
// This greatly speeds up equating of GeneratorWitness.
(&ty::GeneratorWitness(a_types), &ty::GeneratorWitness(b_types)) => {
let a_types = infcx.tcx.anonymize_bound_vars(a_types);
let b_types = infcx.tcx.anonymize_bound_vars(b_types);
if a_types.bound_vars() == b_types.bound_vars() {
let (a_types, b_types) = infcx.instantiate_binder_with_placeholders(
a_types.map_bound(|a_types| (a_types, b_types.skip_binder())),
);
for (a, b) in std::iter::zip(a_types, b_types) {
self.relate(a, b)?;
}
} else {
return Err(ty::error::TypeError::Sorts(ty::relate::expected_found(
self, a, b,
)));
}
}
_ => { _ => {
self.fields.infcx.super_combine_tys(self, a, b)?; self.fields.infcx.super_combine_tys(self, a, b)?;
} }

View file

@ -112,7 +112,7 @@ fn compute_components<'tcx>(
} }
// All regions are bound inside a witness // All regions are bound inside a witness
ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => (), ty::GeneratorWitness(..) => (),
// OutlivesTypeParameterEnv -- the actual checking that `X:'a` // OutlivesTypeParameterEnv -- the actual checking that `X:'a`
// is implied by the environment is done in regionck. // is implied by the environment is done in regionck.

View file

@ -147,25 +147,6 @@ impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
); );
Ok(a) Ok(a)
} }
// Optimization of GeneratorWitness relation since we know that all
// free regions are replaced with bound regions during construction.
// This greatly speeds up subtyping of GeneratorWitness.
(&ty::GeneratorWitness(a_types), &ty::GeneratorWitness(b_types)) => {
let a_types = infcx.tcx.anonymize_bound_vars(a_types);
let b_types = infcx.tcx.anonymize_bound_vars(b_types);
if a_types.bound_vars() == b_types.bound_vars() {
let (a_types, b_types) = infcx.instantiate_binder_with_placeholders(
a_types.map_bound(|a_types| (a_types, b_types.skip_binder())),
);
for (a, b) in std::iter::zip(a_types, b_types) {
self.relate(a, b)?;
}
Ok(a)
} else {
Err(ty::error::TypeError::Sorts(ty::relate::expected_found(self, a, b)))
}
}
_ => { _ => {
self.fields.infcx.super_combine_tys(self, a, b)?; self.fields.infcx.super_combine_tys(self, a, b)?;
Ok(a) Ok(a)

View file

@ -1271,7 +1271,6 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Placeholder(..) | ty::Placeholder(..)
| ty::FnDef(..) => bug!("unexpected type in foreign function: {:?}", ty), | ty::FnDef(..) => bug!("unexpected type in foreign function: {:?}", ty),
} }

View file

@ -1384,7 +1384,6 @@ impl<'tcx> TyCtxt<'tcx> {
Placeholder, Placeholder,
Generator, Generator,
GeneratorWitness, GeneratorWitness,
GeneratorWitnessMIR,
Dynamic, Dynamic,
Closure, Closure,
Tuple, Tuple,

View file

@ -242,8 +242,7 @@ impl<'tcx> Ty<'tcx> {
ty::Dynamic(..) => "trait object".into(), ty::Dynamic(..) => "trait object".into(),
ty::Closure(..) => "closure".into(), ty::Closure(..) => "closure".into(),
ty::Generator(def_id, ..) => tcx.generator_kind(def_id).unwrap().descr().into(), ty::Generator(def_id, ..) => tcx.generator_kind(def_id).unwrap().descr().into(),
ty::GeneratorWitness(..) | ty::GeneratorWitness(..) => "generator witness".into(),
ty::GeneratorWitnessMIR(..) => "generator witness".into(),
ty::Infer(ty::TyVar(_)) => "inferred type".into(), ty::Infer(ty::TyVar(_)) => "inferred type".into(),
ty::Infer(ty::IntVar(_)) => "integer".into(), ty::Infer(ty::IntVar(_)) => "integer".into(),
ty::Infer(ty::FloatVar(_)) => "floating-point number".into(), ty::Infer(ty::FloatVar(_)) => "floating-point number".into(),
@ -295,7 +294,7 @@ impl<'tcx> Ty<'tcx> {
ty::Dynamic(..) => "trait object".into(), ty::Dynamic(..) => "trait object".into(),
ty::Closure(..) => "closure".into(), ty::Closure(..) => "closure".into(),
ty::Generator(def_id, ..) => tcx.generator_kind(def_id).unwrap().descr().into(), ty::Generator(def_id, ..) => tcx.generator_kind(def_id).unwrap().descr().into(),
ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => "generator witness".into(), ty::GeneratorWitness(..) => "generator witness".into(),
ty::Tuple(..) => "tuple".into(), ty::Tuple(..) => "tuple".into(),
ty::Placeholder(..) => "higher-ranked type".into(), ty::Placeholder(..) => "higher-ranked type".into(),
ty::Bound(..) => "bound type variable".into(), ty::Bound(..) => "bound type variable".into(),

View file

@ -29,8 +29,7 @@ pub enum SimplifiedType {
Trait(DefId), Trait(DefId),
Closure(DefId), Closure(DefId),
Generator(DefId), Generator(DefId),
GeneratorWitness(usize), GeneratorWitness(DefId),
GeneratorWitnessMIR(DefId),
Function(usize), Function(usize),
Placeholder, Placeholder,
} }
@ -130,10 +129,7 @@ pub fn simplify_type<'tcx>(
ty::Ref(_, _, mutbl) => Some(SimplifiedType::Ref(mutbl)), ty::Ref(_, _, mutbl) => Some(SimplifiedType::Ref(mutbl)),
ty::FnDef(def_id, _) | ty::Closure(def_id, _) => Some(SimplifiedType::Closure(def_id)), ty::FnDef(def_id, _) | ty::Closure(def_id, _) => Some(SimplifiedType::Closure(def_id)),
ty::Generator(def_id, _, _) => Some(SimplifiedType::Generator(def_id)), ty::Generator(def_id, _, _) => Some(SimplifiedType::Generator(def_id)),
ty::GeneratorWitness(tys) => { ty::GeneratorWitness(def_id, _) => Some(SimplifiedType::GeneratorWitness(def_id)),
Some(SimplifiedType::GeneratorWitness(tys.skip_binder().len()))
}
ty::GeneratorWitnessMIR(def_id, _) => Some(SimplifiedType::GeneratorWitnessMIR(def_id)),
ty::Never => Some(SimplifiedType::Never), ty::Never => Some(SimplifiedType::Never),
ty::Tuple(tys) => Some(SimplifiedType::Tuple(tys.len())), ty::Tuple(tys) => Some(SimplifiedType::Tuple(tys.len())),
ty::FnPtr(f) => Some(SimplifiedType::Function(f.skip_binder().inputs().len())), ty::FnPtr(f) => Some(SimplifiedType::Function(f.skip_binder().inputs().len())),
@ -169,7 +165,7 @@ impl SimplifiedType {
| SimplifiedType::Trait(d) | SimplifiedType::Trait(d)
| SimplifiedType::Closure(d) | SimplifiedType::Closure(d)
| SimplifiedType::Generator(d) | SimplifiedType::Generator(d)
| SimplifiedType::GeneratorWitnessMIR(d) => Some(d), | SimplifiedType::GeneratorWitness(d) => Some(d),
_ => None, _ => None,
} }
} }
@ -240,7 +236,6 @@ impl DeepRejectCtxt {
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Placeholder(..) | ty::Placeholder(..)
| ty::Bound(..) | ty::Bound(..)
| ty::Infer(_) => bug!("unexpected impl_ty: {impl_ty}"), | ty::Infer(_) => bug!("unexpected impl_ty: {impl_ty}"),
@ -342,7 +337,7 @@ impl DeepRejectCtxt {
ty::Error(_) => true, ty::Error(_) => true,
ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => { ty::GeneratorWitness(..) => {
bug!("unexpected obligation type: {:?}", obligation_ty) bug!("unexpected obligation type: {:?}", obligation_ty)
} }
} }

View file

@ -127,11 +127,7 @@ impl FlagComputation {
self.add_ty(args.tupled_upvars_ty()); self.add_ty(args.tupled_upvars_ty());
} }
&ty::GeneratorWitness(ts) => { ty::GeneratorWitness(_, args) => {
self.bound_computation(ts, |flags, ts| flags.add_tys(ts));
}
ty::GeneratorWitnessMIR(_, args) => {
let should_remove_further_specializable = let should_remove_further_specializable =
!self.flags.contains(TypeFlags::STILL_FURTHER_SPECIALIZABLE); !self.flags.contains(TypeFlags::STILL_FURTHER_SPECIALIZABLE);
self.add_args(args); self.add_args(args);

View file

@ -810,7 +810,6 @@ where
| ty::Never | ty::Never
| ty::FnDef(..) | ty::FnDef(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Foreign(..) | ty::Foreign(..)
| ty::Dynamic(_, _, ty::Dyn) => { | ty::Dynamic(_, _, ty::Dyn) => {
bug!("TyAndLayout::field({:?}): not applicable", this) bug!("TyAndLayout::field({:?}): not applicable", this)

View file

@ -157,9 +157,9 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReverseMapper<'tcx> {
Ty::new_generator(self.tcx, def_id, args, movability) Ty::new_generator(self.tcx, def_id, args, movability)
} }
ty::GeneratorWitnessMIR(def_id, args) => { ty::GeneratorWitness(def_id, args) => {
let args = self.fold_closure_args(def_id, args); let args = self.fold_closure_args(def_id, args);
Ty::new_generator_witness_mir(self.tcx, def_id, args) Ty::new_generator_witness(self.tcx, def_id, args)
} }
ty::Param(param) => { ty::Param(param) => {

View file

@ -271,7 +271,7 @@ fn characteristic_def_id_of_type_cached<'a>(
ty::FnDef(def_id, _) ty::FnDef(def_id, _)
| ty::Closure(def_id, _) | ty::Closure(def_id, _)
| ty::Generator(def_id, _, _) | ty::Generator(def_id, _, _)
| ty::GeneratorWitnessMIR(def_id, _) | ty::GeneratorWitness(def_id, _)
| ty::Foreign(def_id) => Some(def_id), | ty::Foreign(def_id) => Some(def_id),
ty::Bool ty::Bool
@ -286,7 +286,6 @@ fn characteristic_def_id_of_type_cached<'a>(
| ty::Infer(_) | ty::Infer(_)
| ty::Bound(..) | ty::Bound(..)
| ty::Error(_) | ty::Error(_)
| ty::GeneratorWitness(..)
| ty::Never | ty::Never
| ty::Float(_) => None, | ty::Float(_) => None,
} }

View file

@ -838,10 +838,7 @@ pub trait PrettyPrinter<'tcx>:
p!("}}") p!("}}")
} }
ty::GeneratorWitness(types) => { ty::GeneratorWitness(did, args) => {
p!(in_binder(&types));
}
ty::GeneratorWitnessMIR(did, args) => {
p!(write("{{")); p!(write("{{"));
if !self.tcx().sess.verbose() { if !self.tcx().sess.verbose() {
p!("generator witness"); p!("generator witness");

View file

@ -453,24 +453,14 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
Ok(Ty::new_generator(tcx, a_id, args, movability)) Ok(Ty::new_generator(tcx, a_id, args, movability))
} }
(&ty::GeneratorWitness(a_types), &ty::GeneratorWitness(b_types)) => { (&ty::GeneratorWitness(a_id, a_args), &ty::GeneratorWitness(b_id, b_args))
// Wrap our types with a temporary GeneratorWitness struct
// inside the binder so we can related them
let a_types = a_types.map_bound(GeneratorWitness);
let b_types = b_types.map_bound(GeneratorWitness);
// Then remove the GeneratorWitness for the result
let types = relation.relate(a_types, b_types)?.map_bound(|witness| witness.0);
Ok(Ty::new_generator_witness(tcx, types))
}
(&ty::GeneratorWitnessMIR(a_id, a_args), &ty::GeneratorWitnessMIR(b_id, b_args))
if a_id == b_id => if a_id == b_id =>
{ {
// All GeneratorWitness types with the same id represent // All GeneratorWitness types with the same id represent
// the (anonymous) type of the same generator expression. So // the (anonymous) type of the same generator expression. So
// all of their regions should be equated. // all of their regions should be equated.
let args = relation.relate(a_args, b_args)?; let args = relation.relate(a_args, b_args)?;
Ok(Ty::new_generator_witness_mir(tcx, a_id, args)) Ok(Ty::new_generator_witness(tcx, a_id, args))
} }
(&ty::Closure(a_id, a_args), &ty::Closure(b_id, b_args)) if a_id == b_id => { (&ty::Closure(a_id, a_args), &ty::Closure(b_id, b_args)) if a_id == b_id => {

View file

@ -657,9 +657,8 @@ impl<'tcx> TypeSuperFoldable<TyCtxt<'tcx>> for Ty<'tcx> {
ty::Generator(did, args, movability) => { ty::Generator(did, args, movability) => {
ty::Generator(did, args.try_fold_with(folder)?, movability) ty::Generator(did, args.try_fold_with(folder)?, movability)
} }
ty::GeneratorWitness(types) => ty::GeneratorWitness(types.try_fold_with(folder)?), ty::GeneratorWitness(did, args) => {
ty::GeneratorWitnessMIR(did, args) => { ty::GeneratorWitness(did, args.try_fold_with(folder)?)
ty::GeneratorWitnessMIR(did, args.try_fold_with(folder)?)
} }
ty::Closure(did, args) => ty::Closure(did, args.try_fold_with(folder)?), ty::Closure(did, args) => ty::Closure(did, args.try_fold_with(folder)?),
ty::Alias(kind, data) => ty::Alias(kind, data.try_fold_with(folder)?), ty::Alias(kind, data) => ty::Alias(kind, data.try_fold_with(folder)?),
@ -708,8 +707,7 @@ impl<'tcx> TypeSuperVisitable<TyCtxt<'tcx>> for Ty<'tcx> {
ty.visit_with(visitor) ty.visit_with(visitor)
} }
ty::Generator(_did, ref args, _) => args.visit_with(visitor), ty::Generator(_did, ref args, _) => args.visit_with(visitor),
ty::GeneratorWitness(ref types) => types.visit_with(visitor), ty::GeneratorWitness(_did, ref args) => args.visit_with(visitor),
ty::GeneratorWitnessMIR(_did, ref args) => args.visit_with(visitor),
ty::Closure(_did, ref args) => args.visit_with(visitor), ty::Closure(_did, ref args) => args.visit_with(visitor),
ty::Alias(_, ref data) => data.visit_with(visitor), ty::Alias(_, ref data) => data.visit_with(visitor),

View file

@ -2164,19 +2164,11 @@ impl<'tcx> Ty<'tcx> {
#[inline] #[inline]
pub fn new_generator_witness( pub fn new_generator_witness(
tcx: TyCtxt<'tcx>,
types: ty::Binder<'tcx, &'tcx List<Ty<'tcx>>>,
) -> Ty<'tcx> {
Ty::new(tcx, GeneratorWitness(types))
}
#[inline]
pub fn new_generator_witness_mir(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
id: DefId, id: DefId,
args: GenericArgsRef<'tcx>, args: GenericArgsRef<'tcx>,
) -> Ty<'tcx> { ) -> Ty<'tcx> {
Ty::new(tcx, GeneratorWitnessMIR(id, args)) Ty::new(tcx, GeneratorWitness(id, args))
} }
// misc // misc
@ -2706,7 +2698,6 @@ impl<'tcx> Ty<'tcx> {
| ty::Dynamic(..) | ty::Dynamic(..)
| ty::Closure(..) | ty::Closure(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Error(_) | ty::Error(_)
@ -2742,7 +2733,6 @@ impl<'tcx> Ty<'tcx> {
| ty::Ref(..) | ty::Ref(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..) | ty::Array(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Never | ty::Never
@ -2831,7 +2821,6 @@ impl<'tcx> Ty<'tcx> {
| ty::Ref(..) | ty::Ref(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..) | ty::Array(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Never | ty::Never
@ -2894,7 +2883,7 @@ impl<'tcx> Ty<'tcx> {
// anything with custom metadata it might be more complicated. // anything with custom metadata it might be more complicated.
ty::Ref(_, _, hir::Mutability::Not) | ty::RawPtr(..) => false, ty::Ref(_, _, hir::Mutability::Not) | ty::RawPtr(..) => false,
ty::Generator(..) | ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => false, ty::Generator(..) | ty::GeneratorWitness(..) => false,
// Might be, but not "trivial" so just giving the safe answer. // Might be, but not "trivial" so just giving the safe answer.
ty::Adt(..) | ty::Closure(..) => false, ty::Adt(..) | ty::Closure(..) => false,
@ -2970,8 +2959,7 @@ impl<'tcx> Ty<'tcx> {
| Dynamic(_, _, _) | Dynamic(_, _, _)
| Closure(_, _) | Closure(_, _)
| Generator(_, _, _) | Generator(_, _, _)
| GeneratorWitness(_) | GeneratorWitness(..)
| GeneratorWitnessMIR(_, _)
| Never | Never
| Tuple(_) => true, | Tuple(_) => true,
Error(_) | Infer(_) | Alias(_, _) | Param(_) | Bound(_, _) | Placeholder(_) => false, Error(_) | Infer(_) | Alias(_, _) | Param(_) | Bound(_, _) | Placeholder(_) => false,

View file

@ -855,7 +855,7 @@ impl<'tcx> OpaqueTypeExpander<'tcx> {
let hidden_ty = bty.instantiate(self.tcx, args); let hidden_ty = bty.instantiate(self.tcx, args);
self.fold_ty(hidden_ty); self.fold_ty(hidden_ty);
} }
let expanded_ty = Ty::new_generator_witness_mir(self.tcx, def_id, args); let expanded_ty = Ty::new_generator_witness(self.tcx, def_id, args);
self.expanded_cache.insert((def_id, args), expanded_ty); self.expanded_cache.insert((def_id, args), expanded_ty);
expanded_ty expanded_ty
} }
@ -888,7 +888,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for OpaqueTypeExpander<'tcx> {
t t
}; };
if self.expand_generators { if self.expand_generators {
if let ty::GeneratorWitnessMIR(def_id, args) = *t.kind() { if let ty::GeneratorWitness(def_id, args) = *t.kind() {
t = self.expand_generator(def_id, args).unwrap_or(t); t = self.expand_generator(def_id, args).unwrap_or(t);
} }
} }
@ -1025,8 +1025,7 @@ impl<'tcx> Ty<'tcx> {
| ty::Dynamic(..) | ty::Dynamic(..)
| ty::Foreign(_) | ty::Foreign(_)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Infer(_) | ty::Infer(_)
| ty::Alias(..) | ty::Alias(..)
| ty::Param(_) | ty::Param(_)
@ -1065,8 +1064,7 @@ impl<'tcx> Ty<'tcx> {
| ty::Dynamic(..) | ty::Dynamic(..)
| ty::Foreign(_) | ty::Foreign(_)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Infer(_) | ty::Infer(_)
| ty::Alias(..) | ty::Alias(..)
| ty::Param(_) | ty::Param(_)
@ -1194,10 +1192,7 @@ impl<'tcx> Ty<'tcx> {
false false
} }
ty::Foreign(_) ty::Foreign(_) | ty::GeneratorWitness(..) | ty::Error(_) => false,
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Error(_) => false,
} }
} }
@ -1293,7 +1288,6 @@ pub fn needs_drop_components<'tcx>(
| ty::FnPtr(_) | ty::FnPtr(_)
| ty::Char | ty::Char
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::RawPtr(_) | ty::RawPtr(_)
| ty::Ref(..) | ty::Ref(..)
| ty::Str => Ok(SmallVec::new()), | ty::Str => Ok(SmallVec::new()),
@ -1364,11 +1358,7 @@ pub fn is_trivially_const_drop(ty: Ty<'_>) -> bool {
// Not trivial because they have components, and instead of looking inside, // Not trivial because they have components, and instead of looking inside,
// we'll just perform trait selection. // we'll just perform trait selection.
ty::Closure(..) ty::Closure(..) | ty::Generator(..) | ty::GeneratorWitness(..) | ty::Adt(..) => false,
| ty::Generator(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::Adt(..) => false,
ty::Array(ty, _) | ty::Slice(ty) => is_trivially_const_drop(ty), ty::Array(ty, _) | ty::Slice(ty) => is_trivially_const_drop(ty),

View file

@ -190,14 +190,11 @@ fn push_inner<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent: GenericArg<'tcx>)
ty::Adt(_, args) ty::Adt(_, args)
| ty::Closure(_, args) | ty::Closure(_, args)
| ty::Generator(_, args, _) | ty::Generator(_, args, _)
| ty::GeneratorWitnessMIR(_, args) | ty::GeneratorWitness(_, args)
| ty::FnDef(_, args) => { | ty::FnDef(_, args) => {
stack.extend(args.iter().rev()); stack.extend(args.iter().rev());
} }
ty::Tuple(ts) => stack.extend(ts.iter().rev().map(GenericArg::from)), ty::Tuple(ts) => stack.extend(ts.iter().rev().map(GenericArg::from)),
ty::GeneratorWitness(ts) => {
stack.extend(ts.skip_binder().iter().rev().map(|ty| ty.into()));
}
ty::FnPtr(sig) => { ty::FnPtr(sig) => {
stack.push(sig.skip_binder().output().into()); stack.push(sig.skip_binder().output().into());
stack.extend(sig.skip_binder().inputs().iter().copied().rev().map(|ty| ty.into())); stack.extend(sig.skip_binder().inputs().iter().copied().rev().map(|ty| ty.into()));

View file

@ -144,8 +144,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
| ty::Dynamic(_, _, _) | ty::Dynamic(_, _, _)
| ty::Closure(_, _) | ty::Closure(_, _)
| ty::Generator(_, _, _) | ty::Generator(_, _, _)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(_, _)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Alias(_, _) | ty::Alias(_, _)
@ -184,8 +183,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
| ty::FnDef(_, _) | ty::FnDef(_, _)
| ty::FnPtr(_) | ty::FnPtr(_)
| ty::Dynamic(_, _, _) | ty::Dynamic(_, _, _)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(_, _)
| ty::Never | ty::Never
| ty::Alias(_, _) | ty::Alias(_, _)
| ty::Param(_) | ty::Param(_)

View file

@ -291,8 +291,7 @@ where
| ty::Param(..) | ty::Param(..)
| ty::Bound(..) | ty::Bound(..)
| ty::Error(_) | ty::Error(_)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..) => {}
| ty::GeneratorWitnessMIR(..) => {}
ty::Placeholder(..) | ty::Infer(..) => { ty::Placeholder(..) | ty::Infer(..) => {
bug!("unexpected type: {:?}", ty) bug!("unexpected type: {:?}", ty)
} }

View file

@ -1128,11 +1128,7 @@ impl<'tcx> Stable<'tcx> for Ty<'tcx> {
ty::Bound(debruijn_idx, bound_ty) => { ty::Bound(debruijn_idx, bound_ty) => {
TyKind::Bound(debruijn_idx.as_usize(), bound_ty.stable(tables)) TyKind::Bound(debruijn_idx.as_usize(), bound_ty.stable(tables))
} }
ty::Placeholder(..) ty::Placeholder(..) | ty::GeneratorWitness(..) | ty::Infer(_) | ty::Error(_) => {
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(_, _)
| ty::Infer(_)
| ty::Error(_) => {
unreachable!(); unreachable!();
} }
} }

View file

@ -720,7 +720,6 @@ fn encode_ty<'tcx>(
| ty::Bound(..) | ty::Bound(..)
| ty::Error(..) | ty::Error(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Infer(..) | ty::Infer(..)
| ty::Placeholder(..) => { | ty::Placeholder(..) => {
bug!("encode_ty: unexpected `{:?}`", ty.kind()); bug!("encode_ty: unexpected `{:?}`", ty.kind());
@ -779,7 +778,6 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio
| ty::Str | ty::Str
| ty::Never | ty::Never
| ty::Foreign(..) | ty::Foreign(..)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..) => {} | ty::GeneratorWitness(..) => {}
ty::Bool => { ty::Bool => {

View file

@ -484,8 +484,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
ty::Alias(ty::Inherent, _) => bug!("symbol_names: unexpected inherent projection"), ty::Alias(ty::Inherent, _) => bug!("symbol_names: unexpected inherent projection"),
ty::Alias(ty::Weak, _) => bug!("symbol_names: unexpected weak projection"), ty::Alias(ty::Weak, _) => bug!("symbol_names: unexpected weak projection"),
ty::GeneratorWitness(_) => bug!("symbol_names: unexpected `GeneratorWitness`"), ty::GeneratorWitness(..) => bug!("symbol_names: unexpected `GeneratorWitness`"),
ty::GeneratorWitnessMIR(..) => bug!("symbol_names: unexpected `GeneratorWitnessMIR`"),
} }
// Only cache types that do not refer to an enclosing // Only cache types that do not refer to an enclosing

View file

@ -469,7 +469,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
// FIXME: These should ideally not exist as a self type. It would be nice for // FIXME: These should ideally not exist as a self type. It would be nice for
// the builtin auto trait impls of generators to instead directly recurse // the builtin auto trait impls of generators to instead directly recurse
// into the witness. // into the witness.
ty::GeneratorWitness(_) | ty::GeneratorWitnessMIR(_, _) => (), ty::GeneratorWitness(..) => (),
// These variants should not exist as a self type. // These variants should not exist as a self type.
ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_))
@ -621,8 +621,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
| ty::Dynamic(..) | ty::Dynamic(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Param(_) | ty::Param(_)
@ -778,8 +777,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
| ty::Alias(..) | ty::Alias(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Param(_) | ty::Param(_)

View file

@ -61,9 +61,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
Ok(vec![generator_args.tupled_upvars_ty(), generator_args.witness()]) Ok(vec![generator_args.tupled_upvars_ty(), generator_args.witness()])
} }
ty::GeneratorWitness(types) => Ok(ecx.instantiate_binder_with_placeholders(types).to_vec()), ty::GeneratorWitness(def_id, args) => Ok(ecx
ty::GeneratorWitnessMIR(def_id, args) => Ok(ecx
.tcx() .tcx()
.generator_hidden_types(def_id) .generator_hidden_types(def_id)
.map(|bty| { .map(|bty| {
@ -127,7 +125,6 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
| ty::Ref(..) | ty::Ref(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..) | ty::Array(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Never | ty::Never
@ -204,9 +201,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
} }
} }
ty::GeneratorWitness(types) => Ok(ecx.instantiate_binder_with_placeholders(types).to_vec()), ty::GeneratorWitness(def_id, args) => Ok(ecx
ty::GeneratorWitnessMIR(def_id, args) => Ok(ecx
.tcx() .tcx()
.generator_hidden_types(def_id) .generator_hidden_types(def_id)
.map(|bty| { .map(|bty| {
@ -282,8 +277,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
| ty::Ref(_, _, _) | ty::Ref(_, _, _)
| ty::Dynamic(_, _, _) | ty::Dynamic(_, _, _)
| ty::Generator(_, _, _) | ty::Generator(_, _, _)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Alias(_, _) | ty::Alias(_, _)

View file

@ -330,8 +330,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
| ty::Dynamic(_, _, _) | ty::Dynamic(_, _, _)
| ty::Closure(_, _) | ty::Closure(_, _)
| ty::Generator(_, _, _) | ty::Generator(_, _, _)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Alias(_, _) | ty::Alias(_, _)

View file

@ -388,7 +388,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
| ty::Infer(ty::IntVar(..) | ty::FloatVar(..)) | ty::Infer(ty::IntVar(..) | ty::FloatVar(..))
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Foreign(..) => tcx.types.unit, | ty::Foreign(..) => tcx.types.unit,
@ -556,7 +555,6 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
| ty::Infer(ty::IntVar(..) | ty::FloatVar(..)) | ty::Infer(ty::IntVar(..) | ty::FloatVar(..))
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Foreign(..) | ty::Foreign(..)
| ty::Adt(_, _) | ty::Adt(_, _)

View file

@ -879,8 +879,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
| ty::FnPtr(_) | ty::FnPtr(_)
| ty::Closure(_, _) | ty::Closure(_, _)
| ty::Generator(_, _, _) | ty::Generator(_, _, _)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(_, _)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Adt(_, _) | ty::Adt(_, _)

View file

@ -827,9 +827,7 @@ where
// This should only be created when checking whether we have to check whether some // This should only be created when checking whether we have to check whether some
// auto trait impl applies. There will never be multiple impls, so we can just // auto trait impl applies. There will never be multiple impls, so we can just
// act as if it were a local type here. // act as if it were a local type here.
ty::GeneratorWitness(_) | ty::GeneratorWitnessMIR(..) => { ty::GeneratorWitness(..) => ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty)),
ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty))
}
ty::Alias(ty::Opaque, ..) => { ty::Alias(ty::Opaque, ..) => {
// This merits some explanation. // This merits some explanation.
// Normally, opaque types are not involved when performing // Normally, opaque types are not involved when performing

View file

@ -1847,7 +1847,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
ty::Generator(..) => Some(18), ty::Generator(..) => Some(18),
ty::Foreign(..) => Some(19), ty::Foreign(..) => Some(19),
ty::GeneratorWitness(..) => Some(20), ty::GeneratorWitness(..) => Some(20),
ty::GeneratorWitnessMIR(..) => Some(21),
ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) | ty::Error(_) => None, ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) | ty::Error(_) => None,
} }
} }

View file

@ -2173,11 +2173,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
); );
match *ty.kind() { match *ty.kind() {
ty::Generator(did, ..) | ty::GeneratorWitnessMIR(did, _) => { ty::Generator(did, ..) | ty::GeneratorWitness(did, _) => {
generator = generator.or(Some(did)); generator = generator.or(Some(did));
outer_generator = Some(did); outer_generator = Some(did);
} }
ty::GeneratorWitness(..) => {}
ty::Tuple(_) if !seen_upvar_tys_infer_tuple => { ty::Tuple(_) if !seen_upvar_tys_infer_tuple => {
// By introducing a tuple of upvar types into the chain of obligations // By introducing a tuple of upvar types into the chain of obligations
// of a generator, the first non-generator item is now the tuple itself, // of a generator, the first non-generator item is now the tuple itself,
@ -2203,11 +2202,10 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
); );
match *ty.kind() { match *ty.kind() {
ty::Generator(did, ..) | ty::GeneratorWitnessMIR(did, ..) => { ty::Generator(did, ..) | ty::GeneratorWitness(did, ..) => {
generator = generator.or(Some(did)); generator = generator.or(Some(did));
outer_generator = Some(did); outer_generator = Some(did);
} }
ty::GeneratorWitness(..) => {}
ty::Tuple(_) if !seen_upvar_tys_infer_tuple => { ty::Tuple(_) if !seen_upvar_tys_infer_tuple => {
// By introducing a tuple of upvar types into the chain of obligations // By introducing a tuple of upvar types into the chain of obligations
// of a generator, the first non-generator item is now the tuple itself, // of a generator, the first non-generator item is now the tuple itself,
@ -2987,20 +2985,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
} }
err.span_note(self.tcx.def_span(def_id), msg) err.span_note(self.tcx.def_span(def_id), msg)
} }
ty::GeneratorWitness(bound_tys) => { ty::GeneratorWitness(def_id, args) => {
use std::fmt::Write;
// FIXME: this is kind of an unusual format for rustc, can we make it more clear?
// Maybe we should just remove this note altogether?
// FIXME: only print types which don't meet the trait requirement
let mut msg =
"required because it captures the following types: ".to_owned();
for ty in bound_tys.skip_binder() {
with_forced_trimmed_paths!(write!(msg, "`{ty}`, ").unwrap());
}
err.note(msg.trim_end_matches(", ").to_string())
}
ty::GeneratorWitnessMIR(def_id, args) => {
use std::fmt::Write; use std::fmt::Write;
// FIXME: this is kind of an unusual format for rustc, can we make it more clear? // FIXME: this is kind of an unusual format for rustc, can we make it more clear?

View file

@ -1813,7 +1813,6 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Tuple(..) | ty::Tuple(..)
// Integers and floats always have `u8` as their discriminant. // Integers and floats always have `u8` as their discriminant.
@ -1863,7 +1862,6 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
// Extern types have unit metadata, according to RFC 2850 // Extern types have unit metadata, according to RFC 2850
| ty::Foreign(_) | ty::Foreign(_)

View file

@ -36,7 +36,6 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
| ty::FnPtr(_) | ty::FnPtr(_)
| ty::Char | ty::Char
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::RawPtr(_) | ty::RawPtr(_)
| ty::Ref(..) | ty::Ref(..)
| ty::Str | ty::Str
@ -218,8 +217,7 @@ pub fn dtorck_constraint_for_ty_inner<'tcx>(
| ty::Ref(..) | ty::Ref(..)
| ty::FnDef(..) | ty::FnDef(..)
| ty::FnPtr(_) | ty::FnPtr(_)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..) => {
| ty::GeneratorWitnessMIR(..) => {
// these types never have a destructor // these types never have a destructor
} }

View file

@ -436,8 +436,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Ref(_, _, _) | ty::Ref(_, _, _)
| ty::Closure(_, _) | ty::Closure(_, _)
| ty::Generator(_, _, _) | ty::Generator(_, _, _)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(_, _)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::Error(_) => return true, | ty::Error(_) => return true,
@ -569,8 +568,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Generator(..) | ty::Generator(..)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..) => {
| ty::GeneratorWitnessMIR(..) => {
// Only consider auto impls if there are no manual impls for the root of `self_ty`. // Only consider auto impls if there are no manual impls for the root of `self_ty`.
// //
// For example, we only consider auto candidates for `&i32: Auto` if no explicit impl // For example, we only consider auto candidates for `&i32: Auto` if no explicit impl
@ -946,8 +944,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::Tuple(_) | ty::Tuple(_)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..) => {
| ty::GeneratorWitnessMIR(..) => {
// These are built-in, and cannot have a custom `impl const Destruct`. // These are built-in, and cannot have a custom `impl const Destruct`.
candidates.vec.push(ConstDestructCandidate(None)); candidates.vec.push(ConstDestructCandidate(None));
} }
@ -1020,8 +1017,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Dynamic(_, _, _) | ty::Dynamic(_, _, _)
| ty::Closure(_, _) | ty::Closure(_, _)
| ty::Generator(_, _, _) | ty::Generator(_, _, _)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Alias(..) | ty::Alias(..)
| ty::Param(_) | ty::Param(_)
@ -1083,7 +1079,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Tuple(..) | ty::Tuple(..)
| ty::Alias(..) | ty::Alias(..)

View file

@ -1238,10 +1238,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let generator = args.as_generator(); let generator = args.as_generator();
stack.extend([generator.tupled_upvars_ty(), generator.witness()]); stack.extend([generator.tupled_upvars_ty(), generator.witness()]);
} }
ty::GeneratorWitness(tys) => { ty::GeneratorWitness(def_id, args) => {
stack.extend(tcx.erase_late_bound_regions(tys).to_vec());
}
ty::GeneratorWitnessMIR(def_id, args) => {
let tcx = self.tcx(); let tcx = self.tcx();
stack.extend(tcx.generator_hidden_types(def_id).map(|bty| { stack.extend(tcx.generator_hidden_types(def_id).map(|bty| {
let ty = bty.instantiate(tcx, args); let ty = bty.instantiate(tcx, args);

View file

@ -2131,7 +2131,6 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
| ty::Ref(..) | ty::Ref(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..) | ty::Array(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Never | ty::Never
@ -2230,22 +2229,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
} }
} }
ty::GeneratorWitness(binder) => { ty::GeneratorWitness(def_id, ref args) => {
let witness_tys = binder.skip_binder();
for witness_ty in witness_tys.iter() {
let resolved = self.infcx.shallow_resolve(witness_ty);
if resolved.is_ty_var() {
return Ambiguous;
}
}
// (*) binder moved here
let all_vars = self.tcx().mk_bound_variable_kinds_from_iter(
obligation.predicate.bound_vars().iter().chain(binder.bound_vars().iter()),
);
Where(ty::Binder::bind_with_vars(witness_tys.to_vec(), all_vars))
}
ty::GeneratorWitnessMIR(def_id, ref args) => {
let hidden_types = bind_generator_hidden_types_above( let hidden_types = bind_generator_hidden_types_above(
self.infcx, self.infcx,
def_id, def_id,
@ -2350,12 +2334,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
t.rebind([ty].into_iter().chain(iter::once(witness)).collect()) t.rebind([ty].into_iter().chain(iter::once(witness)).collect())
} }
ty::GeneratorWitness(types) => { ty::GeneratorWitness(def_id, ref args) => {
debug_assert!(!types.has_escaping_bound_vars());
types.map_bound(|types| types.to_vec())
}
ty::GeneratorWitnessMIR(def_id, ref args) => {
bind_generator_hidden_types_above(self.infcx, def_id, args, t.bound_vars()) bind_generator_hidden_types_above(self.infcx, def_id, args, t.bound_vars())
} }

View file

@ -79,7 +79,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for Search<'tcx> {
ty::Closure(..) => { ty::Closure(..) => {
return ControlFlow::Break(ty); return ControlFlow::Break(ty);
} }
ty::Generator(..) | ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => { ty::Generator(..) | ty::GeneratorWitness(..) => {
return ControlFlow::Break(ty); return ControlFlow::Break(ty);
} }
ty::FnDef(..) => { ty::FnDef(..) => {

View file

@ -609,7 +609,6 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
| ty::Error(_) | ty::Error(_)
| ty::Str | ty::Str
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Param(_) | ty::Param(_)
| ty::Bound(..) | ty::Bound(..)

View file

@ -577,11 +577,7 @@ fn layout_of_uncached<'tcx>(
return Err(error(cx, LayoutError::Unknown(ty))); return Err(error(cx, LayoutError::Unknown(ty)));
} }
ty::Bound(..) ty::Bound(..) | ty::GeneratorWitness(..) | ty::Infer(_) | ty::Error(_) => {
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Infer(_)
| ty::Error(_) => {
bug!("Layout::compute: unexpected type `{}`", ty) bug!("Layout::compute: unexpected type `{}`", ty)
} }

View file

@ -192,7 +192,6 @@ where
| ty::Tuple(_) | ty::Tuple(_)
| ty::Bound(..) | ty::Bound(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never | ty::Never
| ty::Infer(_) | ty::Infer(_)
| ty::Error(_) => { | ty::Error(_) => {

View file

@ -21,13 +21,7 @@ fn sized_constraint_for_ty<'tcx>(
Bool | Char | Int(..) | Uint(..) | Float(..) | RawPtr(..) | Ref(..) | FnDef(..) Bool | Char | Int(..) | Uint(..) | Float(..) | RawPtr(..) | Ref(..) | FnDef(..)
| FnPtr(_) | Array(..) | Closure(..) | Generator(..) | Never => vec![], | FnPtr(_) | Array(..) | Closure(..) | Generator(..) | Never => vec![],
Str Str | Dynamic(..) | Slice(_) | Foreign(..) | Error(_) | GeneratorWitness(..) => {
| Dynamic(..)
| Slice(_)
| Foreign(..)
| Error(_)
| GeneratorWitness(..)
| GeneratorWitnessMIR(..) => {
// these are never sized - return the target type // these are never sized - return the target type
vec![ty] vec![ty]
} }

View file

@ -143,31 +143,6 @@ pub enum TyKind<I: Interner> {
/// `GeneratorArgs`. /// `GeneratorArgs`.
Generator(I::DefId, I::GenericArgsRef, I::Movability), Generator(I::DefId, I::GenericArgsRef, I::Movability),
/// A type representing the types stored inside a generator.
/// This should only appear as part of the `GeneratorArgs`.
///
/// Note that the captured variables for generators are stored separately
/// using a tuple in the same way as for closures.
///
/// Unlike upvars, the witness can reference lifetimes from
/// inside of the generator itself. To deal with them in
/// the type of the generator, we convert them to higher ranked
/// lifetimes bound by the witness itself.
///
/// Looking at the following example, the witness for this generator
/// may end up as something like `for<'a> [Vec<i32>, &'a Vec<i32>]`:
///
/// ```ignore UNSOLVED (ask @compiler-errors, should this error? can we just swap the yields?)
/// #![feature(generators)]
/// |a| {
/// let x = &vec![3];
/// yield a;
/// yield x[0];
/// }
/// # ;
/// ```
GeneratorWitness(I::BinderListTy),
/// A type representing the types stored inside a generator. /// A type representing the types stored inside a generator.
/// This should only appear as part of the `GeneratorArgs`. /// This should only appear as part of the `GeneratorArgs`.
/// ///
@ -192,7 +167,7 @@ pub enum TyKind<I: Interner> {
/// } /// }
/// # ; /// # ;
/// ``` /// ```
GeneratorWitnessMIR(I::DefId, I::GenericArgsRef), GeneratorWitness(I::DefId, I::GenericArgsRef),
/// The never type `!`. /// The never type `!`.
Never, Never,
@ -278,7 +253,7 @@ const fn tykind_discriminant<I: Interner>(value: &TyKind<I>) -> usize {
Dynamic(..) => 14, Dynamic(..) => 14,
Closure(_, _) => 15, Closure(_, _) => 15,
Generator(_, _, _) => 16, Generator(_, _, _) => 16,
GeneratorWitness(_) => 17, GeneratorWitness(_, _) => 17,
Never => 18, Never => 18,
Tuple(_) => 19, Tuple(_) => 19,
Alias(_, _) => 20, Alias(_, _) => 20,
@ -287,7 +262,6 @@ const fn tykind_discriminant<I: Interner>(value: &TyKind<I>) -> usize {
Placeholder(_) => 23, Placeholder(_) => 23,
Infer(_) => 24, Infer(_) => 24,
Error(_) => 25, Error(_) => 25,
GeneratorWitnessMIR(_, _) => 26,
} }
} }
@ -312,8 +286,7 @@ impl<I: Interner> Clone for TyKind<I> {
Dynamic(p, r, repr) => Dynamic(p.clone(), r.clone(), *repr), Dynamic(p, r, repr) => Dynamic(p.clone(), r.clone(), *repr),
Closure(d, s) => Closure(d.clone(), s.clone()), Closure(d, s) => Closure(d.clone(), s.clone()),
Generator(d, s, m) => Generator(d.clone(), s.clone(), m.clone()), Generator(d, s, m) => Generator(d.clone(), s.clone(), m.clone()),
GeneratorWitness(g) => GeneratorWitness(g.clone()), GeneratorWitness(d, s) => GeneratorWitness(d.clone(), s.clone()),
GeneratorWitnessMIR(d, s) => GeneratorWitnessMIR(d.clone(), s.clone()),
Never => Never, Never => Never,
Tuple(t) => Tuple(t.clone()), Tuple(t) => Tuple(t.clone()),
Alias(k, p) => Alias(*k, p.clone()), Alias(k, p) => Alias(*k, p.clone()),
@ -355,10 +328,7 @@ impl<I: Interner> PartialEq for TyKind<I> {
(Generator(a_d, a_s, a_m), Generator(b_d, b_s, b_m)) => { (Generator(a_d, a_s, a_m), Generator(b_d, b_s, b_m)) => {
a_d == b_d && a_s == b_s && a_m == b_m a_d == b_d && a_s == b_s && a_m == b_m
} }
(GeneratorWitness(a_g), GeneratorWitness(b_g)) => a_g == b_g, (GeneratorWitness(a_d, a_s), GeneratorWitness(b_d, b_s)) => a_d == b_d && a_s == b_s,
(GeneratorWitnessMIR(a_d, a_s), GeneratorWitnessMIR(b_d, b_s)) => {
a_d == b_d && a_s == b_s
}
(Tuple(a_t), Tuple(b_t)) => a_t == b_t, (Tuple(a_t), Tuple(b_t)) => a_t == b_t,
(Alias(a_i, a_p), Alias(b_i, b_p)) => a_i == b_i && a_p == b_p, (Alias(a_i, a_p), Alias(b_i, b_p)) => a_i == b_i && a_p == b_p,
(Param(a_p), Param(b_p)) => a_p == b_p, (Param(a_p), Param(b_p)) => a_p == b_p,
@ -415,10 +385,9 @@ impl<I: Interner> Ord for TyKind<I> {
(Generator(a_d, a_s, a_m), Generator(b_d, b_s, b_m)) => { (Generator(a_d, a_s, a_m), Generator(b_d, b_s, b_m)) => {
a_d.cmp(b_d).then_with(|| a_s.cmp(b_s).then_with(|| a_m.cmp(b_m))) a_d.cmp(b_d).then_with(|| a_s.cmp(b_s).then_with(|| a_m.cmp(b_m)))
} }
(GeneratorWitness(a_g), GeneratorWitness(b_g)) => a_g.cmp(b_g),
( (
GeneratorWitnessMIR(a_d, a_s), GeneratorWitness(a_d, a_s),
GeneratorWitnessMIR(b_d, b_s), GeneratorWitness(b_d, b_s),
) => match Ord::cmp(a_d, b_d) { ) => match Ord::cmp(a_d, b_d) {
Ordering::Equal => Ord::cmp(a_s, b_s), Ordering::Equal => Ord::cmp(a_s, b_s),
cmp => cmp, cmp => cmp,
@ -483,8 +452,7 @@ impl<I: Interner> hash::Hash for TyKind<I> {
s.hash(state); s.hash(state);
m.hash(state) m.hash(state)
} }
GeneratorWitness(g) => g.hash(state), GeneratorWitness(d, s) => {
GeneratorWitnessMIR(d, s) => {
d.hash(state); d.hash(state);
s.hash(state); s.hash(state);
} }
@ -558,9 +526,8 @@ impl<I: Interner> DebugWithInfcx<I> for TyKind<I> {
}, },
Closure(d, s) => f.debug_tuple_field2_finish("Closure", d, &this.wrap(s)), Closure(d, s) => f.debug_tuple_field2_finish("Closure", d, &this.wrap(s)),
Generator(d, s, m) => f.debug_tuple_field3_finish("Generator", d, &this.wrap(s), m), Generator(d, s, m) => f.debug_tuple_field3_finish("Generator", d, &this.wrap(s), m),
GeneratorWitness(g) => f.debug_tuple_field1_finish("GeneratorWitness", &this.wrap(g)), GeneratorWitness(d, s) => {
GeneratorWitnessMIR(d, s) => { f.debug_tuple_field2_finish("GeneratorWitness", d, &this.wrap(s))
f.debug_tuple_field2_finish("GeneratorWitnessMIR", d, &this.wrap(s))
} }
Never => write!(f, "!"), Never => write!(f, "!"),
Tuple(t) => { Tuple(t) => {
@ -682,10 +649,7 @@ where
args.encode(e); args.encode(e);
m.encode(e); m.encode(e);
}), }),
GeneratorWitness(b) => e.emit_enum_variant(disc, |e| { GeneratorWitness(def_id, args) => e.emit_enum_variant(disc, |e| {
b.encode(e);
}),
GeneratorWitnessMIR(def_id, args) => e.emit_enum_variant(disc, |e| {
def_id.encode(e); def_id.encode(e);
args.encode(e); args.encode(e);
}), }),
@ -762,7 +726,7 @@ where
14 => Dynamic(Decodable::decode(d), Decodable::decode(d), Decodable::decode(d)), 14 => Dynamic(Decodable::decode(d), Decodable::decode(d), Decodable::decode(d)),
15 => Closure(Decodable::decode(d), Decodable::decode(d)), 15 => Closure(Decodable::decode(d), Decodable::decode(d)),
16 => Generator(Decodable::decode(d), Decodable::decode(d), Decodable::decode(d)), 16 => Generator(Decodable::decode(d), Decodable::decode(d), Decodable::decode(d)),
17 => GeneratorWitness(Decodable::decode(d)), 17 => GeneratorWitness(Decodable::decode(d), Decodable::decode(d)),
18 => Never, 18 => Never,
19 => Tuple(Decodable::decode(d)), 19 => Tuple(Decodable::decode(d)),
20 => Alias(Decodable::decode(d), Decodable::decode(d)), 20 => Alias(Decodable::decode(d), Decodable::decode(d)),
@ -771,12 +735,11 @@ where
23 => Placeholder(Decodable::decode(d)), 23 => Placeholder(Decodable::decode(d)),
24 => Infer(Decodable::decode(d)), 24 => Infer(Decodable::decode(d)),
25 => Error(Decodable::decode(d)), 25 => Error(Decodable::decode(d)),
26 => GeneratorWitnessMIR(Decodable::decode(d), Decodable::decode(d)),
_ => panic!( _ => panic!(
"{}", "{}",
format!( format!(
"invalid enum variant tag while decoding `{}`, expected 0..{}", "invalid enum variant tag while decoding `{}`, expected 0..{}",
"TyKind", 27, "TyKind", 26,
) )
), ),
} }
@ -870,10 +833,7 @@ where
args.hash_stable(__hcx, __hasher); args.hash_stable(__hcx, __hasher);
m.hash_stable(__hcx, __hasher); m.hash_stable(__hcx, __hasher);
} }
GeneratorWitness(b) => { GeneratorWitness(def_id, args) => {
b.hash_stable(__hcx, __hasher);
}
GeneratorWitnessMIR(def_id, args) => {
def_id.hash_stable(__hcx, __hasher); def_id.hash_stable(__hcx, __hasher);
args.hash_stable(__hcx, __hasher); args.hash_stable(__hcx, __hasher);
} }

View file

@ -2288,7 +2288,6 @@ pub(crate) fn clean_middle_ty<'tcx>(
ty::Bound(..) => panic!("Bound"), ty::Bound(..) => panic!("Bound"),
ty::Placeholder(..) => panic!("Placeholder"), ty::Placeholder(..) => panic!("Placeholder"),
ty::GeneratorWitness(..) => panic!("GeneratorWitness"), ty::GeneratorWitness(..) => panic!("GeneratorWitness"),
ty::GeneratorWitnessMIR(..) => panic!("GeneratorWitnessMIR"),
ty::Infer(..) => panic!("Infer"), ty::Infer(..) => panic!("Infer"),
ty::Error(_) => rustc_errors::FatalError.raise(), ty::Error(_) => rustc_errors::FatalError.raise(),
} }

View file

@ -522,8 +522,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
ty::Alias(..) ty::Alias(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(_) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Dynamic(..) | ty::Dynamic(..)
| ty::Param(_) | ty::Param(_)
| ty::Bound(..) | ty::Bound(..)

View file

@ -940,7 +940,6 @@ impl TyCoercionStability {
| ty::FnDef(..) | ty::FnDef(..)
| ty::Generator(..) | ty::Generator(..)
| ty::GeneratorWitness(..) | ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Closure(..) | ty::Closure(..)
| ty::Never | ty::Never
| ty::Tuple(_) | ty::Tuple(_)

View file

@ -31,7 +31,6 @@ fn main() {
TyKind::Closure(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Closure(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Generator(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Generator(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::GeneratorWitness(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::GeneratorWitness(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::GeneratorWitnessMIR(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Never => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Never => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Alias(..) => (), //~ ERROR usage of `ty::TyKind::<kind>` TyKind::Alias(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`

View file

@ -121,65 +121,59 @@ LL | TyKind::GeneratorWitness(..) => (),
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:34:9 --> $DIR/ty_tykind_usage.rs:34:9
| |
LL | TyKind::GeneratorWitnessMIR(..) => (), LL | TyKind::Never => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:35:9 --> $DIR/ty_tykind_usage.rs:35:9
| |
LL | TyKind::Never => (), LL | TyKind::Tuple(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:36:9 --> $DIR/ty_tykind_usage.rs:36:9
| |
LL | TyKind::Tuple(..) => (), LL | TyKind::Alias(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:37:9 --> $DIR/ty_tykind_usage.rs:37:9
| |
LL | TyKind::Alias(..) => (), LL | TyKind::Param(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:38:9 --> $DIR/ty_tykind_usage.rs:38:9
| |
LL | TyKind::Param(..) => (), LL | TyKind::Bound(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:39:9 --> $DIR/ty_tykind_usage.rs:39:9
| |
LL | TyKind::Bound(..) => (), LL | TyKind::Placeholder(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:40:9 --> $DIR/ty_tykind_usage.rs:40:9
| |
LL | TyKind::Placeholder(..) => (), LL | TyKind::Infer(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:41:9 --> $DIR/ty_tykind_usage.rs:41:9
| |
LL | TyKind::Infer(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:42:9
|
LL | TyKind::Error(_) => (), LL | TyKind::Error(_) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:47:12 --> $DIR/ty_tykind_usage.rs:46:12
| |
LL | if let TyKind::Int(int_ty) = kind {} LL | if let TyKind::Int(int_ty) = kind {}
| ^^^^^^ help: try using `ty::<kind>` directly: `ty` | ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind` error: usage of `ty::TyKind`
--> $DIR/ty_tykind_usage.rs:49:24 --> $DIR/ty_tykind_usage.rs:48:24
| |
LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {} LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {}
| ^^^^^^^^^^ | ^^^^^^^^^^
@ -187,7 +181,7 @@ LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {}
= help: try using `Ty` instead = help: try using `Ty` instead
error: usage of `ty::TyKind` error: usage of `ty::TyKind`
--> $DIR/ty_tykind_usage.rs:51:37 --> $DIR/ty_tykind_usage.rs:50:37
| |
LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> { LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -195,7 +189,7 @@ LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
= help: try using `Ty` instead = help: try using `Ty` instead
error: usage of `ty::TyKind` error: usage of `ty::TyKind`
--> $DIR/ty_tykind_usage.rs:51:53 --> $DIR/ty_tykind_usage.rs:50:53
| |
LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> { LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
| ^^^^^^^^^^^ | ^^^^^^^^^^^
@ -203,12 +197,12 @@ LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
= help: try using `Ty` instead = help: try using `Ty` instead
error: usage of `ty::TyKind::<kind>` error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:54:9 --> $DIR/ty_tykind_usage.rs:53:9
| |
LL | IrTyKind::Bool LL | IrTyKind::Bool
| --------^^^^^^ | --------^^^^^^
| | | |
| help: try using `ty::<kind>` directly: `ty` | help: try using `ty::<kind>` directly: `ty`
error: aborting due to 33 previous errors error: aborting due to 32 previous errors

View file

@ -1,10 +1,10 @@
error: symbol-name(_ZN5basic4main17h6fc0c8d27b1a289fE) error: symbol-name(_ZN5basic4main17h9308686d0228fa1dE)
--> $DIR/basic.rs:8:1 --> $DIR/basic.rs:8:1
| |
LL | #[rustc_symbol_name] LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: demangling(basic::main::h6fc0c8d27b1a289f) error: demangling(basic::main::h9308686d0228fa1d)
--> $DIR/basic.rs:8:1 --> $DIR/basic.rs:8:1
| |
LL | #[rustc_symbol_name] LL | #[rustc_symbol_name]

View file

@ -1,10 +1,10 @@
error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17hab58a402db4ebf3aE) error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h84ab5dafbd2a1508E)
--> $DIR/issue-60925.rs:21:9 --> $DIR/issue-60925.rs:21:9
| |
LL | #[rustc_symbol_name] LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::hab58a402db4ebf3a) error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::h84ab5dafbd2a1508)
--> $DIR/issue-60925.rs:21:9 --> $DIR/issue-60925.rs:21:9
| |
LL | #[rustc_symbol_name] LL | #[rustc_symbol_name]