X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_middle%2Fsrc%2Fty%2Fsty.rs;h=060d864389cb0f4ffa3f3c84b9f9ab5bcb353705;hb=6390d25eab41efdbb96e6d42a67fd98d64469317;hp=6a7b23e40a7792edb3cb7f72000cbb2f6a7321f3;hpb=31f9f21412958d19de26a2079990ce7707fb7bd1;p=rust.git diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 6a7b23e40a7..060d864389c 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -571,9 +571,9 @@ pub fn state_tys( ) -> impl Iterator> + Captures<'tcx>> { let layout = tcx.generator_layout(def_id).unwrap(); layout.variant_fields.iter().map(move |variant| { - variant - .iter() - .map(move |field| ty::EarlyBinder(layout.field_tys[*field]).subst(tcx, self.substs)) + variant.iter().map(move |field| { + ty::EarlyBinder(layout.field_tys[*field].ty).subst(tcx, self.substs) + }) }) } @@ -1504,13 +1504,22 @@ pub struct BoundTy { #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] #[derive(HashStable)] pub enum BoundTyKind { - Anon, - Param(Symbol), + Anon(u32), + Param(DefId, Symbol), +} + +impl BoundTyKind { + pub fn expect_anon(self) -> u32 { + match self { + BoundTyKind::Anon(i) => i, + _ => bug!(), + } + } } impl From for BoundTy { fn from(var: BoundVar) -> Self { - BoundTy { var, kind: BoundTyKind::Anon } + BoundTy { var, kind: BoundTyKind::Anon(var.as_u32()) } } } @@ -2059,7 +2068,7 @@ pub fn builtin_index(self) -> Option> { pub fn fn_sig(self, tcx: TyCtxt<'tcx>) -> PolyFnSig<'tcx> { match self.kind() { - FnDef(def_id, substs) => tcx.bound_fn_sig(*def_id).subst(tcx, substs), + FnDef(def_id, substs) => tcx.fn_sig(*def_id).subst(tcx, substs), FnPtr(f) => *f, Error(_) => { // ignore errors (#54954) @@ -2175,6 +2184,7 @@ pub fn discriminant_ty(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { | ty::Dynamic(..) | ty::Closure(..) | ty::GeneratorWitness(..) + | ty::GeneratorWitnessMIR(..) | ty::Never | ty::Tuple(_) | ty::Error(_) @@ -2210,6 +2220,7 @@ pub fn ptr_metadata_ty( | ty::Ref(..) | ty::Generator(..) | ty::GeneratorWitness(..) + | ty::GeneratorWitnessMIR(..) | ty::Array(..) | ty::Closure(..) | ty::Never @@ -2296,6 +2307,7 @@ pub fn is_trivially_sized(self, tcx: TyCtxt<'tcx>) -> bool { | ty::Ref(..) | ty::Generator(..) | ty::GeneratorWitness(..) + | ty::GeneratorWitnessMIR(..) | ty::Array(..) | ty::Closure(..) | ty::Never @@ -2360,7 +2372,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(..) => false, + ty::Generator(..) | ty::GeneratorWitness(..) | ty::GeneratorWitnessMIR(..) => false, // Might be, but not "trivial" so just giving the safe answer. ty::Adt(..) | ty::Closure(..) => false,