From 36cb01deb3d874650881b0bc22448020751ff19c Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 15 Jul 2022 15:26:46 +0000 Subject: [PATCH] Try out a perf optimization --- compiler/rustc_infer/src/infer/outlives/obligations.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs index ec9a165ea308..5af76b5d610d 100644 --- a/compiler/rustc_infer/src/infer/outlives/obligations.rs +++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs @@ -373,6 +373,11 @@ where substs: SubstsRef<'tcx>, filter: impl Fn(Ty<'tcx>) -> (DefId, SubstsRef<'tcx>), ) { + // An optimization for a common case with opaque types. + if substs.is_empty() { + return; + } + // This case is thorny for inference. The fundamental problem is // that there are many cases where we have choice, and inference // doesn't like choice (the current region inference in