Clarify and improve comment, removing a TODO.
This commit is contained in:
parent
f58a1bfa98
commit
d0ef1664ca
@ -1891,12 +1891,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
|
||||
impl<'a, 'tcx> RegionScope for FnCtxt<'a, 'tcx> {
|
||||
fn object_lifetime_default(&self, span: Span) -> Option<ty::Region> {
|
||||
// TODO. RFC #599 specifies that object lifetime defaults take
|
||||
// precedence over other defaults. *However,* within a fn
|
||||
// body, we typically use inference to allow users to elide
|
||||
// lifetimes whenever they like, and then just infer it to
|
||||
// whatever it must be. So I interpret that as applying only
|
||||
// to fn sigs.
|
||||
// RFC #599 specifies that object lifetime defaults take
|
||||
// precedence over other defaults. But within a fn body we
|
||||
// don't have a *default* region, rather we use inference to
|
||||
// find the *correct* region, which is strictly more general
|
||||
// (and anyway, within a fn body the right region may not even
|
||||
// be something the user can write explicitly, since it might
|
||||
// be some expression).
|
||||
Some(self.infcx().next_region_var(infer::MiscVariable(span)))
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user