Skip to content

Commit ba6a7f7

Browse files
committed
rename Constraint to OutlivesConstraint
1 parent 9980415 commit ba6a7f7

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//! context internal state.
1515
1616
use std::io::{self, Write};
17-
use super::{Constraint, RegionInferenceContext};
17+
use super::{OutlivesConstraint, RegionInferenceContext};
1818

1919
// Room for "'_#NNNNr" before things get misaligned.
2020
// Easy enough to fix if this ever doesn't seem like
@@ -79,7 +79,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
7979
let mut constraints: Vec<_> = self.constraints.iter().collect();
8080
constraints.sort();
8181
for constraint in &constraints {
82-
let Constraint {
82+
let OutlivesConstraint {
8383
sup,
8484
sub,
8585
point,

src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2727

2828
impl<'this, 'tcx> dot::Labeller<'this> for RegionInferenceContext<'tcx> {
2929
type Node = RegionVid;
30-
type Edge = Constraint;
30+
type Edge = OutlivesConstraint;
3131

3232
fn graph_id(&'this self) -> dot::Id<'this> {
3333
dot::Id::new(format!("RegionInferenceContext")).unwrap()
@@ -41,31 +41,31 @@ impl<'this, 'tcx> dot::Labeller<'this> for RegionInferenceContext<'tcx> {
4141
fn node_label(&'this self, n: &RegionVid) -> dot::LabelText<'this> {
4242
dot::LabelText::LabelStr(format!("{:?}", n).into_cow())
4343
}
44-
fn edge_label(&'this self, e: &Constraint) -> dot::LabelText<'this> {
44+
fn edge_label(&'this self, e: &OutlivesConstraint) -> dot::LabelText<'this> {
4545
dot::LabelText::LabelStr(format!("{:?}", e.point).into_cow())
4646
}
4747
}
4848

4949
impl<'this, 'tcx> dot::GraphWalk<'this> for RegionInferenceContext<'tcx> {
5050
type Node = RegionVid;
51-
type Edge = Constraint;
51+
type Edge = OutlivesConstraint;
5252

5353
fn nodes(&'this self) -> dot::Nodes<'this, RegionVid> {
5454
let vids: Vec<RegionVid> = self.definitions.indices().collect();
5555
vids.into_cow()
5656
}
57-
fn edges(&'this self) -> dot::Edges<'this, Constraint> {
57+
fn edges(&'this self) -> dot::Edges<'this, OutlivesConstraint> {
5858
(&self.constraints.raw[..]).into_cow()
5959
}
6060

6161
// Render `a: b` as `a <- b`, indicating the flow
6262
// of data during inference.
6363

64-
fn source(&'this self, edge: &Constraint) -> RegionVid {
64+
fn source(&'this self, edge: &OutlivesConstraint) -> RegionVid {
6565
edge.sub
6666
}
6767

68-
fn target(&'this self, edge: &Constraint) -> RegionVid {
68+
fn target(&'this self, edge: &OutlivesConstraint) -> RegionVid {
6969
edge.sup
7070
}
7171
}

src/librustc_mir/borrow_check/nll/region_infer/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub struct RegionInferenceContext<'tcx> {
6868
dependency_map: Option<IndexVec<RegionVid, Option<ConstraintIndex>>>,
6969

7070
/// The constraints we have accumulated and used during solving.
71-
constraints: IndexVec<ConstraintIndex, Constraint>,
71+
constraints: IndexVec<ConstraintIndex, OutlivesConstraint>,
7272

7373
/// Type constraints that we check after solving.
7474
type_tests: Vec<TypeTest<'tcx>>,
@@ -118,11 +118,12 @@ pub(crate) enum Cause {
118118
}
119119

120120
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
121-
pub struct Constraint {
121+
pub struct OutlivesConstraint {
122122
// NB. The ordering here is not significant for correctness, but
123123
// it is for convenience. Before we dump the constraints in the
124124
// debugging logs, we sort them, and we'd like the "super region"
125125
// to be first, etc. (In particular, span should remain last.)
126+
126127
/// The region SUP must outlive SUB...
127128
sup: RegionVid,
128129

@@ -387,7 +388,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
387388
) {
388389
debug!("add_outlives({:?}: {:?} @ {:?}", sup, sub, point);
389390
assert!(self.inferred_values.is_none(), "values already inferred");
390-
self.constraints.push(Constraint {
391+
self.constraints.push(OutlivesConstraint {
391392
span,
392393
sup,
393394
sub,
@@ -1139,7 +1140,7 @@ impl<'tcx> RegionDefinition<'tcx> {
11391140
}
11401141
}
11411142

1142-
impl fmt::Debug for Constraint {
1143+
impl fmt::Debug for OutlivesConstraint {
11431144
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
11441145
write!(
11451146
formatter,

0 commit comments

Comments
 (0)