address nits by mattewjasper
This commit is contained in:
parent
0b15a66a80
commit
adba6a8f90
@ -197,26 +197,8 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Enforce constraints of the form:
|
||||
///
|
||||
/// ```
|
||||
/// 'r0 in ['o1...'oN]
|
||||
/// ```
|
||||
///
|
||||
/// such a constraint simply means that `'r0` must be equal to one
|
||||
/// of the regions `'o1...'oN`. This is an annoying constraint to
|
||||
/// integrate into our inference, which generally works by
|
||||
/// iteratively growing regions until we find a match -- that's
|
||||
/// not an option here.
|
||||
///
|
||||
/// What we currently do:
|
||||
///
|
||||
/// - Search forward in the graph from `'r0` to find each region `'b`
|
||||
/// where `'r0 <= 'b` must hold.
|
||||
/// - Try to rule out some of the `'o1..'oN` options:
|
||||
/// - if `'o[i] <= 'b` is false, then `'o[i]` is not an option
|
||||
///
|
||||
/// Hopefully this narrows it down to just one option.
|
||||
/// Enforce all pick constraints and return true if anything
|
||||
/// changed. See `enforce_pick_constraint` for more details.
|
||||
fn enforce_pick_constraints(
|
||||
&self,
|
||||
graph: &RegionGraph<'tcx>,
|
||||
@ -237,15 +219,17 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
|
||||
/// pick 'r from ['o...]
|
||||
/// ```
|
||||
///
|
||||
/// We look to see if there is a unique option `'o` from the list of options
|
||||
/// that:
|
||||
/// We look for all option regions from the list `'o...` that:
|
||||
///
|
||||
/// (a) is greater than the current value of `'r` (which is a lower bound)
|
||||
/// (a) are greater than the current value of `'r` (which is a lower bound)
|
||||
///
|
||||
/// and
|
||||
///
|
||||
/// (b) is compatible with the upper bounds of `'r` that we can
|
||||
/// (b) are compatible with the upper bounds of `'r` that we can
|
||||
/// find by traversing the graph.
|
||||
///
|
||||
/// From that list, we look for a *minimal* option `'o_min`. If we
|
||||
/// find one, then we can enforce that `'r: 'o_min`.
|
||||
fn enforce_pick_constraint(
|
||||
&self,
|
||||
graph: &RegionGraph<'tcx>,
|
||||
|
@ -915,7 +915,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
region: ty::Region<'tcx>,
|
||||
in_regions: &Rc<Vec<ty::Region<'tcx>>>,
|
||||
) {
|
||||
debug!("sub_regions({:?} <: {:?})", region, in_regions);
|
||||
debug!("pick_constraint({:?} <: {:?})", region, in_regions);
|
||||
self.borrow_region_constraints()
|
||||
.pick_constraint(opaque_type_def_id, definition_span, hidden_ty, region, in_regions);
|
||||
}
|
||||
|
@ -271,8 +271,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
/// is an inference variable). If we generated a constraint that
|
||||
/// `Tc: 'a`, then this would incorrectly require that `T: 'a` --
|
||||
/// but this is not necessary, because the existential type we
|
||||
/// create will be allowed to reference `T`. So instead we just
|
||||
/// generate a constraint that `'0: 'a`.
|
||||
/// create will be allowed to reference `T`. So we only generate a
|
||||
/// constraint that `'0: 'a`.
|
||||
///
|
||||
/// # The `free_region_relations` parameter
|
||||
///
|
||||
@ -563,8 +563,7 @@ pub fn unexpected_hidden_region_diagnostic(
|
||||
// ```
|
||||
//
|
||||
// Here the captured lifetime is the intersection of `'a` and
|
||||
// `'b`, which we can't quite express. This prticulararticular
|
||||
// is kind of an unfortunate error anyway.
|
||||
// `'b`, which we can't quite express.
|
||||
|
||||
if let Some(region_scope_tree) = region_scope_tree {
|
||||
// If the `region_scope_tree` is available, this is being
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::indexed_vec::{Idx, IndexVec};
|
||||
use crate::graph::{DirectedGraph, WithNumNodes, WithNumEdges, WithSuccessors, GraphSuccessors};
|
||||
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
pub struct VecGraph<N: Idx> {
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![cfg(test)]
|
||||
|
||||
use super::*;
|
||||
|
||||
fn create_graph() -> VecGraph<usize> {
|
||||
|
@ -1,22 +0,0 @@
|
||||
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ordinary-bounds-pick-original.rs:10:50
|
||||
|
|
||||
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: hidden type `(&u8, &u8)` captures lifetime '_#6r
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
||||
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ordinary-bounds-pick-original.rs:10:50
|
||||
|
|
||||
LL | fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a, 'b> {
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: hidden type `(&u8, &u8)` captures lifetime '_#7r
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
@ -1,11 +0,0 @@
|
||||
warning[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
|
||||
--> $DIR/ordinary-bounds-pick-other.rs:17:74
|
||||
|
|
||||
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: hidden type `Ordinary<'_>` captures lifetime '_#8r
|
||||
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
|
||||
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
|
||||
= note: for more information, try `rustc --explain E0729`
|
||||
|
Loading…
Reference in New Issue
Block a user