Skip to content

Commit 497a3b4

Browse files
committed
fix typo and tidy
1 parent e2c0378 commit 497a3b4

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

src/librustc_mir/borrow_check/nll/constraint_set.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
111
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
212
use rustc_data_structures::fx::FxHashSet;
313
use rustc::ty::RegionVid;
@@ -14,7 +24,10 @@ crate struct ConstraintSet {
1424

1525
impl ConstraintSet {
1626
pub fn push(&mut self, outlives_constraint: OutlivesConstraint) {
17-
debug!("add_outlives({:?}: {:?} @ {:?}", outlives_constraint.sup, outlives_constraint.sub, outlives_constraint.point);
27+
debug!("add_outlives({:?}: {:?} @ {:?}",
28+
outlives_constraint.sup,
29+
outlives_constraint.sub,
30+
outlives_constraint.point);
1831
if outlives_constraint.sup == outlives_constraint.sub {
1932
// 'a: 'a is pretty uninteresting
2033
return;
@@ -24,12 +37,14 @@ impl ConstraintSet {
2437
}
2538
}
2639

27-
pub fn iner(&self) -> &IndexVec<ConstraintIndex, OutlivesConstraint> {
40+
pub fn inner(&self) -> &IndexVec<ConstraintIndex, OutlivesConstraint> {
2841
&self.constraints
2942
}
3043

31-
/// Do Not use this to add nor remove items to the Vec, nor change the `sup`, nor `sub` of the data.
32-
pub fn iner_mut(&mut self) -> &mut IndexVec<ConstraintIndex, OutlivesConstraint> {
44+
/// Do Not use this to add nor remove items to the Vec,
45+
/// nor change the `sup`,
46+
/// nor `sub` of the data.
47+
pub fn inner_mut(&mut self) -> &mut IndexVec<ConstraintIndex, OutlivesConstraint> {
3348
&mut self.constraints
3449
}
3550
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
7676
}
7777
}
7878

79-
let mut constraints: Vec<_> = self.constraints.iner().iter().collect();
79+
let mut constraints: Vec<_> = self.constraints.inner().iter().collect();
8080
constraints.sort();
8181
for constraint in &constraints {
8282
let OutlivesConstraint {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'this, 'tcx> dot::GraphWalk<'this> for RegionInferenceContext<'tcx> {
5757
vids.into_cow()
5858
}
5959
fn edges(&'this self) -> dot::Edges<'this, OutlivesConstraint> {
60-
(&self.constraints.iner().raw[..]).into_cow()
60+
(&self.constraints.inner().raw[..]).into_cow()
6161
}
6262

6363
// Render `a: b` as `a <- b`, indicating the flow

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
216216
type_tests: Vec<TypeTest<'tcx>>,
217217
) -> Self {
218218
// The `next` field should not yet have been initialized:
219-
debug_assert!(outlives_constraints.iner().iter().all(|c| c.next.is_none()));
219+
debug_assert!(outlives_constraints.inner().iter().all(|c| c.next.is_none()));
220220

221221
let num_region_variables = var_infos.len();
222222
let num_universal_regions = universal_regions.len();
@@ -438,7 +438,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
438438
fn compute_region_values(&self, _mir: &Mir<'tcx>) -> RegionValues {
439439
debug!("compute_region_values()");
440440
debug!("compute_region_values: constraints={:#?}", {
441-
let mut constraints: Vec<_> = self.constraints.iner().iter().collect();
441+
let mut constraints: Vec<_> = self.constraints.inner().iter().collect();
442442
constraints.sort();
443443
constraints
444444
});
@@ -450,7 +450,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
450450
let dependency_map = self.dependency_map.as_ref().unwrap();
451451

452452
// Constraints that may need to be repropagated (initially all):
453-
let mut dirty_list: Vec<_> = self.constraints.iner().indices().collect();
453+
let mut dirty_list: Vec<_> = self.constraints.inner().indices().collect();
454454

455455
// Set to 0 for each constraint that is on the dirty list:
456456
let mut clean_bit_vec = BitVector::new(dirty_list.len());
@@ -459,7 +459,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
459459
while let Some(constraint_idx) = dirty_list.pop() {
460460
clean_bit_vec.insert(constraint_idx.index());
461461

462-
let constraint = &self.constraints.iner()[constraint_idx];
462+
let constraint = &self.constraints.inner()[constraint_idx];
463463
debug!("propagate_constraints: constraint={:?}", constraint);
464464

465465
if inferred_values.add_region(constraint.sup, constraint.sub) {
@@ -471,7 +471,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
471471
if clean_bit_vec.remove(dep_idx.index()) {
472472
dirty_list.push(dep_idx);
473473
}
474-
opt_dep_idx = self.constraints.iner()[dep_idx].next;
474+
opt_dep_idx = self.constraints.inner()[dep_idx].next;
475475
}
476476
}
477477

@@ -488,7 +488,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
488488
fn build_dependency_map(&mut self) -> IndexVec<RegionVid, Option<ConstraintIndex>> {
489489
let mut map = IndexVec::from_elem(None, &self.definitions);
490490

491-
for (idx, constraint) in self.constraints.iner_mut().iter_enumerated_mut().rev() {
491+
for (idx, constraint) in self.constraints.inner_mut().iter_enumerated_mut().rev() {
492492
let mut head = &mut map[constraint.sub];
493493
debug_assert!(constraint.next.is_none());
494494
constraint.next = *head;
@@ -936,7 +936,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
936936
);
937937

938938
let blame_index = self.blame_constraint(longer_fr, shorter_fr);
939-
let blame_span = self.constraints.iner()[blame_index].span;
939+
let blame_span = self.constraints.inner()[blame_index].span;
940940

941941
if let Some(propagated_outlives_requirements) = propagated_outlives_requirements {
942942
// Shrink `fr` until we find a non-local region (if we do).
@@ -1027,7 +1027,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10271027
// - `fr1: X` transitively
10281028
// - and `Y` is live at `elem`
10291029
let index = self.blame_constraint(fr1, elem);
1030-
let region_sub = self.constraints.iner()[index].sub;
1030+
let region_sub = self.constraints.inner()[index].sub;
10311031

10321032
// then return why `Y` was live at `elem`
10331033
self.liveness_constraints.cause(region_sub, elem)
@@ -1048,7 +1048,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10481048
// of dependencies, which doesn't account for the locations of
10491049
// contraints at all. But it will do for now.
10501050
let relevant_constraint = self.constraints
1051-
.iner()
1051+
.inner()
10521052
.iter_enumerated()
10531053
.filter_map(|(i, constraint)| {
10541054
if !self.liveness_constraints.contains(constraint.sub, elem) {
@@ -1084,7 +1084,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10841084

10851085
while changed {
10861086
changed = false;
1087-
for constraint in self.constraints.iner() {
1087+
for constraint in self.constraints.inner() {
10881088
if let Some(n) = result_set[constraint.sup] {
10891089
let m = n + 1;
10901090
if result_set[constraint.sub]

0 commit comments

Comments
 (0)