diff options
| author | Amanda Stjerna <amanda.stjerna@it.uu.se> | 2025-02-18 13:01:01 +0100 |
|---|---|---|
| committer | Amanda Stjerna <amanda.stjerna@it.uu.se> | 2025-02-18 13:02:05 +0100 |
| commit | 53effa4566dc1493e1dc5be206105dd99e3192b5 (patch) | |
| tree | f120b412a4cac5700a52ecc01b8605c38afbb649 /compiler | |
| parent | 2162e9d4b18525e4eb542fed9985921276512d7c (diff) | |
eval_outlives: bail out early if both regions are in the same SCC
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_borrowck/src/region_infer/mod.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index d2268c4779d..e0e3e028c61 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -1267,6 +1267,11 @@ impl<'tcx> RegionInferenceContext<'tcx> { let sub_region_scc = self.constraint_sccs.scc(sub_region); let sup_region_scc = self.constraint_sccs.scc(sup_region); + if sub_region_scc == sup_region_scc { + debug!("{sup_region:?}: {sub_region:?} holds trivially; they are in the same SCC"); + return true; + } + // If we are checking that `'sup: 'sub`, and `'sub` contains // some placeholder that `'sup` cannot name, then this is only // true if `'sup` outlives static. |
