Skip to content

Commit 5fb1a65

Browse files
committed
Inline a function that is only called once
1 parent 5afeed0 commit 5fb1a65

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

compiler/rustc_trait_selection/src/opaque_types.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
961961
origin: hir::OpaqueTyOrigin,
962962
) -> Ty<'tcx> {
963963
let infcx = self.infcx;
964+
let tcx = infcx.tcx;
964965
let OpaqueTypeKey { def_id, substs } = opaque_type_key;
965966

966967
// Use the same type variable if the exact same opaque type appears more
@@ -992,15 +993,6 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
992993
}
993994

994995
debug!("generated new type inference var {:?}", ty_var.kind());
995-
self.compute_opaque_type_obligations(opaque_type_key);
996-
997-
ty_var
998-
}
999-
1000-
fn compute_opaque_type_obligations(&mut self, opaque_type_key: OpaqueTypeKey<'tcx>) {
1001-
let infcx = self.infcx;
1002-
let tcx = infcx.tcx;
1003-
let OpaqueTypeKey { def_id, substs } = opaque_type_key;
1004996

1005997
let item_bounds = tcx.explicit_item_bounds(def_id);
1006998
debug!(?item_bounds);
@@ -1021,7 +1013,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
10211013
if let ty::PredicateKind::Projection(projection) = predicate.kind().skip_binder() {
10221014
if projection.ty.references_error() {
10231015
// No point on adding these obligations since there's a type error involved.
1024-
return;
1016+
return ty_var;
10251017
}
10261018
}
10271019
}
@@ -1040,6 +1032,8 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
10401032
debug!("instantiate_opaque_types: predicate={:?}", predicate);
10411033
self.obligations.push(traits::Obligation::new(cause, self.param_env, predicate));
10421034
}
1035+
1036+
ty_var
10431037
}
10441038
}
10451039

0 commit comments

Comments
 (0)