Nit: improve comment to explain why we wait until regionck
This commit is contained in:
parent
15739b820f
commit
11c84c6625
@ -55,15 +55,19 @@
|
|||||||
//! type-check the closure body (e.g., here it informs us that `T`
|
//! type-check the closure body (e.g., here it informs us that `T`
|
||||||
//! outlives the late-bound region `'a`).
|
//! outlives the late-bound region `'a`).
|
||||||
//!
|
//!
|
||||||
//! > That said, in writing this, I have come to wonder: this
|
//! Note that by delaying the gathering of implied bounds until all
|
||||||
//! inference dependency, I think, is only interesting for
|
//! inference information is known, we may find relationships between
|
||||||
//! late-bound regions in the closure -- if the region appears free
|
//! bound regions and other regions in the environment. For example,
|
||||||
//! in the closure signature, then the relationship must be known to
|
//! when we first check a closure like the one expected as argument
|
||||||
//! the caller (here, `foo`), and hence could be verified earlier
|
//! to `foo`:
|
||||||
//! up. Moreover, we infer late-bound regions quite early on right
|
//!
|
||||||
//! now, i.e., only when the expected signature is known. So we
|
//! ```
|
||||||
//! *may* be able to sidestep this. Regardless, once the NLL
|
//! fn foo<U, F: for<'a> FnMut(&'a U)>(_f: F) {}
|
||||||
//! transition is complete, this concern will be gone. -nmatsakis
|
//! ```
|
||||||
|
//!
|
||||||
|
//! the type of the closure's first argument would be `&'a ?U`. We
|
||||||
|
//! might later infer `?U` to something like `&'b u32`, which would
|
||||||
|
//! imply that `'b: 'a`.
|
||||||
|
|
||||||
use hir::def_id::DefId;
|
use hir::def_id::DefId;
|
||||||
use infer::{self, GenericKind, InferCtxt, RegionObligation, SubregionOrigin, VerifyBound};
|
use infer::{self, GenericKind, InferCtxt, RegionObligation, SubregionOrigin, VerifyBound};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user