Skip to content

Commit 0dd074e

Browse files
committed
more centril nits
1 parent d9f4d2a commit 0dd074e

File tree

4 files changed

+39
-30
lines changed

4 files changed

+39
-30
lines changed

src/librustc_data_structures/graph/vec_graph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl<N: Idx> VecGraph<N> {
2727

2828
let num_edges = edge_pairs.len();
2929

30-
// Store the *target* of each edge into `edge_targets`
30+
// Store the *target* of each edge into `edge_targets`.
3131
let edge_targets: Vec<N> = edge_pairs.iter().map(|&(_, target)| target).collect();
3232

3333
// Create the *edge starts* array. We are iterating over over

src/librustc_mir/borrow_check/nll/member_constraints.rs

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ use std::ops::Index;
88
use syntax_pos::Span;
99

1010
/// Compactly stores a set of `R0 member of [R1...Rn]` constraints,
11-
/// indexed by the region R0.
11+
/// indexed by the region `R0`.
1212
crate struct MemberConstraintSet<'tcx, R>
1313
where
1414
R: Copy + Hash + Eq,
1515
{
16-
/// Stores the first "member" constraint for a given R0. This is an
16+
/// Stores the first "member" constraint for a given `R0`. This is an
1717
/// index into the `constraints` vector below.
1818
first_constraints: FxHashMap<R, NllMemberConstraintIndex>,
1919

2020
/// Stores the data about each `R0 member of [R1..Rn]` constraint.
2121
/// These are organized into a linked list, so each constraint
22-
/// contains the index of the next constraint with the same R0.
22+
/// contains the index of the next constraint with the same `R0`.
2323
constraints: IndexVec<NllMemberConstraintIndex, NllMemberConstraint<'tcx>>,
2424

2525
/// Stores the `R1..Rn` regions for *all* sets. For any given
@@ -38,10 +38,10 @@ crate struct NllMemberConstraint<'tcx> {
3838
/// The span where the hidden type was instantiated.
3939
crate definition_span: Span,
4040

41-
/// The hidden type in which R0 appears. (Used in error reporting.)
41+
/// The hidden type in which `R0` appears. (Used in error reporting.)
4242
crate hidden_ty: Ty<'tcx>,
4343

44-
/// The region R0.
44+
/// The region `R0`.
4545
crate member_region_vid: ty::RegionVid,
4646

4747
/// Index of `R1` in `choice_regions` vector from `MemberConstraintSet`.
@@ -68,6 +68,15 @@ impl Default for MemberConstraintSet<'tcx, ty::RegionVid> {
6868
}
6969

7070
impl<'tcx> MemberConstraintSet<'tcx, ty::RegionVid> {
71+
/// Pushes a member constraint into the set.
72+
///
73+
/// The input member constraint `m_c` is in the form produced by
74+
/// the the `rustc::infer` code.
75+
///
76+
/// The `to_region_vid` callback fn is used to convert the regions
77+
/// within into `RegionVid` format -- it typically consults the
78+
/// `UniversalRegions` data structure that is known to the caller
79+
/// (but which this code is unaware of).
7180
crate fn push_constraint(
7281
&mut self,
7382
m_c: &MemberConstraint<'tcx>,
@@ -93,14 +102,14 @@ impl<'tcx> MemberConstraintSet<'tcx, ty::RegionVid> {
93102
}
94103
}
95104

96-
impl<'tcx, R1> MemberConstraintSet<'tcx, R1>
105+
impl<R1> MemberConstraintSet<'tcx, R1>
97106
where
98107
R1: Copy + Hash + Eq,
99108
{
100109
/// Remap the "member region" key using `map_fn`, producing a new
101-
/// pick-constraint set. This is used in the NLL code to map from
110+
/// member constraint set. This is used in the NLL code to map from
102111
/// the original `RegionVid` to an scc index. In some cases, we
103-
/// may have multiple R1 values mapping to the same R2 key -- that
112+
/// may have multiple `R1` values mapping to the same `R2` key -- that
104113
/// is ok, the two sets will be merged.
105114
crate fn into_mapped<R2>(
106115
self,
@@ -112,12 +121,12 @@ where
112121
// We can re-use most of the original data, just tweaking the
113122
// linked list links a bit.
114123
//
115-
// For example if we had two keys Ra and Rb that both now wind
116-
// up mapped to the same key S, we would append the linked
117-
// list for Ra onto the end of the linked list for Rb (or vice
118-
// versa) -- this basically just requires rewriting the final
119-
// link from one list to point at the othe other (see
120-
// `append_list`).
124+
// For example if we had two keys `Ra` and `Rb` that both now
125+
// wind up mapped to the same key `S`, we would append the
126+
// linked list for `Ra` onto the end of the linked list for
127+
// `Rb` (or vice versa) -- this basically just requires
128+
// rewriting the final link from one list to point at the othe
129+
// other (see `append_list`).
121130

122131
let MemberConstraintSet { first_constraints, mut constraints, choice_regions } = self;
123132

@@ -140,7 +149,7 @@ where
140149
}
141150
}
142151

143-
impl<'tcx, R> MemberConstraintSet<'tcx, R>
152+
impl<R> MemberConstraintSet<'tcx, R>
144153
where
145154
R: Copy + Hash + Eq,
146155
{
@@ -169,7 +178,7 @@ where
169178
}
170179

171180
/// Returns the "choice regions" for a given member
172-
/// constraint. This is the R1..Rn from a constraint like:
181+
/// constraint. This is the `R1..Rn` from a constraint like:
173182
///
174183
/// ```
175184
/// R0 member of [R1..Rn]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
221221
.outgoing_edges(r, &self.constraints, fr_static);
222222

223223

224-
// But pick-constraints can also give rise to `'r: 'x`
224+
// But member constraints can also give rise to `'r: 'x`
225225
// edges that were not part of the graph initially, so
226226
// watch out for those.
227227
let outgoing_edges_from_picks = self.applied_member_constraints(r)

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub struct RegionInferenceContext<'tcx> {
7575
/// The "R0 member of [R1..Rn]" constraints, indexed by SCC.
7676
member_constraints: Rc<MemberConstraintSet<'tcx, ConstraintSccIndex>>,
7777

78-
/// Records the pick-constraints that we applied to each scc.
78+
/// Records the member constraints that we applied to each scc.
7979
/// This is useful for error reporting. Once constraint
8080
/// propagation is done, this vector is sorted according to
8181
/// `member_region_scc`.
@@ -447,7 +447,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
447447
}
448448

449449
/// Once region solving has completed, this function will return
450-
/// the pick-constraints that were applied to the value of a given
450+
/// the member constraints that were applied to the value of a given
451451
/// region `r`. See `AppliedMemberConstraint`.
452452
fn applied_member_constraints(&self, r: impl ToRegionVid) -> &[AppliedMemberConstraint] {
453453
let scc = self.constraint_sccs.scc(r.to_region_vid());
@@ -598,7 +598,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
598598
}
599599
}
600600

