diff --git a/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs b/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs index b0346abee5a..6c796ea4c73 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs @@ -14,7 +14,7 @@ //! context internal state. use std::io::{self, Write}; -use super::{Constraint, RegionInferenceContext}; +use super::{OutlivesConstraint, RegionInferenceContext}; // Room for "'_#NNNNr" before things get misaligned. // Easy enough to fix if this ever doesn't seem like @@ -79,7 +79,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { let mut constraints: Vec<_> = self.constraints.iter().collect(); constraints.sort(); for constraint in &constraints { - let Constraint { + let OutlivesConstraint { sup, sub, point, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs b/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs index 6c4c02a36a0..c02e4ff3156 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs @@ -27,7 +27,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { impl<'this, 'tcx> dot::Labeller<'this> for RegionInferenceContext<'tcx> { type Node = RegionVid; - type Edge = Constraint; + type Edge = OutlivesConstraint; fn graph_id(&'this self) -> dot::Id<'this> { dot::Id::new(format!("RegionInferenceContext")).unwrap() @@ -41,31 +41,31 @@ impl<'this, 'tcx> dot::Labeller<'this> for RegionInferenceContext<'tcx> { fn node_label(&'this self, n: &RegionVid) -> dot::LabelText<'this> { dot::LabelText::LabelStr(format!("{:?}", n).into_cow()) } - fn edge_label(&'this self, e: &Constraint) -> dot::LabelText<'this> { + fn edge_label(&'this self, e: &OutlivesConstraint) -> dot::LabelText<'this> { dot::LabelText::LabelStr(format!("{:?}", e.point).into_cow()) } } impl<'this, 'tcx> dot::GraphWalk<'this> for RegionInferenceContext<'tcx> { type Node = RegionVid; - type Edge = Constraint; + type Edge = OutlivesConstraint; fn nodes(&'this self) -> dot::Nodes<'this, RegionVid> { let vids: Vec = self.definitions.indices().collect(); vids.into_cow() } - fn edges(&'this self) -> dot::Edges<'this, Constraint> { + fn edges(&'this self) -> dot::Edges<'this, OutlivesConstraint> { (&self.constraints.raw[..]).into_cow() } // Render `a: b` as `a <- b`, indicating the flow // of data during inference. - fn source(&'this self, edge: &Constraint) -> RegionVid { + fn source(&'this self, edge: &OutlivesConstraint) -> RegionVid { edge.sub } - fn target(&'this self, edge: &Constraint) -> RegionVid { + fn target(&'this self, edge: &OutlivesConstraint) -> RegionVid { edge.sup } } diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index dea2683789b..d974a60c15c 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -68,7 +68,7 @@ pub struct RegionInferenceContext<'tcx> { dependency_map: Option>>, /// The constraints we have accumulated and used during solving. - constraints: IndexVec, + constraints: IndexVec, /// Type constraints that we check after solving. type_tests: Vec>, @@ -118,11 +118,12 @@ pub(crate) enum Cause { } #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct Constraint { +pub struct OutlivesConstraint { // NB. The ordering here is not significant for correctness, but // it is for convenience. Before we dump the constraints in the // debugging logs, we sort them, and we'd like the "super region" // to be first, etc. (In particular, span should remain last.) + /// The region SUP must outlive SUB... sup: RegionVid, @@ -387,7 +388,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { ) { debug!("add_outlives({:?}: {:?} @ {:?}", sup, sub, point); assert!(self.inferred_values.is_none(), "values already inferred"); - self.constraints.push(Constraint { + self.constraints.push(OutlivesConstraint { span, sup, sub, @@ -1139,7 +1140,7 @@ impl<'tcx> RegionDefinition<'tcx> { } } -impl fmt::Debug for Constraint { +impl fmt::Debug for OutlivesConstraint { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!( formatter,