Skip to content

Commit 36cb01d

Browse files
committed
Try out a perf optimization
1 parent 20d962c commit 36cb01d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_infer/src/infer/outlives/obligations.rs

+5
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ where
373373
substs: SubstsRef<'tcx>,
374374
filter: impl Fn(Ty<'tcx>) -> (DefId, SubstsRef<'tcx>),
375375
) {
376+
// An optimization for a common case with opaque types.
377+
if substs.is_empty() {
378+
return;
379+
}
380+
376381
// This case is thorny for inference. The fundamental problem is
377382
// that there are many cases where we have choice, and inference
378383
// doesn't like choice (the current region inference in

0 commit comments

Comments
 (0)