601-
// Now take member constraints into account
601+
// Now take member constraints into account.
602602
let member_constraints = self.member_constraints.clone();
603603
for m_c_i in member_constraints.indices(scc_a) {
604604
self.apply_member_constraint(
@@ -615,7 +615,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
615615
);
616616
}
617617

618-
/// Invoked for each `member R0 of [R1..Rn]` constraint.
618+
/// Invoked for each `R0 member of [R1..Rn]` constraint.
619619
///
620620
/// `scc` is the SCC containing R0, and `choice_regions` are the
621621
/// `R1..Rn` regions -- they are always known to be universal
@@ -659,16 +659,16 @@ impl<'tcx> RegionInferenceContext<'tcx> {
659659
assert!(self.scc_universes[scc] == ty::UniverseIndex::ROOT);
660660
debug_assert!(
661661
self.scc_values.placeholders_contained_in(scc).next().is_none(),
662-
"scc {:?} in a pick-constraint has placeholder value: {:?}",
662+
"scc {:?} in a member constraint has placeholder value: {:?}",
663663
scc,
664664
self.scc_values.region_value_str(scc),
665665
);
666666

667667
// The existing value for `scc` is a lower-bound. This will
668-
// consist of some set {P} + {LB} of points {P} and
669-
// lower-bound free regions {LB}. As each choice region O is a
670-
// free region, it will outlive the points. But we can only
671-
// consider the option O if O: LB.
668+
// consist of some set `{P} + {LB}` of points `{P}` and
669+
// lower-bound free regions `{LB}`. As each choice region `O`
670+
// is a free region, it will outlive the points. But we can
671+
// only consider the option `O` if `O: LB`.
672672
choice_regions.retain(|&o_r| {
673673
self.scc_values
674674
.universal_regions_outlived_by(scc)
@@ -677,8 +677,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
677677
debug!("apply_member_constraint: after lb, choice_regions={:?}", choice_regions);
678678

679679
// Now find all the *upper bounds* -- that is, each UB is a
680-
// free region that must outlive the member region R0 (`UB:
681-
// R0`). Therefore, we need only keep an option O if `UB: O`
680+
// free region that must outlive the member region `R0` (`UB:
681+
// R0`). Therefore, we need only keep an option `O` if `UB: O`
682682
// for all UB.
683683
if choice_regions.len() > 1 {
684684
let universal_region_relations = self.universal_region_relations.clone();
@@ -755,7 +755,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
755755
// I wanted to return an `impl Iterator` here, but it's
756756
// annoying because the `rev_constraint_graph` is in a local
757757
// variable. We'd need a "once-cell" or some such thing to let
758-
// us borrow it for the right amount of time.
758+
// us borrow it for the right amount of time. -- nikomatsakis
759759
let rev_constraint_graph = self.rev_constraint_graph();
760760
let scc_values = &self.scc_values;
761761
let mut duplicates = FxHashSet::default();

0 commit comments

Comments
 (0)