diff options
| author | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-07-26 17:12:25 +0000 |
|---|---|---|
| committer | Oli Scherer <github35764891676564198441@oli-obk.de> | 2021-08-06 10:21:01 +0000 |
| commit | 34182804e866a9f2f0c937aad5e01f8f2b7c0fda (patch) | |
| tree | 4793e2fc7e7b6784752a7b55ae7dab0dffb3a5b2 | |
| parent | 14021feea92f1bb7a71338ba96bfe81ab6b9604d (diff) | |
| download | rust-34182804e866a9f2f0c937aad5e01f8f2b7c0fda.tar.gz rust-34182804e866a9f2f0c937aad5e01f8f2b7c0fda.zip | |
Move some code around in preparation of splitting a function
| -rw-r--r-- | compiler/rustc_trait_selection/src/opaque_types.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index 4268fa03584..f74b9070535 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -981,21 +981,6 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> { let ty_var = infcx .next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::TypeInference, span }); - let item_bounds = tcx.explicit_item_bounds(def_id); - debug!("instantiate_opaque_types: bounds={:#?}", item_bounds); - let bounds: Vec<_> = - item_bounds.iter().map(|(bound, _)| bound.subst(tcx, substs)).collect(); - - let param_env = tcx.param_env(def_id); - let InferOk { value: bounds, obligations } = infcx.partially_normalize_associated_types_in( - ObligationCause::misc(span, self.body_id), - param_env, - bounds, - ); - self.obligations.extend(obligations); - - debug!("instantiate_opaque_types: bounds={:?}", bounds); - // Make sure that we are in fact defining the *entire* type // (e.g., `type Foo<T: Bound> = impl Bar;` needs to be // defined by a function like `fn foo<T: Bound>() -> Foo<T>`). @@ -1015,6 +1000,21 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> { ); debug!("instantiate_opaque_types: ty_var={:?}", ty_var); + let item_bounds = tcx.explicit_item_bounds(def_id); + debug!("instantiate_opaque_types: bounds={:#?}", item_bounds); + let bounds: Vec<_> = + item_bounds.iter().map(|(bound, _)| bound.subst(tcx, substs)).collect(); + + let param_env = tcx.param_env(def_id); + let InferOk { value: bounds, obligations } = infcx.partially_normalize_associated_types_in( + ObligationCause::misc(span, self.body_id), + param_env, + bounds, + ); + self.obligations.extend(obligations); + + debug!("instantiate_opaque_types: bounds={:?}", bounds); + for predicate in &bounds { if let ty::PredicateKind::Projection(projection) = predicate.kind().skip_binder() { if projection.ty.references_error() { |
