X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_typeck%2Fsrc%2Fclosure.rs;h=72d8a936ab39db2adcc5b8f4970fcdc705b638ba;hb=39b2a41b39b445bf7efab02f6eade16135d7df85;hp=429cb60ba2b6161692c9153041a068ce638e69d5;hpb=bdb07a8ec8e77aa10fb84fae1d4ff71c21180bb4;p=rust.git diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index 429cb60ba2b..72d8a936ab3 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -167,9 +167,10 @@ fn deduce_expectations_from_expected_type( expected_ty: Ty<'tcx>, ) -> (Option>, Option) { match *expected_ty.kind() { - ty::Opaque(def_id, substs) => self.deduce_signature_from_predicates( - self.tcx.bound_explicit_item_bounds(def_id).subst_iter_copied(self.tcx, substs), - ), + ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => self + .deduce_signature_from_predicates( + self.tcx.bound_explicit_item_bounds(def_id).subst_iter_copied(self.tcx, substs), + ), ty::Dynamic(ref object_type, ..) => { let sig = object_type.projection_bounds().find_map(|pb| { let pb = pb.with_self_ty(self.tcx, self.tcx.types.trait_object_dummy_self); @@ -677,17 +678,17 @@ fn deduce_future_output_from_obligations( get_future_output(obligation.predicate, obligation.cause.span) })? } - ty::Opaque(def_id, substs) => self + ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => self .tcx .bound_explicit_item_bounds(def_id) .subst_iter_copied(self.tcx, substs) .find_map(|(p, s)| get_future_output(p, s))?, ty::Error(_) => return None, - ty::Projection(proj) - if self.tcx.def_kind(proj.item_def_id) == DefKind::ImplTraitPlaceholder => + ty::Alias(ty::Projection, proj) + if self.tcx.def_kind(proj.def_id) == DefKind::ImplTraitPlaceholder => { self.tcx - .bound_explicit_item_bounds(proj.item_def_id) + .bound_explicit_item_bounds(proj.def_id) .subst_iter_copied(self.tcx, proj.substs) .find_map(|(p, s)| get_future_output(p, s))? } @@ -743,11 +744,11 @@ fn deduce_future_output_from_projection( // The `Future` trait has only one associated item, `Output`, // so check that this is what we see. let output_assoc_item = self.tcx.associated_item_def_ids(future_trait)[0]; - if output_assoc_item != predicate.projection_ty.item_def_id { + if output_assoc_item != predicate.projection_ty.def_id { span_bug!( cause_span, "projecting associated item `{:?}` from future, which is not Output `{:?}`", - predicate.projection_ty.item_def_id, + predicate.projection_ty.def_id, output_assoc_item, ); }