Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit fe76f37

Browse files
committed
Inline add_placeholder_violation_constraint
1 parent 9fd80b0 commit fe76f37

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

compiler/rustc_borrowck/src/constraints/mod.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,6 @@ impl<'tcx> OutlivesConstraintSet<'tcx> {
6969
let region_graph = &constraint_graph.region_graph(self, static_region);
7070
scc::Sccs::new_with_annotation(&region_graph, annotations)
7171
}
72-
73-
/// There is a placeholder violation; add a requirement
74-
/// that some SCC outlive static and explain which region
75-
/// reaching which other region caused that.
76-
pub(crate) fn add_placeholder_violation_constraint(
77-
&mut self,
78-
outlives_static: RegionVid,
79-
blame_from: RegionVid,
80-
blame_to: RegionVid,
81-
fr_static: RegionVid,
82-
) {
83-
self.push(OutlivesConstraint {
84-
sup: outlives_static,
85-
sub: fr_static,
86-
category: ConstraintCategory::IllegalPlaceholder(blame_from, blame_to),
87-
locations: Locations::All(rustc_span::DUMMY_SP),
88-
span: rustc_span::DUMMY_SP,
89-
variance_info: VarianceDiagInfo::None,
90-
from_closure: false,
91-
});
92-
}
9372
}
9473

9574
impl<'tcx> Index<OutlivesConstraintIndex> for OutlivesConstraintSet<'tcx> {

compiler/rustc_borrowck/src/eliminate_placeholders.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ use rustc_middle::ty::{self, Region, RegionVid, TyCtxt, UniverseIndex};
1919
use rustc_span::Span;
2020
use tracing::{debug, instrument, trace};
2121

22+
use crate::ConstraintCategory;
2223
use crate::constraints::graph::{ConstraintGraph, Normal};
2324
use crate::constraints::{ConstraintSccIndex, OutlivesConstraintSet};
25+
use crate::consumers::OutlivesConstraint;
2426
use crate::diagnostics::{RegionErrorKind, RegionErrors};
2527
use crate::member_constraints::MemberConstraintSet;
2628
use crate::region_infer::{RegionDefinition, Representative, TypeTest};
29+
use crate::ty::VarianceDiagInfo;
30+
use crate::type_check::Locations;
2731
use crate::universal_regions::UniversalRegions;
2832

2933
pub(crate) struct LoweredConstraints<'tcx> {
@@ -520,12 +524,18 @@ fn rewrite_outlives<'tcx>(
520524
};
521525

522526
outlives_static.insert(scc);
523-
outlives_constraints.add_placeholder_violation_constraint(
524-
annotation.representative_rvid(),
525-
annotation.representative_rvid(),
526-
blame_to,
527-
fr_static,
528-
);
527+
outlives_constraints.push(OutlivesConstraint {
528+
sup: annotation.representative_rvid(),
529+
sub: fr_static,
530+
category: ConstraintCategory::IllegalPlaceholder(
531+
annotation.representative_rvid(),
532+
blame_to,
533+
),
534+
locations: Locations::All(rustc_span::DUMMY_SP),
535+
span: rustc_span::DUMMY_SP,
536+
variance_info: VarianceDiagInfo::None,
537+
from_closure: false,
538+
});
529539
}
530540
outlives_static
531541
}

0 commit comments

Comments
 (0)