about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2025-09-18 10:57:13 +0200
committerlcnr <rust@lcnr.de>2025-09-18 13:57:42 +0200
commit3b2bbcd87ebdf9c1a62b1169667481cafe6d8d5d (patch)
treef4ee0f3d4fc4f3048670c939cc193c64ce67bbc1 /compiler/rustc_borrowck/src
parent4919d5560120e8dfbf4f93924a2c3dc5d4ed446a (diff)
downloadrust-3b2bbcd87ebdf9c1a62b1169667481cafe6d8d5d.tar.gz
rust-3b2bbcd87ebdf9c1a62b1169667481cafe6d8d5d.zip
internal constraints are better than placeholder outlives
Diffstat (limited to 'compiler/rustc_borrowck/src')
-rw-r--r--compiler/rustc_borrowck/src/region_infer/mod.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs
index f57456949bb..bd017b213b6 100644
--- a/compiler/rustc_borrowck/src/region_infer/mod.rs
+++ b/compiler/rustc_borrowck/src/region_infer/mod.rs
@@ -1726,9 +1726,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
                 // `BoringNoLocation` constraints can point to user-written code, but are less
                 // specific, and are not used for relations that would make sense to blame.
                 ConstraintCategory::BoringNoLocation => 6,
-                // Do not blame internal constraints.
-                ConstraintCategory::OutlivesUnnameablePlaceholder(_) => 7,
-                ConstraintCategory::Internal => 8,
+                // Do not blame internal constraints if we can avoid it. Never blame
+                // the `'region: 'static` constraints introduced by placeholder outlives.
+                ConstraintCategory::Internal => 7,
+                ConstraintCategory::OutlivesUnnameablePlaceholder(_) => 8,
             };
 
             debug!("constraint {constraint:?} category: {category:?}, interest: {interest:?}");