Skip to content

Commit adba6a8

Browse files
committed
address nits by mattewjasper
1 parent 0b15a66 commit adba6a8

File tree

7 files changed

+13
-64
lines changed

7 files changed

+13
-64
lines changed

src/librustc/infer/lexical_region_resolve/mod.rs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -197,26 +197,8 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
197197
}
198198
}
199199

200-
/// Enforce constraints of the form:
201-
///
202-
/// ```
203-
/// 'r0 in ['o1...'oN]
204-
/// ```
205-
///
206-
/// such a constraint simply means that `'r0` must be equal to one
207-
/// of the regions `'o1...'oN`. This is an annoying constraint to
208-
/// integrate into our inference, which generally works by
209-
/// iteratively growing regions until we find a match -- that's
210-
/// not an option here.
211-
///
212-
/// What we currently do:
213-
///
214-
/// - Search forward in the graph from `'r0` to find each region `'b`
215-
/// where `'r0 <= 'b` must hold.
216-
/// - Try to rule out some of the `'o1..'oN` options:
217-
/// - if `'o[i] <= 'b` is false, then `'o[i]` is not an option
218-
///
219-
/// Hopefully this narrows it down to just one option.
200+
/// Enforce all pick constraints and return true if anything
201+
/// changed. See `enforce_pick_constraint` for more details.
220202
fn enforce_pick_constraints(
221203
&self,
222204
graph: &RegionGraph<'tcx>,
@@ -237,15 +219,17 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
237219
/// pick 'r from ['o...]
238220
/// ```
239221
///
240-
/// We look to see if there is a unique option `'o` from the list of options
241-
/// that:
222+
/// We look for all option regions from the list `'o...` that:
242223
///
243-
/// (a) is greater than the current value of `'r` (which is a lower bound)
224+
/// (a) are greater than the current value of `'r` (which is a lower bound)
244225
///
245226
/// and
246227
///
247-
/// (b) is compatible with the upper bounds of `'r` that we can
228+
/// (b) are compatible with the upper bounds of `'r` that we can
248229
/// find by traversing the graph.
230+
///
231+
/// From that list, we look for a *minimal* option `'o_min`. If we
232+
/// find one, then we can enforce that `'r: 'o_min`.
249233
fn enforce_pick_constraint(
250234
&self,
251235
graph: &RegionGraph<'tcx>,

src/librustc/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
915915
region: ty::Region<'tcx>,
916916
in_regions: &Rc<Vec<ty::Region<'tcx>>>,
917917
) {
918-
debug!("sub_regions({:?} <: {:?})", region, in_regions);
918+
debug!("pick_constraint({:?} <: {:?})", region, in_regions);
919919
self.borrow_region_constraints()
920920
.pick_constraint(opaque_type_def_id, definition_span, hidden_ty, region, in_regions);
921921
}

src/librustc/infer/opaque_types/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
271271
/// is an inference variable). If we generated a constraint that
272272
/// `Tc: 'a`, then this would incorrectly require that `T: 'a` --
273273
/// but this is not necessary, because the existential type we
274-
/// create will be allowed to reference `T`. So instead we just
275-
/// generate a constraint that `'0: 'a`.
274+
/// create will be allowed to reference `T`. So we only generate a
275+
/// constraint that `'0: 'a`.
276276
///
277277
/// # The `free_region_relations` parameter
278278
///
@@ -563,8 +563,7 @@ pub fn unexpected_hidden_region_diagnostic(
563563
// ```
564564
//
565565
// Here the captured lifetime is the intersection of `'a` and
566-
// `'b`, which we can't quite express. This prticulararticular
567-
// is kind of an unfortunate error anyway.
566+
// `'b`, which we can't quite express.
568567

569568
if let Some(region_scope_tree) = region_scope_tree {
570569
// If the `region_scope_tree` is available, this is being

src/librustc_data_structures/graph/vec_graph/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::indexed_vec::{Idx, IndexVec};
22
use crate::graph::{DirectedGraph, WithNumNodes, WithNumEdges, WithSuccessors, GraphSuccessors};
33

4+
#[cfg(test)]
45
mod test;
56

67
pub struct VecGraph<N: Idx> {

src/librustc_data_structures/graph/vec_graph/test.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![cfg(test)]
2-
31
use super::*;
42

53
fn create_graph() -> VecGraph<usize> {

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original.stderr

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-other.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)