Remove LifetimeDefOrigin
This commit is contained in:
parent
bb548a918a
commit
9386ea9de2
6 changed files with 41 additions and 79 deletions
|
@ -125,7 +125,7 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
||||||
// Find the index of the named region that was part of the
|
// Find the index of the named region that was part of the
|
||||||
// error. We will then search the function parameters for a bound
|
// error. We will then search the function parameters for a bound
|
||||||
// region at the right depth with the same index
|
// region at the right depth with the same index
|
||||||
(Some(rl::Region::EarlyBound(_, id, _)), ty::BrNamed(def_id, _)) => {
|
(Some(rl::Region::EarlyBound(_, id)), ty::BrNamed(def_id, _)) => {
|
||||||
debug!("EarlyBound id={:?} def_id={:?}", id, def_id);
|
debug!("EarlyBound id={:?} def_id={:?}", id, def_id);
|
||||||
if id == def_id {
|
if id == def_id {
|
||||||
self.found_type = Some(arg);
|
self.found_type = Some(arg);
|
||||||
|
@ -137,7 +137,7 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
||||||
// error. We will then search the function parameters for a bound
|
// error. We will then search the function parameters for a bound
|
||||||
// region at the right depth with the same index
|
// region at the right depth with the same index
|
||||||
(
|
(
|
||||||
Some(rl::Region::LateBound(debruijn_index, _, id, _)),
|
Some(rl::Region::LateBound(debruijn_index, _, id)),
|
||||||
ty::BrNamed(def_id, _),
|
ty::BrNamed(def_id, _),
|
||||||
) => {
|
) => {
|
||||||
debug!(
|
debug!(
|
||||||
|
@ -155,8 +155,8 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
||||||
Some(
|
Some(
|
||||||
rl::Region::Static
|
rl::Region::Static
|
||||||
| rl::Region::Free(_, _)
|
| rl::Region::Free(_, _)
|
||||||
| rl::Region::EarlyBound(_, _, _)
|
| rl::Region::EarlyBound(_, _)
|
||||||
| rl::Region::LateBound(_, _, _, _)
|
| rl::Region::LateBound(_, _, _)
|
||||||
| rl::Region::LateBoundAnon(_, _, _),
|
| rl::Region::LateBoundAnon(_, _, _),
|
||||||
)
|
)
|
||||||
| None,
|
| None,
|
||||||
|
@ -221,7 +221,7 @@ impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(Some(rl::Region::EarlyBound(_, id, _)), ty::BrNamed(def_id, _)) => {
|
(Some(rl::Region::EarlyBound(_, id)), ty::BrNamed(def_id, _)) => {
|
||||||
debug!("EarlyBound id={:?} def_id={:?}", id, def_id);
|
debug!("EarlyBound id={:?} def_id={:?}", id, def_id);
|
||||||
if id == def_id {
|
if id == def_id {
|
||||||
self.found_it = true;
|
self.found_it = true;
|
||||||
|
@ -229,7 +229,7 @@ impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(Some(rl::Region::LateBound(debruijn_index, _, id, _)), ty::BrNamed(def_id, _)) => {
|
(Some(rl::Region::LateBound(debruijn_index, _, id)), ty::BrNamed(def_id, _)) => {
|
||||||
debug!("FindNestedTypeVisitor::visit_ty: LateBound depth = {:?}", debruijn_index,);
|
debug!("FindNestedTypeVisitor::visit_ty: LateBound depth = {:?}", debruijn_index,);
|
||||||
debug!("id={:?}", id);
|
debug!("id={:?}", id);
|
||||||
debug!("def_id={:?}", def_id);
|
debug!("def_id={:?}", def_id);
|
||||||
|
@ -242,8 +242,8 @@ impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
|
||||||
(
|
(
|
||||||
Some(
|
Some(
|
||||||
rl::Region::Static
|
rl::Region::Static
|
||||||
| rl::Region::EarlyBound(_, _, _)
|
| rl::Region::EarlyBound(_, _)
|
||||||
| rl::Region::LateBound(_, _, _, _)
|
| rl::Region::LateBound(_, _, _)
|
||||||
| rl::Region::LateBoundAnon(_, _, _)
|
| rl::Region::LateBoundAnon(_, _, _)
|
||||||
| rl::Region::Free(_, _),
|
| rl::Region::Free(_, _),
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,44 +4,14 @@ use crate::ty;
|
||||||
|
|
||||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||||
use rustc_hir::{GenericParam, ItemLocalId};
|
use rustc_hir::ItemLocalId;
|
||||||
use rustc_hir::{GenericParamKind, LifetimeParamKind};
|
|
||||||
use rustc_macros::HashStable;
|
use rustc_macros::HashStable;
|
||||||
|
|
||||||
/// The origin of a named lifetime definition.
|
|
||||||
///
|
|
||||||
/// This is used to prevent the usage of in-band lifetimes in `Fn`/`fn` syntax.
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, HashStable)]
|
|
||||||
pub enum LifetimeDefOrigin {
|
|
||||||
// Explicit binders like `fn foo<'a>(x: &'a u8)` or elided like `impl Foo<&u32>`
|
|
||||||
ExplicitOrElided,
|
|
||||||
// Some kind of erroneous origin
|
|
||||||
Error,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl LifetimeDefOrigin {
|
|
||||||
pub fn from_param(param: &GenericParam<'_>) -> Self {
|
|
||||||
match param.kind {
|
|
||||||
GenericParamKind::Lifetime { kind } => match kind {
|
|
||||||
LifetimeParamKind::Explicit => LifetimeDefOrigin::ExplicitOrElided,
|
|
||||||
LifetimeParamKind::Elided => LifetimeDefOrigin::ExplicitOrElided,
|
|
||||||
LifetimeParamKind::Error => LifetimeDefOrigin::Error,
|
|
||||||
},
|
|
||||||
_ => bug!("expected a lifetime param"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, HashStable)]
|
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, HashStable)]
|
||||||
pub enum Region {
|
pub enum Region {
|
||||||
Static,
|
Static,
|
||||||
EarlyBound(/* index */ u32, /* lifetime decl */ DefId, LifetimeDefOrigin),
|
EarlyBound(/* index */ u32, /* lifetime decl */ DefId),
|
||||||
LateBound(
|
LateBound(ty::DebruijnIndex, /* late-bound index */ u32, /* lifetime decl */ DefId),
|
||||||
ty::DebruijnIndex,
|
|
||||||
/* late-bound index */ u32,
|
|
||||||
/* lifetime decl */ DefId,
|
|
||||||
LifetimeDefOrigin,
|
|
||||||
),
|
|
||||||
LateBoundAnon(ty::DebruijnIndex, /* late-bound index */ u32, /* anon index */ u32),
|
LateBoundAnon(ty::DebruijnIndex, /* late-bound index */ u32, /* anon index */ u32),
|
||||||
Free(DefId, /* lifetime decl */ DefId),
|
Free(DefId, /* lifetime decl */ DefId),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// ignore-tidy-filelength
|
|
||||||
//! Name resolution for lifetimes.
|
//! Name resolution for lifetimes.
|
||||||
//!
|
//!
|
||||||
//! Name resolution for lifetimes follows *much* simpler rules than the
|
//! Name resolution for lifetimes follows *much* simpler rules than the
|
||||||
|
@ -63,23 +62,18 @@ impl RegionExt for Region {
|
||||||
let i = *index;
|
let i = *index;
|
||||||
*index += 1;
|
*index += 1;
|
||||||
let def_id = hir_map.local_def_id(param.hir_id);
|
let def_id = hir_map.local_def_id(param.hir_id);
|
||||||
let origin = LifetimeDefOrigin::from_param(param);
|
|
||||||
debug!("Region::early: index={} def_id={:?}", i, def_id);
|
debug!("Region::early: index={} def_id={:?}", i, def_id);
|
||||||
(param.name.normalize_to_macros_2_0(), Region::EarlyBound(i, def_id.to_def_id(), origin))
|
(param.name.normalize_to_macros_2_0(), Region::EarlyBound(i, def_id.to_def_id()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn late(idx: u32, hir_map: Map<'_>, param: &GenericParam<'_>) -> (ParamName, Region) {
|
fn late(idx: u32, hir_map: Map<'_>, param: &GenericParam<'_>) -> (ParamName, Region) {
|
||||||
let depth = ty::INNERMOST;
|
let depth = ty::INNERMOST;
|
||||||
let def_id = hir_map.local_def_id(param.hir_id);
|
let def_id = hir_map.local_def_id(param.hir_id);
|
||||||
let origin = LifetimeDefOrigin::from_param(param);
|
|
||||||
debug!(
|
debug!(
|
||||||
"Region::late: idx={:?}, param={:?} depth={:?} def_id={:?} origin={:?}",
|
"Region::late: idx={:?}, param={:?} depth={:?} def_id={:?}",
|
||||||
idx, param, depth, def_id, origin,
|
idx, param, depth, def_id,
|
||||||
);
|
);
|
||||||
(
|
(param.name.normalize_to_macros_2_0(), Region::LateBound(depth, idx, def_id.to_def_id()))
|
||||||
param.name.normalize_to_macros_2_0(),
|
|
||||||
Region::LateBound(depth, idx, def_id.to_def_id(), origin),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn late_anon(named_late_bound_vars: u32, index: &Cell<u32>) -> Region {
|
fn late_anon(named_late_bound_vars: u32, index: &Cell<u32>) -> Region {
|
||||||
|
@ -93,7 +87,7 @@ impl RegionExt for Region {
|
||||||
match *self {
|
match *self {
|
||||||
Region::Static | Region::LateBoundAnon(..) => None,
|
Region::Static | Region::LateBoundAnon(..) => None,
|
||||||
|
|
||||||
Region::EarlyBound(_, id, _) | Region::LateBound(_, _, id, _) | Region::Free(_, id) => {
|
Region::EarlyBound(_, id) | Region::LateBound(_, _, id) | Region::Free(_, id) => {
|
||||||
Some(id)
|
Some(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,8 +95,8 @@ impl RegionExt for Region {
|
||||||
|
|
||||||
fn shifted(self, amount: u32) -> Region {
|
fn shifted(self, amount: u32) -> Region {
|
||||||
match self {
|
match self {
|
||||||
Region::LateBound(debruijn, idx, id, origin) => {
|
Region::LateBound(debruijn, idx, id) => {
|
||||||
Region::LateBound(debruijn.shifted_in(amount), idx, id, origin)
|
Region::LateBound(debruijn.shifted_in(amount), idx, id)
|
||||||
}
|
}
|
||||||
Region::LateBoundAnon(debruijn, index, anon_index) => {
|
Region::LateBoundAnon(debruijn, index, anon_index) => {
|
||||||
Region::LateBoundAnon(debruijn.shifted_in(amount), index, anon_index)
|
Region::LateBoundAnon(debruijn.shifted_in(amount), index, anon_index)
|
||||||
|
@ -113,8 +107,8 @@ impl RegionExt for Region {
|
||||||
|
|
||||||
fn shifted_out_to_binder(self, binder: ty::DebruijnIndex) -> Region {
|
fn shifted_out_to_binder(self, binder: ty::DebruijnIndex) -> Region {
|
||||||
match self {
|
match self {
|
||||||
Region::LateBound(debruijn, index, id, origin) => {
|
Region::LateBound(debruijn, index, id) => {
|
||||||
Region::LateBound(debruijn.shifted_out_to_binder(binder), index, id, origin)
|
Region::LateBound(debruijn.shifted_out_to_binder(binder), index, id)
|
||||||
}
|
}
|
||||||
Region::LateBoundAnon(debruijn, index, anon_index) => {
|
Region::LateBoundAnon(debruijn, index, anon_index) => {
|
||||||
Region::LateBoundAnon(debruijn.shifted_out_to_binder(binder), index, anon_index)
|
Region::LateBoundAnon(debruijn.shifted_out_to_binder(binder), index, anon_index)
|
||||||
|
@ -127,7 +121,7 @@ impl RegionExt for Region {
|
||||||
where
|
where
|
||||||
L: Iterator<Item = &'a hir::Lifetime>,
|
L: Iterator<Item = &'a hir::Lifetime>,
|
||||||
{
|
{
|
||||||
if let Region::EarlyBound(index, _, _) = self {
|
if let Region::EarlyBound(index, _) = self {
|
||||||
params.nth(index as usize).and_then(|lifetime| map.defs.get(&lifetime.hir_id).cloned())
|
params.nth(index as usize).and_then(|lifetime| map.defs.get(&lifetime.hir_id).cloned())
|
||||||
} else {
|
} else {
|
||||||
Some(self)
|
Some(self)
|
||||||
|
@ -568,7 +562,7 @@ fn sub_items_have_self_param(node: &hir::ItemKind<'_>) -> bool {
|
||||||
|
|
||||||
fn late_region_as_bound_region<'tcx>(tcx: TyCtxt<'tcx>, region: &Region) -> ty::BoundVariableKind {
|
fn late_region_as_bound_region<'tcx>(tcx: TyCtxt<'tcx>, region: &Region) -> ty::BoundVariableKind {
|
||||||
match region {
|
match region {
|
||||||
Region::LateBound(_, _, def_id, _) => {
|
Region::LateBound(_, _, def_id) => {
|
||||||
let name = tcx.hir().name(tcx.hir().local_def_id_to_hir_id(def_id.expect_local()));
|
let name = tcx.hir().name(tcx.hir().local_def_id_to_hir_id(def_id.expect_local()));
|
||||||
ty::BoundVariableKind::Region(ty::BrNamed(*def_id, name))
|
ty::BoundVariableKind::Region(ty::BrNamed(*def_id, name))
|
||||||
}
|
}
|
||||||
|
@ -1010,7 +1004,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
// well-supported at the moment, so this doesn't work.
|
// well-supported at the moment, so this doesn't work.
|
||||||
// In the future, this should be fixed and this error should be removed.
|
// In the future, this should be fixed and this error should be removed.
|
||||||
let def = self.map.defs.get(&lifetime.hir_id).cloned();
|
let def = self.map.defs.get(&lifetime.hir_id).cloned();
|
||||||
let Some(Region::LateBound(_, _, def_id, _)) = def else {
|
let Some(Region::LateBound(_, _, def_id)) = def else {
|
||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
let Some(def_id) = def_id.as_local() else {
|
let Some(def_id) = def_id.as_local() else {
|
||||||
|
@ -1046,7 +1040,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||||
match param.kind {
|
match param.kind {
|
||||||
GenericParamKind::Lifetime { .. } => {
|
GenericParamKind::Lifetime { .. } => {
|
||||||
let (name, reg) = Region::early(self.tcx.hir(), &mut index, ¶m);
|
let (name, reg) = Region::early(self.tcx.hir(), &mut index, ¶m);
|
||||||
let Region::EarlyBound(_, def_id, _) = reg else {
|
let Region::EarlyBound(_, def_id) = reg else {
|
||||||
bug!();
|
bug!();
|
||||||
};
|
};
|
||||||
// We cannot predict what lifetimes are unused in opaque type.
|
// We cannot predict what lifetimes are unused in opaque type.
|
||||||
|
@ -1668,7 +1662,7 @@ fn compute_object_lifetime_defaults<'tcx>(
|
||||||
.map(|set| match *set {
|
.map(|set| match *set {
|
||||||
Set1::Empty => "BaseDefault".into(),
|
Set1::Empty => "BaseDefault".into(),
|
||||||
Set1::One(Region::Static) => "'static".into(),
|
Set1::One(Region::Static) => "'static".into(),
|
||||||
Set1::One(Region::EarlyBound(mut i, _, _)) => generics
|
Set1::One(Region::EarlyBound(mut i, _)) => generics
|
||||||
.params
|
.params
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|param| match param.kind {
|
.find_map(|param| match param.kind {
|
||||||
|
@ -1749,18 +1743,16 @@ fn object_lifetime_defaults_for_item<'tcx>(
|
||||||
.params
|
.params
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|param| match param.kind {
|
.filter_map(|param| match param.kind {
|
||||||
GenericParamKind::Lifetime { .. } => Some((
|
GenericParamKind::Lifetime { .. } => {
|
||||||
param.hir_id,
|
Some((param.hir_id, hir::LifetimeName::Param(param.name)))
|
||||||
hir::LifetimeName::Param(param.name),
|
}
|
||||||
LifetimeDefOrigin::from_param(param),
|
|
||||||
)),
|
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.find(|&(_, (_, lt_name, _))| lt_name == name)
|
.find(|&(_, (_, lt_name))| lt_name == name)
|
||||||
.map_or(Set1::Many, |(i, (id, _, origin))| {
|
.map_or(Set1::Many, |(i, (id, _))| {
|
||||||
let def_id = tcx.hir().local_def_id(id);
|
let def_id = tcx.hir().local_def_id(id);
|
||||||
Set1::One(Region::EarlyBound(i as u32, def_id.to_def_id(), origin))
|
Set1::One(Region::EarlyBound(i as u32, def_id.to_def_id()))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1948,8 +1940,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
let def_ids: Vec<_> = defined_by
|
let def_ids: Vec<_> = defined_by
|
||||||
.values()
|
.values()
|
||||||
.flat_map(|region| match region {
|
.flat_map(|region| match region {
|
||||||
Region::EarlyBound(_, def_id, _)
|
Region::EarlyBound(_, def_id)
|
||||||
| Region::LateBound(_, _, def_id, _)
|
| Region::LateBound(_, _, def_id)
|
||||||
| Region::Free(_, def_id) => Some(*def_id),
|
| Region::Free(_, def_id) => Some(*def_id),
|
||||||
|
|
||||||
Region::LateBoundAnon(..) | Region::Static => None,
|
Region::LateBoundAnon(..) | Region::Static => None,
|
||||||
|
@ -2883,7 +2875,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
fn visit_lifetime(&mut self, lifetime_ref: &hir::Lifetime) {
|
fn visit_lifetime(&mut self, lifetime_ref: &hir::Lifetime) {
|
||||||
if let Some(&lifetime) = self.map.defs.get(&lifetime_ref.hir_id) {
|
if let Some(&lifetime) = self.map.defs.get(&lifetime_ref.hir_id) {
|
||||||
match lifetime {
|
match lifetime {
|
||||||
Region::LateBound(debruijn, _, _, _)
|
Region::LateBound(debruijn, _, _)
|
||||||
| Region::LateBoundAnon(debruijn, _, _)
|
| Region::LateBoundAnon(debruijn, _, _)
|
||||||
if debruijn < self.outer_index =>
|
if debruijn < self.outer_index =>
|
||||||
{
|
{
|
||||||
|
@ -3289,8 +3281,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Region::Free(_, def_id)
|
Region::Free(_, def_id)
|
||||||
| Region::LateBound(_, _, def_id, _)
|
| Region::LateBound(_, _, def_id)
|
||||||
| Region::EarlyBound(_, def_id, _) => {
|
| Region::EarlyBound(_, def_id) => {
|
||||||
// A lifetime declared by the user.
|
// A lifetime declared by the user.
|
||||||
let track_lifetime_uses = self.track_lifetime_uses();
|
let track_lifetime_uses = self.track_lifetime_uses();
|
||||||
debug!(?track_lifetime_uses);
|
debug!(?track_lifetime_uses);
|
||||||
|
|
|
@ -205,7 +205,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
let r = match tcx.named_region(lifetime.hir_id) {
|
let r = match tcx.named_region(lifetime.hir_id) {
|
||||||
Some(rl::Region::Static) => tcx.lifetimes.re_static,
|
Some(rl::Region::Static) => tcx.lifetimes.re_static,
|
||||||
|
|
||||||
Some(rl::Region::LateBound(debruijn, index, def_id, _)) => {
|
Some(rl::Region::LateBound(debruijn, index, def_id)) => {
|
||||||
let name = lifetime_name(def_id.expect_local());
|
let name = lifetime_name(def_id.expect_local());
|
||||||
let br = ty::BoundRegion {
|
let br = ty::BoundRegion {
|
||||||
var: ty::BoundVar::from_u32(index),
|
var: ty::BoundVar::from_u32(index),
|
||||||
|
@ -222,7 +222,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
tcx.mk_region(ty::ReLateBound(debruijn, br))
|
tcx.mk_region(ty::ReLateBound(debruijn, br))
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(rl::Region::EarlyBound(index, id, _)) => {
|
Some(rl::Region::EarlyBound(index, id)) => {
|
||||||
let name = lifetime_name(id.expect_local());
|
let name = lifetime_name(id.expect_local());
|
||||||
tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id: id, index, name }))
|
tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id: id, index, name }))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1375,7 +1375,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
|
||||||
match self.tcx.named_region(lt.hir_id) {
|
match self.tcx.named_region(lt.hir_id) {
|
||||||
Some(rl::Region::Static | rl::Region::EarlyBound(..)) => {}
|
Some(rl::Region::Static | rl::Region::EarlyBound(..)) => {}
|
||||||
Some(
|
Some(
|
||||||
rl::Region::LateBound(debruijn, _, _, _)
|
rl::Region::LateBound(debruijn, _, _)
|
||||||
| rl::Region::LateBoundAnon(debruijn, _, _),
|
| rl::Region::LateBoundAnon(debruijn, _, _),
|
||||||
) if debruijn < self.outer_index => {}
|
) if debruijn < self.outer_index => {}
|
||||||
Some(
|
Some(
|
||||||
|
|
|
@ -193,8 +193,8 @@ impl Clean<Lifetime> for hir::Lifetime {
|
||||||
fn clean(&self, cx: &mut DocContext<'_>) -> Lifetime {
|
fn clean(&self, cx: &mut DocContext<'_>) -> Lifetime {
|
||||||
let def = cx.tcx.named_region(self.hir_id);
|
let def = cx.tcx.named_region(self.hir_id);
|
||||||
if let Some(
|
if let Some(
|
||||||
rl::Region::EarlyBound(_, node_id, _)
|
rl::Region::EarlyBound(_, node_id)
|
||||||
| rl::Region::LateBound(_, _, node_id, _)
|
| rl::Region::LateBound(_, _, node_id)
|
||||||
| rl::Region::Free(_, node_id),
|
| rl::Region::Free(_, node_id),
|
||||||
) = def
|
) = def
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue