Skip to content

Commit 679534e

Browse files
committed
Add a new constraint category for our outlives static constraints
This makes the origin of these synthetic constraints clearer and allows us to make sure that they are literally never blamed during error reporting, massively reducing the number of failing UI tests.
1 parent 6f4ea40 commit 679534e

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

compiler/rustc_borrowck/src/constraints/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl<'tcx> OutlivesConstraintSet<'tcx> {
8282
let outlives_static = |rvid: RegionVid| OutlivesConstraint {
8383
sup: rvid,
8484
sub: universal_regions.fr_static, // All the following values are made up ex nihil
85-
category: ConstraintCategory::BoringNoLocation,
85+
category: ConstraintCategory::IllegalUniverse,
8686
locations: Locations::All(rustc_span::DUMMY_SP),
8787
span: rustc_span::DUMMY_SP,
8888
variance_info: VarianceDiagInfo::None,

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> {
6363
ConstraintCategory::Predicate(_)
6464
| ConstraintCategory::Boring
6565
| ConstraintCategory::BoringNoLocation
66-
| ConstraintCategory::Internal => "",
66+
| ConstraintCategory::Internal
67+
| ConstraintCategory::IllegalUniverse => "",
6768
}
6869
}
6970
}

compiler/rustc_borrowck/src/region_infer/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1919,6 +1919,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
19191919

19201920
// This loop can be hot.
19211921
for constraint in outgoing_edges_from_graph {
1922+
if matches!(constraint.category, ConstraintCategory::IllegalUniverse) {
1923+
debug!("Ignoring illegal universe constraint: {constraint:?}");
1924+
continue;
1925+
}
19221926
handle_constraint(constraint);
19231927
}
19241928

compiler/rustc_middle/src/mir/query.rs

+2
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ pub enum ConstraintCategory<'tcx> {
273273

274274
/// A constraint that doesn't correspond to anything the user sees.
275275
Internal,
276+
/// An internal constraint derived from an illegal universe relation.
277+
IllegalUniverse,
276278
}
277279

278280
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]

0 commit comments

Comments
 (0)