1
Fork 0

correctly deal with late-bound lifetimes in anon consts

This commit is contained in:
Bastian Kauschke 2020-11-22 13:57:11 +01:00
parent 63a83c5f55
commit 15f0921d0c
6 changed files with 71 additions and 8 deletions

View file

@ -1316,7 +1316,7 @@ rustc_queries! {
desc { "looking up a named region" }
}
query is_late_bound_map(_: LocalDefId) ->
Option<&'tcx FxHashSet<ItemLocalId>> {
Option<(LocalDefId, &'tcx FxHashSet<ItemLocalId>)> {
desc { "testing if a region is late bound" }
}
query object_lifetime_defaults_map(_: LocalDefId)

View file

@ -2578,7 +2578,8 @@ impl<'tcx> TyCtxt<'tcx> {
}
pub fn is_late_bound(self, id: HirId) -> bool {
self.is_late_bound_map(id.owner).map_or(false, |set| set.contains(&id.local_id))
self.is_late_bound_map(id.owner)
.map_or(false, |(owner, set)| owner == id.owner && set.contains(&id.local_id))
}
pub fn object_lifetime_defaults(self, id: HirId) -> Option<&'tcx [ObjectLifetimeDefault]> {