Skip to content

Commit 3418280

Browse files
committed
Move some code around in preparation of splitting a function
1 parent 14021fe commit 3418280

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

compiler/rustc_trait_selection/src/opaque_types.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -981,21 +981,6 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
981981
let ty_var = infcx
982982
.next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::TypeInference, span });
983983

984-
let item_bounds = tcx.explicit_item_bounds(def_id);
985-
debug!("instantiate_opaque_types: bounds={:#?}", item_bounds);
986-
let bounds: Vec<_> =
987-
item_bounds.iter().map(|(bound, _)| bound.subst(tcx, substs)).collect();
988-
989-
let param_env = tcx.param_env(def_id);
990-
let InferOk { value: bounds, obligations } = infcx.partially_normalize_associated_types_in(
991-
ObligationCause::misc(span, self.body_id),
992-
param_env,
993-
bounds,
994-
);
995-
self.obligations.extend(obligations);
996-
997-
debug!("instantiate_opaque_types: bounds={:?}", bounds);
998-
999984
// Make sure that we are in fact defining the *entire* type
1000985
// (e.g., `type Foo<T: Bound> = impl Bar;` needs to be
1001986
// defined by a function like `fn foo<T: Bound>() -> Foo<T>`).
@@ -1015,6 +1000,21 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
10151000
);
10161001
debug!("instantiate_opaque_types: ty_var={:?}", ty_var);
10171002

1003+
let item_bounds = tcx.explicit_item_bounds(def_id);
1004+
debug!("instantiate_opaque_types: bounds={:#?}", item_bounds);
1005+
let bounds: Vec<_> =
1006+
item_bounds.iter().map(|(bound, _)| bound.subst(tcx, substs)).collect();
1007+
1008+
let param_env = tcx.param_env(def_id);
1009+
let InferOk { value: bounds, obligations } = infcx.partially_normalize_associated_types_in(
1010+
ObligationCause::misc(span, self.body_id),
1011+
param_env,
1012+
bounds,
1013+
);
1014+
self.obligations.extend(obligations);
1015+
1016+
debug!("instantiate_opaque_types: bounds={:?}", bounds);
1017+
10181018
for predicate in &bounds {
10191019
if let ty::PredicateKind::Projection(projection) = predicate.kind().skip_binder() {
10201020
if projection.ty.references_error() {

0 commit comments

Comments
 (0)