Skip to content

Commit a30b548

Browse files
committed
Split fold_opaque_ty
1 parent 3418280 commit a30b548

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

compiler/rustc_trait_selection/src/opaque_types.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,19 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
999999
OpaqueTypeDecl { opaque_type: ty, definition_span, concrete_ty: ty_var, origin },
10001000
);
10011001
debug!("instantiate_opaque_types: ty_var={:?}", ty_var);
1002+
self.compute_opaque_type_obligations(opaque_type_key, span);
1003+
1004+
ty_var
1005+
}
1006+
1007+
fn compute_opaque_type_obligations(
1008+
&mut self,
1009+
opaque_type_key: OpaqueTypeKey<'tcx>,
1010+
span: Span,
1011+
) {
1012+
let infcx = self.infcx;
1013+
let tcx = infcx.tcx;
1014+
let OpaqueTypeKey { def_id, substs } = opaque_type_key;
10021015

10031016
let item_bounds = tcx.explicit_item_bounds(def_id);
10041017
debug!("instantiate_opaque_types: bounds={:#?}", item_bounds);
@@ -1019,7 +1032,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
10191032
if let ty::PredicateKind::Projection(projection) = predicate.kind().skip_binder() {
10201033
if projection.ty.references_error() {
10211034
// No point on adding these obligations since there's a type error involved.
1022-
return ty_var;
1035+
return;
10231036
}
10241037
}
10251038
}
@@ -1037,8 +1050,6 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
10371050
debug!("instantiate_opaque_types: predicate={:?}", predicate);
10381051
self.obligations.push(traits::Obligation::new(cause, self.param_env, predicate));
10391052
}
1040-
1041-
ty_var
10421053
}
10431054
}
10441055

0 commit comments

Comments
 (0)