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
@@ -426,7 +426,6 @@ fn push_debuginfo_type_name<'tcx>(
| ty::Placeholder(..)
| ty::Alias(..)
| ty::Bound(..)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..) => {
bug!(
"debuginfo: Trying to create type name for \
@@ -152,7 +152,7 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
// FIXME(oli-obk): we can probably encode closures just like structs
| ty::Closure(..)
| 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::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::FnPtr(_)
| ty::RawPtr(_)
| ty::Str
@@ -963,7 +963,6 @@ fn is_very_trivially_sized(ty: Ty<'_>) -> bool {
| ty::Ref(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..)
| ty::Closure(..)
| ty::Never
@@ -100,8 +100,7 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
| ty::Dynamic(_, _, _)
| ty::Closure(_, _)
| ty::Generator(_, _, _)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(_, _)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(_)
| ty::Error(_) => ConstValue::from_target_usize(0u64, &tcx),
@@ -583,7 +583,6 @@ fn try_visit_primitive(
| ty::Bound(..)
| ty::Param(..)
| ty::Alias(..)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..) => bug!("Encountered invalid type {:?}", ty),
}
}
@@ -64,8 +64,7 @@ fn print_type(mut self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error> {
ty::Alias(ty::Weak, _) => bug!("type_name: unexpected weak projection"),
ty::Alias(ty::Inherent, _) => bug!("type_name: unexpected inherent projection"),
ty::GeneratorWitness(_) => bug!("type_name: unexpected `GeneratorWitness`"),
ty::GeneratorWitnessMIR(..) => bug!("type_name: unexpected `GeneratorWitnessMIR`"),
ty::GeneratorWitness(..) => bug!("type_name: unexpected `GeneratorWitness`"),
}
}
@@ -157,7 +157,6 @@ fn check_item(&mut self, id: hir::ItemId) {
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Bound(..)
| ty::Placeholder(_)
| ty::Infer(_) => {
@@ -245,7 +245,6 @@ enum NonlocalImpl {
ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Bound(..)
| ty::Placeholder(..)
| ty::Infer(..) => {
@@ -314,11 +314,7 @@ fn add_constraints_from_ty(
// types, where we use Error as the Self type
}
ty::Placeholder(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Bound(..)
| ty::Infer(..) => {
ty::Placeholder(..) | ty::GeneratorWitness(..) | ty::Bound(..) | ty::Infer(..) => {
bug!("unexpected type encountered in variance inference: {}", ty);
}
}
-1
View File
@@ -129,7 +129,6 @@ fn pointer_kind(
| ty::Float(_)
| ty::Array(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::RawPtr(_)
| ty::Ref(..)
| ty::FnDef(..)
@@ -535,7 +535,7 @@ pub(in super::super) fn resolve_generator_interiors(&self, def_id: DefId) {
self.tcx,
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.
let span = self.tcx.hir().body(body_id).value.span;
@@ -459,7 +459,6 @@ fn fold_ty(&mut self, mut t: Ty<'tcx>) -> Ty<'tcx> {
ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Bool
| ty::Char
| ty::Int(..)
-20
View File
@@ -119,26 +119,6 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
.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)?;
}
@@ -112,7 +112,7 @@ fn compute_components<'tcx>(
}
// All regions are bound inside a witness
ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => (),
ty::GeneratorWitness(..) => (),
// OutlivesTypeParameterEnv -- the actual checking that `X:'a`
// is implied by the environment is done in regionck.
-19
View File
@@ -147,25 +147,6 @@ fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
);
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)?;
Ok(a)
-1
View File
@@ -1271,7 +1271,6 @@ fn check_type_for_ffi(&self, cache: &mut FxHashSet<Ty<'tcx>>, ty: Ty<'tcx>) -> F
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Placeholder(..)
| ty::FnDef(..) => bug!("unexpected type in foreign function: {:?}", ty),
}
-1
View File
@@ -1384,7 +1384,6 @@ fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Placeholder,
Generator,
GeneratorWitness,
GeneratorWitnessMIR,
Dynamic,
Closure,
Tuple,
+2 -3
View File
@@ -242,8 +242,7 @@ pub fn sort_string(self, tcx: TyCtxt<'tcx>) -> Cow<'static, str> {
ty::Dynamic(..) => "trait object".into(),
ty::Closure(..) => "closure".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::Infer(ty::TyVar(_)) => "inferred type".into(),
ty::Infer(ty::IntVar(_)) => "integer".into(),
ty::Infer(ty::FloatVar(_)) => "floating-point number".into(),
@@ -295,7 +294,7 @@ pub fn prefix_string(self, tcx: TyCtxt<'_>) -> Cow<'static, str> {
ty::Dynamic(..) => "trait object".into(),
ty::Closure(..) => "closure".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::Placeholder(..) => "higher-ranked type".into(),
ty::Bound(..) => "bound type variable".into(),
+4 -9
View File
@@ -29,8 +29,7 @@ pub enum SimplifiedType {
Trait(DefId),
Closure(DefId),
Generator(DefId),
GeneratorWitness(usize),
GeneratorWitnessMIR(DefId),
GeneratorWitness(DefId),
Function(usize),
Placeholder,
}
@@ -130,10 +129,7 @@ pub fn simplify_type<'tcx>(
ty::Ref(_, _, mutbl) => Some(SimplifiedType::Ref(mutbl)),
ty::FnDef(def_id, _) | ty::Closure(def_id, _) => Some(SimplifiedType::Closure(def_id)),
ty::Generator(def_id, _, _) => Some(SimplifiedType::Generator(def_id)),
ty::GeneratorWitness(tys) => {
Some(SimplifiedType::GeneratorWitness(tys.skip_binder().len()))
}
ty::GeneratorWitnessMIR(def_id, _) => Some(SimplifiedType::GeneratorWitnessMIR(def_id)),
ty::GeneratorWitness(def_id, _) => Some(SimplifiedType::GeneratorWitness(def_id)),
ty::Never => Some(SimplifiedType::Never),
ty::Tuple(tys) => Some(SimplifiedType::Tuple(tys.len())),
ty::FnPtr(f) => Some(SimplifiedType::Function(f.skip_binder().inputs().len())),
@@ -169,7 +165,7 @@ pub fn def(self) -> Option<DefId> {
| SimplifiedType::Trait(d)
| SimplifiedType::Closure(d)
| SimplifiedType::Generator(d)
| SimplifiedType::GeneratorWitnessMIR(d) => Some(d),
| SimplifiedType::GeneratorWitness(d) => Some(d),
_ => None,
}
}
@@ -240,7 +236,6 @@ pub fn types_may_unify<'tcx>(self, obligation_ty: Ty<'tcx>, impl_ty: Ty<'tcx>) -
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Placeholder(..)
| ty::Bound(..)
| ty::Infer(_) => bug!("unexpected impl_ty: {impl_ty}"),
@@ -342,7 +337,7 @@ pub fn types_may_unify<'tcx>(self, obligation_ty: Ty<'tcx>, impl_ty: Ty<'tcx>) -
ty::Error(_) => true,
ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => {
ty::GeneratorWitness(..) => {
bug!("unexpected obligation type: {:?}", obligation_ty)
}
}
+1 -5
View File
@@ -127,11 +127,7 @@ fn add_kind(&mut self, kind: &ty::TyKind<'_>) {
self.add_ty(args.tupled_upvars_ty());
}
&ty::GeneratorWitness(ts) => {
self.bound_computation(ts, |flags, ts| flags.add_tys(ts));
}
ty::GeneratorWitnessMIR(_, args) => {
ty::GeneratorWitness(_, args) => {
let should_remove_further_specializable =
!self.flags.contains(TypeFlags::STILL_FURTHER_SPECIALIZABLE);
self.add_args(args);
-1
View File
@@ -810,7 +810,6 @@ fn field_ty_or_layout<'tcx>(
| ty::Never
| ty::FnDef(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Foreign(..)
| ty::Dynamic(_, _, ty::Dyn) => {
bug!("TyAndLayout::field({:?}): not applicable", this)
+2 -2
View File
@@ -157,9 +157,9 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
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);
Ty::new_generator_witness_mir(self.tcx, def_id, args)
Ty::new_generator_witness(self.tcx, def_id, args)
}
ty::Param(param) => {
+1 -2
View File
@@ -271,7 +271,7 @@ fn characteristic_def_id_of_type_cached<'a>(
ty::FnDef(def_id, _)
| ty::Closure(def_id, _)
| ty::Generator(def_id, _, _)
| ty::GeneratorWitnessMIR(def_id, _)
| ty::GeneratorWitness(def_id, _)
| ty::Foreign(def_id) => Some(def_id),
ty::Bool
@@ -286,7 +286,6 @@ fn characteristic_def_id_of_type_cached<'a>(
| ty::Infer(_)
| ty::Bound(..)
| ty::Error(_)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Float(_) => None,
}
+1 -4
View File
@@ -838,10 +838,7 @@ fn pretty_print_type(mut self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error>
p!("}}")
}
ty::GeneratorWitness(types) => {
p!(in_binder(&types));
}
ty::GeneratorWitnessMIR(did, args) => {
ty::GeneratorWitness(did, args) => {
p!(write("{{"));
if !self.tcx().sess.verbose() {
p!("generator witness");
+2 -12
View File
@@ -453,24 +453,14 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
Ok(Ty::new_generator(tcx, a_id, args, movability))
}
(&ty::GeneratorWitness(a_types), &ty::GeneratorWitness(b_types)) => {
// 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))
(&ty::GeneratorWitness(a_id, a_args), &ty::GeneratorWitness(b_id, b_args))
if a_id == b_id =>
{
// All GeneratorWitness types with the same id represent
// the (anonymous) type of the same generator expression. So
// all of their regions should be equated.
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 => {
@@ -657,9 +657,8 @@ fn try_super_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
ty::Generator(did, args, movability) => {
ty::Generator(did, args.try_fold_with(folder)?, movability)
}
ty::GeneratorWitness(types) => ty::GeneratorWitness(types.try_fold_with(folder)?),
ty::GeneratorWitnessMIR(did, args) => {
ty::GeneratorWitnessMIR(did, args.try_fold_with(folder)?)
ty::GeneratorWitness(did, args) => {
ty::GeneratorWitness(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)?),
@@ -708,8 +707,7 @@ fn super_visit_with<V: TypeVisitor<TyCtxt<'tcx>>>(
ty.visit_with(visitor)
}
ty::Generator(_did, ref args, _) => args.visit_with(visitor),
ty::GeneratorWitness(ref types) => types.visit_with(visitor),
ty::GeneratorWitnessMIR(_did, ref args) => args.visit_with(visitor),
ty::GeneratorWitness(_did, ref args) => args.visit_with(visitor),
ty::Closure(_did, ref args) => args.visit_with(visitor),
ty::Alias(_, ref data) => data.visit_with(visitor),
+3 -15
View File
@@ -2164,19 +2164,11 @@ pub fn new_generator(
#[inline]
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>,
id: DefId,
args: GenericArgsRef<'tcx>,
) -> Ty<'tcx> {
Ty::new(tcx, GeneratorWitnessMIR(id, args))
Ty::new(tcx, GeneratorWitness(id, args))
}
// misc
@@ -2706,7 +2698,6 @@ pub fn discriminant_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
| ty::Dynamic(..)
| ty::Closure(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never
| ty::Tuple(_)
| ty::Error(_)
@@ -2742,7 +2733,6 @@ pub fn ptr_metadata_ty(
| ty::Ref(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..)
| ty::Closure(..)
| ty::Never
@@ -2831,7 +2821,6 @@ pub fn is_trivially_sized(self, tcx: TyCtxt<'tcx>) -> bool {
| ty::Ref(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..)
| ty::Closure(..)
| ty::Never
@@ -2894,7 +2883,7 @@ pub fn is_trivially_pure_clone_copy(self) -> bool {
// anything with custom metadata it might be more complicated.
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.
ty::Adt(..) | ty::Closure(..) => false,
@@ -2970,8 +2959,7 @@ pub fn is_known_rigid(self) -> bool {
| Dynamic(_, _, _)
| Closure(_, _)
| Generator(_, _, _)
| GeneratorWitness(_)
| GeneratorWitnessMIR(_, _)
| GeneratorWitness(..)
| Never
| Tuple(_) => true,
Error(_) | Infer(_) | Alias(_, _) | Param(_) | Bound(_, _) | Placeholder(_) => false,
+6 -16
View File
@@ -855,7 +855,7 @@ fn expand_generator(&mut self, def_id: DefId, args: GenericArgsRef<'tcx>) -> Opt
let hidden_ty = bty.instantiate(self.tcx, args);
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);
expanded_ty
}
@@ -888,7 +888,7 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
t
};
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);
}
}
@@ -1025,8 +1025,7 @@ fn is_trivially_freeze(self) -> bool {
| ty::Dynamic(..)
| ty::Foreign(_)
| ty::Generator(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..)
| ty::Infer(_)
| ty::Alias(..)
| ty::Param(_)
@@ -1065,8 +1064,7 @@ fn is_trivially_unpin(self) -> bool {
| ty::Dynamic(..)
| ty::Foreign(_)
| ty::Generator(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..)
| ty::Infer(_)
| ty::Alias(..)
| ty::Param(_)
@@ -1194,10 +1192,7 @@ pub fn is_structural_eq_shallow(self, tcx: TyCtxt<'tcx>) -> bool {
false
}
ty::Foreign(_)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Error(_) => false,
ty::Foreign(_) | ty::GeneratorWitness(..) | ty::Error(_) => false,
}
}
@@ -1293,7 +1288,6 @@ pub fn needs_drop_components<'tcx>(
| ty::FnPtr(_)
| ty::Char
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::RawPtr(_)
| ty::Ref(..)
| 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,
// we'll just perform trait selection.
ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::Adt(..) => false,
ty::Closure(..) | ty::Generator(..) | ty::GeneratorWitness(..) | ty::Adt(..) => false,
ty::Array(ty, _) | ty::Slice(ty) => is_trivially_const_drop(ty),
+1 -4
View File
@@ -190,14 +190,11 @@ fn push_inner<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent: GenericArg<'tcx>)
ty::Adt(_, args)
| ty::Closure(_, args)
| ty::Generator(_, args, _)
| ty::GeneratorWitnessMIR(_, args)
| ty::GeneratorWitness(_, args)
| ty::FnDef(_, args) => {
stack.extend(args.iter().rev());
}
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) => {
stack.push(sig.skip_binder().output().into());
stack.extend(sig.skip_binder().inputs().iter().copied().rev().map(|ty| ty.into()));
@@ -144,8 +144,7 @@ fn move_path_for(&mut self, place: Place<'tcx>) -> Result<MovePathIndex, MoveErr
| ty::Dynamic(_, _, _)
| ty::Closure(_, _)
| ty::Generator(_, _, _)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(_, _)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(_)
| ty::Alias(_, _)
@@ -184,8 +183,7 @@ fn move_path_for(&mut self, place: Place<'tcx>) -> Result<MovePathIndex, MoveErr
| ty::FnDef(_, _)
| ty::FnPtr(_)
| ty::Dynamic(_, _, _)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(_, _)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Alias(_, _)
| ty::Param(_)
+1 -2
View File
@@ -291,8 +291,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<V::BreakTy> {
| ty::Param(..)
| ty::Bound(..)
| ty::Error(_)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..) => {}
| ty::GeneratorWitness(..) => {}
ty::Placeholder(..) | ty::Infer(..) => {
bug!("unexpected type: {:?}", ty)
}
+1 -5
View File
@@ -1128,11 +1128,7 @@ fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T {
ty::Bound(debruijn_idx, bound_ty) => {
TyKind::Bound(debruijn_idx.as_usize(), bound_ty.stable(tables))
}
ty::Placeholder(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(_, _)
| ty::Infer(_)
| ty::Error(_) => {
ty::Placeholder(..) | ty::GeneratorWitness(..) | ty::Infer(_) | ty::Error(_) => {
unreachable!();
}
}
@@ -720,7 +720,6 @@ fn encode_ty<'tcx>(
| ty::Bound(..)
| ty::Error(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Infer(..)
| ty::Placeholder(..) => {
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::Never
| ty::Foreign(..)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..) => {}
ty::Bool => {
+1 -2
View File
@@ -484,8 +484,7 @@ fn print_type(mut self, ty: Ty<'tcx>) -> Result<Self::Type, Self::Error> {
ty::Alias(ty::Inherent, _) => bug!("symbol_names: unexpected inherent projection"),
ty::Alias(ty::Weak, _) => bug!("symbol_names: unexpected weak projection"),
ty::GeneratorWitness(_) => bug!("symbol_names: unexpected `GeneratorWitness`"),
ty::GeneratorWitnessMIR(..) => bug!("symbol_names: unexpected `GeneratorWitnessMIR`"),
ty::GeneratorWitness(..) => bug!("symbol_names: unexpected `GeneratorWitness`"),
}
// Only cache types that do not refer to an enclosing
@@ -469,7 +469,7 @@ fn assemble_non_blanket_impl_candidates<G: GoalKind<'tcx>>(
// 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
// into the witness.
ty::GeneratorWitness(_) | ty::GeneratorWitnessMIR(_, _) => (),
ty::GeneratorWitness(..) => (),
// These variants should not exist as a self type.
ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_))
@@ -621,8 +621,7 @@ fn assemble_alias_bound_candidates<G: GoalKind<'tcx>>(
| ty::Dynamic(..)
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(_)
| ty::Param(_)
@@ -778,8 +777,7 @@ fn assemble_object_bound_candidates<G: GoalKind<'tcx>>(
| ty::Alias(..)
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(_)
| ty::Param(_)
@@ -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()])
}
ty::GeneratorWitness(types) => Ok(ecx.instantiate_binder_with_placeholders(types).to_vec()),
ty::GeneratorWitnessMIR(def_id, args) => Ok(ecx
ty::GeneratorWitness(def_id, args) => Ok(ecx
.tcx()
.generator_hidden_types(def_id)
.map(|bty| {
@@ -127,7 +125,6 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
| ty::Ref(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..)
| ty::Closure(..)
| 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::GeneratorWitnessMIR(def_id, args) => Ok(ecx
ty::GeneratorWitness(def_id, args) => Ok(ecx
.tcx()
.generator_hidden_types(def_id)
.map(|bty| {
@@ -282,8 +277,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_callable<'tcx>(
| ty::Ref(_, _, _)
| ty::Dynamic(_, _, _)
| ty::Generator(_, _, _)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(_)
| ty::Alias(_, _)
@@ -330,8 +330,7 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
| ty::Dynamic(_, _, _)
| ty::Closure(_, _)
| ty::Generator(_, _, _)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(_)
| ty::Alias(_, _)
@@ -388,7 +388,6 @@ fn consider_builtin_pointee_candidate(
| ty::Infer(ty::IntVar(..) | ty::FloatVar(..))
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never
| ty::Foreign(..) => tcx.types.unit,
@@ -556,7 +555,6 @@ fn consider_builtin_discriminant_kind_candidate(
| ty::Infer(ty::IntVar(..) | ty::FloatVar(..))
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never
| ty::Foreign(..)
| ty::Adt(_, _)
@@ -879,8 +879,7 @@ fn disqualify_auto_trait_candidate_due_to_possible_impl(
| ty::FnPtr(_)
| ty::Closure(_, _)
| ty::Generator(_, _, _)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(_, _)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(_)
| ty::Adt(_, _)
@@ -827,9 +827,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
// 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
// act as if it were a local type here.
ty::GeneratorWitness(_) | ty::GeneratorWitnessMIR(..) => {
ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty))
}
ty::GeneratorWitness(..) => ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty)),
ty::Alias(ty::Opaque, ..) => {
// This merits some explanation.
// Normally, opaque types are not involved when performing
@@ -1847,7 +1847,6 @@ fn type_category(tcx: TyCtxt<'_>, t: Ty<'_>) -> Option<u32> {
ty::Generator(..) => Some(18),
ty::Foreign(..) => Some(19),
ty::GeneratorWitness(..) => Some(20),
ty::GeneratorWitnessMIR(..) => Some(21),
ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) | ty::Error(_) => None,
}
}
@@ -2173,11 +2173,10 @@ fn maybe_note_obligation_cause_for_async_await(
);
match *ty.kind() {
ty::Generator(did, ..) | ty::GeneratorWitnessMIR(did, _) => {
ty::Generator(did, ..) | ty::GeneratorWitness(did, _) => {
generator = generator.or(Some(did));
outer_generator = Some(did);
}
ty::GeneratorWitness(..) => {}
ty::Tuple(_) if !seen_upvar_tys_infer_tuple => {
// 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,
@@ -2203,11 +2202,10 @@ fn maybe_note_obligation_cause_for_async_await(
);
match *ty.kind() {
ty::Generator(did, ..) | ty::GeneratorWitnessMIR(did, ..) => {
ty::Generator(did, ..) | ty::GeneratorWitness(did, ..) => {
generator = generator.or(Some(did));
outer_generator = Some(did);
}
ty::GeneratorWitness(..) => {}
ty::Tuple(_) if !seen_upvar_tys_infer_tuple => {
// 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,
@@ -2987,20 +2985,7 @@ fn note_obligation_cause_code<T>(
}
err.span_note(self.tcx.def_span(def_id), msg)
}
ty::GeneratorWitness(bound_tys) => {
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) => {
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?
@@ -1813,7 +1813,6 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never
| ty::Tuple(..)
// Integers and floats always have `u8` as their discriminant.
@@ -1863,7 +1862,6 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never
// Extern types have unit metadata, according to RFC 2850
| ty::Foreign(_)
@@ -36,7 +36,6 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
| ty::FnPtr(_)
| ty::Char
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::RawPtr(_)
| ty::Ref(..)
| ty::Str
@@ -218,8 +217,7 @@ pub fn dtorck_constraint_for_ty_inner<'tcx>(
| ty::Ref(..)
| ty::FnDef(..)
| ty::FnPtr(_)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..) => {
| ty::GeneratorWitness(..) => {
// these types never have a destructor
}
@@ -436,8 +436,7 @@ fn reject_fn_ptr_impls(
| ty::Ref(_, _, _)
| ty::Closure(_, _)
| ty::Generator(_, _, _)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(_, _)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Tuple(_)
| ty::Error(_) => return true,
@@ -569,8 +568,7 @@ fn assemble_candidates_from_auto_impls(
| ty::Generator(..)
| ty::Never
| ty::Tuple(_)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..) => {
| ty::GeneratorWitness(..) => {
// 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
@@ -946,8 +944,7 @@ fn assemble_const_destruct_candidates(
| ty::Closure(..)
| ty::Generator(..)
| ty::Tuple(_)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..) => {
| ty::GeneratorWitness(..) => {
// These are built-in, and cannot have a custom `impl const Destruct`.
candidates.vec.push(ConstDestructCandidate(None));
}
@@ -1020,8 +1017,7 @@ fn assemble_candidate_for_tuple(
| ty::Dynamic(_, _, _)
| ty::Closure(_, _)
| ty::Generator(_, _, _)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..)
| ty::Never
| ty::Alias(..)
| ty::Param(_)
@@ -1083,7 +1079,6 @@ fn assemble_candidates_for_fn_ptr_trait(
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never
| ty::Tuple(..)
| ty::Alias(..)
@@ -1238,10 +1238,7 @@ fn confirm_const_destruct_candidate(
let generator = args.as_generator();
stack.extend([generator.tupled_upvars_ty(), generator.witness()]);
}
ty::GeneratorWitness(tys) => {
stack.extend(tcx.erase_late_bound_regions(tys).to_vec());
}
ty::GeneratorWitnessMIR(def_id, args) => {
ty::GeneratorWitness(def_id, args) => {
let tcx = self.tcx();
stack.extend(tcx.generator_hidden_types(def_id).map(|bty| {
let ty = bty.instantiate(tcx, args);
@@ -2131,7 +2131,6 @@ fn sized_conditions(
| ty::Ref(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Array(..)
| ty::Closure(..)
| ty::Never
@@ -2230,22 +2229,7 @@ fn copy_clone_conditions(
}
}
ty::GeneratorWitness(binder) => {
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) => {
ty::GeneratorWitness(def_id, ref args) => {
let hidden_types = bind_generator_hidden_types_above(
self.infcx,
def_id,
@@ -2350,12 +2334,7 @@ fn constituent_types_for_ty(
t.rebind([ty].into_iter().chain(iter::once(witness)).collect())
}
ty::GeneratorWitness(types) => {
debug_assert!(!types.has_escaping_bound_vars());
types.map_bound(|types| types.to_vec())
}
ty::GeneratorWitnessMIR(def_id, ref args) => {
ty::GeneratorWitness(def_id, ref args) => {
bind_generator_hidden_types_above(self.infcx, def_id, args, t.bound_vars())
}
@@ -79,7 +79,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
ty::Closure(..) => {
return ControlFlow::Break(ty);
}
ty::Generator(..) | ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => {
ty::Generator(..) | ty::GeneratorWitness(..) => {
return ControlFlow::Break(ty);
}
ty::FnDef(..) => {
@@ -609,7 +609,6 @@ fn compute(&mut self, arg: GenericArg<'tcx>) {
| ty::Error(_)
| ty::Str
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never
| ty::Param(_)
| ty::Bound(..)
+1 -5
View File
@@ -577,11 +577,7 @@ fn layout_of_uncached<'tcx>(
return Err(error(cx, LayoutError::Unknown(ty)));
}
ty::Bound(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Infer(_)
| ty::Error(_) => {
ty::Bound(..) | ty::GeneratorWitness(..) | ty::Infer(_) | ty::Error(_) => {
bug!("Layout::compute: unexpected type `{}`", ty)
}
@@ -192,7 +192,6 @@ fn next(&mut self) -> Option<NeedsDropResult<Ty<'tcx>>> {
| ty::Tuple(_)
| ty::Bound(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Never
| ty::Infer(_)
| ty::Error(_) => {
+1 -7
View File
@@ -21,13 +21,7 @@ fn sized_constraint_for_ty<'tcx>(
Bool | Char | Int(..) | Uint(..) | Float(..) | RawPtr(..) | Ref(..) | FnDef(..)
| FnPtr(_) | Array(..) | Closure(..) | Generator(..) | Never => vec![],
Str
| Dynamic(..)
| Slice(_)
| Foreign(..)
| Error(_)
| GeneratorWitness(..)
| GeneratorWitnessMIR(..) => {
Str | Dynamic(..) | Slice(_) | Foreign(..) | Error(_) | GeneratorWitness(..) => {
// these are never sized - return the target type
vec![ty]
}
+13 -53
View File
@@ -143,31 +143,6 @@ pub enum TyKind<I: Interner> {
/// `GeneratorArgs`.
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.
/// 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 `!`.
Never,
@@ -278,7 +253,7 @@ const fn tykind_discriminant<I: Interner>(value: &TyKind<I>) -> usize {
Dynamic(..) => 14,
Closure(_, _) => 15,
Generator(_, _, _) => 16,
GeneratorWitness(_) => 17,
GeneratorWitness(_, _) => 17,
Never => 18,
Tuple(_) => 19,
Alias(_, _) => 20,
@@ -287,7 +262,6 @@ const fn tykind_discriminant<I: Interner>(value: &TyKind<I>) -> usize {
Placeholder(_) => 23,
Infer(_) => 24,
Error(_) => 25,
GeneratorWitnessMIR(_, _) => 26,
}
}
@@ -312,8 +286,7 @@ fn clone(&self) -> Self {
Dynamic(p, r, repr) => Dynamic(p.clone(), r.clone(), *repr),
Closure(d, s) => Closure(d.clone(), s.clone()),
Generator(d, s, m) => Generator(d.clone(), s.clone(), m.clone()),
GeneratorWitness(g) => GeneratorWitness(g.clone()),
GeneratorWitnessMIR(d, s) => GeneratorWitnessMIR(d.clone(), s.clone()),
GeneratorWitness(d, s) => GeneratorWitness(d.clone(), s.clone()),
Never => Never,
Tuple(t) => Tuple(t.clone()),
Alias(k, p) => Alias(*k, p.clone()),
@@ -355,10 +328,7 @@ fn eq(&self, other: &TyKind<I>) -> bool {
(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
}
(GeneratorWitness(a_g), GeneratorWitness(b_g)) => a_g == b_g,
(GeneratorWitnessMIR(a_d, a_s), GeneratorWitnessMIR(b_d, b_s)) => {
a_d == b_d && a_s == b_s
}
(GeneratorWitness(a_d, a_s), GeneratorWitness(b_d, b_s)) => a_d == b_d && a_s == b_s,
(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,
(Param(a_p), Param(b_p)) => a_p == b_p,
@@ -415,10 +385,9 @@ fn cmp(&self, other: &TyKind<I>) -> Ordering {
(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)))
}
(GeneratorWitness(a_g), GeneratorWitness(b_g)) => a_g.cmp(b_g),
(
GeneratorWitnessMIR(a_d, a_s),
GeneratorWitnessMIR(b_d, b_s),
GeneratorWitness(a_d, a_s),
GeneratorWitness(b_d, b_s),
) => match Ord::cmp(a_d, b_d) {
Ordering::Equal => Ord::cmp(a_s, b_s),
cmp => cmp,
@@ -483,8 +452,7 @@ fn hash<__H: hash::Hasher>(&self, state: &mut __H) -> () {
s.hash(state);
m.hash(state)
}
GeneratorWitness(g) => g.hash(state),
GeneratorWitnessMIR(d, s) => {
GeneratorWitness(d, s) => {
d.hash(state);
s.hash(state);
}
@@ -558,9 +526,8 @@ fn fmt<InfCtx: InferCtxtLike<I>>(
},
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),
GeneratorWitness(g) => f.debug_tuple_field1_finish("GeneratorWitness", &this.wrap(g)),
GeneratorWitnessMIR(d, s) => {
f.debug_tuple_field2_finish("GeneratorWitnessMIR", d, &this.wrap(s))
GeneratorWitness(d, s) => {
f.debug_tuple_field2_finish("GeneratorWitness", d, &this.wrap(s))
}
Never => write!(f, "!"),
Tuple(t) => {
@@ -682,10 +649,7 @@ fn encode(&self, e: &mut E) {
args.encode(e);
m.encode(e);
}),
GeneratorWitness(b) => e.emit_enum_variant(disc, |e| {
b.encode(e);
}),
GeneratorWitnessMIR(def_id, args) => e.emit_enum_variant(disc, |e| {
GeneratorWitness(def_id, args) => e.emit_enum_variant(disc, |e| {
def_id.encode(e);
args.encode(e);
}),
@@ -762,7 +726,7 @@ fn decode(d: &mut D) -> Self {
14 => Dynamic(Decodable::decode(d), 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)),
17 => GeneratorWitness(Decodable::decode(d)),
17 => GeneratorWitness(Decodable::decode(d), Decodable::decode(d)),
18 => Never,
19 => Tuple(Decodable::decode(d)),
20 => Alias(Decodable::decode(d), Decodable::decode(d)),
@@ -771,12 +735,11 @@ fn decode(d: &mut D) -> Self {
23 => Placeholder(Decodable::decode(d)),
24 => Infer(Decodable::decode(d)),
25 => Error(Decodable::decode(d)),
26 => GeneratorWitnessMIR(Decodable::decode(d), Decodable::decode(d)),
_ => panic!(
"{}",
format!(
"invalid enum variant tag while decoding `{}`, expected 0..{}",
"TyKind", 27,
"TyKind", 26,
)
),
}
@@ -870,10 +833,7 @@ fn hash_stable(
args.hash_stable(__hcx, __hasher);
m.hash_stable(__hcx, __hasher);
}
GeneratorWitness(b) => {
b.hash_stable(__hcx, __hasher);
}
GeneratorWitnessMIR(def_id, args) => {
GeneratorWitness(def_id, args) => {
def_id.hash_stable(__hcx, __hasher);
args.hash_stable(__hcx, __hasher);
}
-1
View File
@@ -2288,7 +2288,6 @@ pub(crate) fn clean_middle_ty<'tcx>(
ty::Bound(..) => panic!("Bound"),
ty::Placeholder(..) => panic!("Placeholder"),
ty::GeneratorWitness(..) => panic!("GeneratorWitness"),
ty::GeneratorWitnessMIR(..) => panic!("GeneratorWitnessMIR"),
ty::Infer(..) => panic!("Infer"),
ty::Error(_) => rustc_errors::FatalError.raise(),
}
@@ -522,8 +522,7 @@ fn def_id_to_res(&self, ty_id: DefId) -> Option<Res> {
ty::Alias(..)
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(_)
| ty::GeneratorWitnessMIR(..)
| ty::GeneratorWitness(..)
| ty::Dynamic(..)
| ty::Param(_)
| ty::Bound(..)
@@ -940,7 +940,6 @@ fn for_mir_ty<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: Ty<'tcx>,
| ty::FnDef(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::GeneratorWitnessMIR(..)
| ty::Closure(..)
| ty::Never
| ty::Tuple(_)
@@ -31,7 +31,6 @@ fn main() {
TyKind::Closure(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Generator(..) => (), //~ 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::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
TyKind::Alias(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
@@ -121,65 +121,59 @@ LL | TyKind::GeneratorWitness(..) => (),
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:34:9
|
LL | TyKind::GeneratorWitnessMIR(..) => (),
LL | TyKind::Never => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:35:9
|
LL | TyKind::Never => (),
LL | TyKind::Tuple(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:36:9
|
LL | TyKind::Tuple(..) => (),
LL | TyKind::Alias(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:37:9
|
LL | TyKind::Alias(..) => (),
LL | TyKind::Param(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:38:9
|
LL | TyKind::Param(..) => (),
LL | TyKind::Bound(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:39:9
|
LL | TyKind::Bound(..) => (),
LL | TyKind::Placeholder(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:40:9
|
LL | TyKind::Placeholder(..) => (),
LL | TyKind::Infer(..) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
error: usage of `ty::TyKind::<kind>`
--> $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(_) => (),
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
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 {}
| ^^^^^^ help: try using `ty::<kind>` directly: `ty`
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<'_>) {}
| ^^^^^^^^^^
@@ -187,7 +181,7 @@ LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {}
= help: try using `Ty` instead
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> {
| ^^^^^^^^^^^
@@ -195,7 +189,7 @@ LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
= help: try using `Ty` instead
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> {
| ^^^^^^^^^^^
@@ -203,12 +197,12 @@ LL | fn ir_ty_kind<I: Interner>(bad: IrTyKind<I>) -> IrTyKind<I> {
= help: try using `Ty` instead
error: usage of `ty::TyKind::<kind>`
--> $DIR/ty_tykind_usage.rs:54:9
--> $DIR/ty_tykind_usage.rs:53:9
|
LL | IrTyKind::Bool
| --------^^^^^^
| |
| help: try using `ty::<kind>` directly: `ty`
error: aborting due to 33 previous errors
error: aborting due to 32 previous errors
+2 -2
View File
@@ -1,10 +1,10 @@
error: symbol-name(_ZN5basic4main17h6fc0c8d27b1a289fE)
error: symbol-name(_ZN5basic4main17h9308686d0228fa1dE)
--> $DIR/basic.rs:8:1
|
LL | #[rustc_symbol_name]
| ^^^^^^^^^^^^^^^^^^^^
error: demangling(basic::main::h6fc0c8d27b1a289f)
error: demangling(basic::main::h9308686d0228fa1d)
--> $DIR/basic.rs:8:1
|
LL | #[rustc_symbol_name]
@@ -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
|
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
|
LL | #[rustc_symbol_name]