Rollup merge of #129386 - cjgillot:local-resolved-arg, r=compiler-errors

Use a LocalDefId in ResolvedArg.
This commit is contained in:
Matthias Krüger 2024-08-23 06:26:53 +02:00 committed by GitHub
commit 487b3d92cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 58 additions and 55 deletions

View File

@ -529,7 +529,7 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
match tcx.named_bound_var(hir_id) { match tcx.named_bound_var(hir_id) {
Some(ResolvedArg::EarlyBound(def_id)) => { Some(ResolvedArg::EarlyBound(def_id)) => {
expected_captures.insert(def_id); expected_captures.insert(def_id.to_def_id());
// Make sure we allow capturing these lifetimes through `Self` and // Make sure we allow capturing these lifetimes through `Self` and
// `T::Assoc` projection syntax, too. These will occur when we only // `T::Assoc` projection syntax, too. These will occur when we only
@ -538,7 +538,7 @@ fn check_opaque_precise_captures<'tcx>(tcx: TyCtxt<'tcx>, opaque_def_id: LocalDe
// feature -- see <https://github.com/rust-lang/rust/pull/115659>. // feature -- see <https://github.com/rust-lang/rust/pull/115659>.
if let DefKind::LifetimeParam = tcx.def_kind(def_id) if let DefKind::LifetimeParam = tcx.def_kind(def_id)
&& let Some(def_id) = tcx && let Some(def_id) = tcx
.map_opaque_lifetime_to_parent_lifetime(def_id.expect_local()) .map_opaque_lifetime_to_parent_lifetime(def_id)
.opt_param_def_id(tcx, tcx.parent(opaque_def_id.to_def_id())) .opt_param_def_id(tcx, tcx.parent(opaque_def_id.to_def_id()))
{ {
shadowed_captures.insert(def_id); shadowed_captures.insert(def_id);

View File

@ -13,7 +13,6 @@ use rustc_ast::visit::walk_list;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet}; use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res}; use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::{GenericArg, GenericParam, GenericParamKind, HirId, HirIdMap, LifetimeName, Node}; use rustc_hir::{GenericArg, GenericParam, GenericParamKind, HirId, HirIdMap, LifetimeName, Node};
use rustc_macros::extension; use rustc_macros::extension;
@ -22,7 +21,7 @@ use rustc_middle::middle::resolve_bound_vars::*;
use rustc_middle::query::Providers; use rustc_middle::query::Providers;
use rustc_middle::ty::{self, TyCtxt, TypeSuperVisitable, TypeVisitor}; use rustc_middle::ty::{self, TyCtxt, TypeSuperVisitable, TypeVisitor};
use rustc_middle::{bug, span_bug}; use rustc_middle::{bug, span_bug};
use rustc_span::def_id::DefId; use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::symbol::{sym, Ident}; use rustc_span::symbol::{sym, Ident};
use rustc_span::Span; use rustc_span::Span;
@ -32,7 +31,7 @@ use crate::errors;
impl ResolvedArg { impl ResolvedArg {
fn early(param: &GenericParam<'_>) -> (LocalDefId, ResolvedArg) { fn early(param: &GenericParam<'_>) -> (LocalDefId, ResolvedArg) {
debug!("ResolvedArg::early: def_id={:?}", param.def_id); debug!("ResolvedArg::early: def_id={:?}", param.def_id);
(param.def_id, ResolvedArg::EarlyBound(param.def_id.to_def_id())) (param.def_id, ResolvedArg::EarlyBound(param.def_id))
} }
fn late(idx: u32, param: &GenericParam<'_>) -> (LocalDefId, ResolvedArg) { fn late(idx: u32, param: &GenericParam<'_>) -> (LocalDefId, ResolvedArg) {
@ -41,10 +40,10 @@ impl ResolvedArg {
"ResolvedArg::late: idx={:?}, param={:?} depth={:?} def_id={:?}", "ResolvedArg::late: idx={:?}, param={:?} depth={:?} def_id={:?}",
idx, param, depth, param.def_id, idx, param, depth, param.def_id,
); );
(param.def_id, ResolvedArg::LateBound(depth, idx, param.def_id.to_def_id())) (param.def_id, ResolvedArg::LateBound(depth, idx, param.def_id))
} }
fn id(&self) -> Option<DefId> { fn id(&self) -> Option<LocalDefId> {
match *self { match *self {
ResolvedArg::StaticLifetime | ResolvedArg::Error(_) => None, ResolvedArg::StaticLifetime | ResolvedArg::Error(_) => None,
@ -288,13 +287,14 @@ fn late_arg_as_bound_arg<'tcx>(
) -> ty::BoundVariableKind { ) -> ty::BoundVariableKind {
match arg { match arg {
ResolvedArg::LateBound(_, _, def_id) => { ResolvedArg::LateBound(_, _, def_id) => {
let name = tcx.hir().name(tcx.local_def_id_to_hir_id(def_id.expect_local())); let def_id = def_id.to_def_id();
let name = tcx.item_name(def_id);
match param.kind { match param.kind {
GenericParamKind::Lifetime { .. } => { GenericParamKind::Lifetime { .. } => {
ty::BoundVariableKind::Region(ty::BrNamed(*def_id, name)) ty::BoundVariableKind::Region(ty::BrNamed(def_id, name))
} }
GenericParamKind::Type { .. } => { GenericParamKind::Type { .. } => {
ty::BoundVariableKind::Ty(ty::BoundTyKind::Param(*def_id, name)) ty::BoundVariableKind::Ty(ty::BoundTyKind::Param(def_id, name))
} }
GenericParamKind::Const { .. } => ty::BoundVariableKind::Const, GenericParamKind::Const { .. } => ty::BoundVariableKind::Const,
} }
@ -717,7 +717,6 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
// 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).copied(); let def = self.map.defs.get(&lifetime.hir_id).copied();
let Some(ResolvedArg::LateBound(_, _, lifetime_def_id)) = def else { continue }; let Some(ResolvedArg::LateBound(_, _, lifetime_def_id)) = def else { continue };
let Some(lifetime_def_id) = lifetime_def_id.as_local() else { continue };
let lifetime_hir_id = self.tcx.local_def_id_to_hir_id(lifetime_def_id); let lifetime_hir_id = self.tcx.local_def_id_to_hir_id(lifetime_def_id);
let bad_place = match self.tcx.hir_node(self.tcx.parent_hir_id(lifetime_hir_id)) let bad_place = match self.tcx.hir_node(self.tcx.parent_hir_id(lifetime_hir_id))
@ -1150,7 +1149,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
.param_def_id_to_index(self.tcx, region_def_id.to_def_id()) .param_def_id_to_index(self.tcx, region_def_id.to_def_id())
.is_some() .is_some()
{ {
break Some(ResolvedArg::EarlyBound(region_def_id.to_def_id())); break Some(ResolvedArg::EarlyBound(region_def_id));
} }
break None; break None;
} }
@ -1259,7 +1258,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
kind => span_bug!( kind => span_bug!(
use_span, use_span,
"did not expect to resolve lifetime to {}", "did not expect to resolve lifetime to {}",
kind.descr(param_def_id) kind.descr(param_def_id.to_def_id())
), ),
}; };
def = ResolvedArg::Error(guar); def = ResolvedArg::Error(guar);
@ -1277,10 +1276,10 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
kind: hir::ImplItemKind::Fn(..), kind: hir::ImplItemKind::Fn(..),
.. ..
}) => { }) => {
def = ResolvedArg::Free(owner_id.to_def_id(), def.id().unwrap()); def = ResolvedArg::Free(owner_id.def_id, def.id().unwrap());
} }
Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(closure), .. }) => { Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(closure), .. }) => {
def = ResolvedArg::Free(closure.def_id.to_def_id(), def.id().unwrap()); def = ResolvedArg::Free(closure.def_id, def.id().unwrap());
} }
_ => {} _ => {}
} }
@ -1351,7 +1350,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
.param_def_id_to_index(self.tcx, param_def_id.to_def_id()) .param_def_id_to_index(self.tcx, param_def_id.to_def_id())
.is_some() .is_some()
{ {
break Some(ResolvedArg::EarlyBound(param_def_id.to_def_id())); break Some(ResolvedArg::EarlyBound(param_def_id));
} }
break None; break None;
} }

View File

@ -296,25 +296,29 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
Some(rbv::ResolvedArg::StaticLifetime) => tcx.lifetimes.re_static, Some(rbv::ResolvedArg::StaticLifetime) => tcx.lifetimes.re_static,
Some(rbv::ResolvedArg::LateBound(debruijn, index, def_id)) => { Some(rbv::ResolvedArg::LateBound(debruijn, index, def_id)) => {
let name = lifetime_name(def_id.expect_local()); let name = lifetime_name(def_id);
let br = ty::BoundRegion { let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(index), var: ty::BoundVar::from_u32(index),
kind: ty::BrNamed(def_id, name), kind: ty::BrNamed(def_id.to_def_id(), name),
}; };
ty::Region::new_bound(tcx, debruijn, br) ty::Region::new_bound(tcx, debruijn, br)
} }
Some(rbv::ResolvedArg::EarlyBound(def_id)) => { Some(rbv::ResolvedArg::EarlyBound(def_id)) => {
let name = tcx.hir().ty_param_name(def_id.expect_local()); let name = tcx.hir().ty_param_name(def_id);
let item_def_id = tcx.hir().ty_param_owner(def_id.expect_local()); let item_def_id = tcx.hir().ty_param_owner(def_id);
let generics = tcx.generics_of(item_def_id); let generics = tcx.generics_of(item_def_id);
let index = generics.param_def_id_to_index[&def_id]; let index = generics.param_def_id_to_index[&def_id.to_def_id()];
ty::Region::new_early_param(tcx, ty::EarlyParamRegion { index, name }) ty::Region::new_early_param(tcx, ty::EarlyParamRegion { index, name })
} }
Some(rbv::ResolvedArg::Free(scope, id)) => { Some(rbv::ResolvedArg::Free(scope, id)) => {
let name = lifetime_name(id.expect_local()); let name = lifetime_name(id);
ty::Region::new_late_param(tcx, scope, ty::BrNamed(id, name)) ty::Region::new_late_param(
tcx,
scope.to_def_id(),
ty::BrNamed(id.to_def_id(), name),
)
// (*) -- not late-bound, won't change // (*) -- not late-bound, won't change
} }
@ -1953,15 +1957,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
let tcx = self.tcx(); let tcx = self.tcx();
match tcx.named_bound_var(hir_id) { match tcx.named_bound_var(hir_id) {
Some(rbv::ResolvedArg::LateBound(debruijn, index, def_id)) => { Some(rbv::ResolvedArg::LateBound(debruijn, index, def_id)) => {
let name = tcx.item_name(def_id); let name = tcx.item_name(def_id.to_def_id());
let br = ty::BoundTy { let br = ty::BoundTy {
var: ty::BoundVar::from_u32(index), var: ty::BoundVar::from_u32(index),
kind: ty::BoundTyKind::Param(def_id, name), kind: ty::BoundTyKind::Param(def_id.to_def_id(), name),
}; };
Ty::new_bound(tcx, debruijn, br) Ty::new_bound(tcx, debruijn, br)
} }
Some(rbv::ResolvedArg::EarlyBound(def_id)) => { Some(rbv::ResolvedArg::EarlyBound(def_id)) => {
let def_id = def_id.expect_local();
let item_def_id = tcx.hir().ty_param_owner(def_id); let item_def_id = tcx.hir().ty_param_owner(def_id);
let generics = tcx.generics_of(item_def_id); let generics = tcx.generics_of(item_def_id);
let index = generics.param_def_id_to_index[&def_id.to_def_id()]; let index = generics.param_def_id_to_index[&def_id.to_def_id()];
@ -1982,10 +1985,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
Some(rbv::ResolvedArg::EarlyBound(def_id)) => { Some(rbv::ResolvedArg::EarlyBound(def_id)) => {
// Find the name and index of the const parameter by indexing the generics of // Find the name and index of the const parameter by indexing the generics of
// the parent item and construct a `ParamConst`. // the parent item and construct a `ParamConst`.
let item_def_id = tcx.parent(def_id); let item_def_id = tcx.local_parent(def_id);
let generics = tcx.generics_of(item_def_id); let generics = tcx.generics_of(item_def_id);
let index = generics.param_def_id_to_index[&def_id]; let index = generics.param_def_id_to_index[&def_id.to_def_id()];
let name = tcx.item_name(def_id); let name = tcx.item_name(def_id.to_def_id());
ty::Const::new_param(tcx, ty::ParamConst::new(index, name)) ty::Const::new_param(tcx, ty::ParamConst::new(index, name))
} }
Some(rbv::ResolvedArg::LateBound(debruijn, index, _)) => { Some(rbv::ResolvedArg::LateBound(debruijn, index, _)) => {

View File

@ -1925,8 +1925,8 @@ impl ExplicitOutlivesRequirements {
fn lifetimes_outliving_lifetime<'tcx>( fn lifetimes_outliving_lifetime<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
inferred_outlives: impl Iterator<Item = &'tcx (ty::Clause<'tcx>, Span)>, inferred_outlives: impl Iterator<Item = &'tcx (ty::Clause<'tcx>, Span)>,
item: DefId, item: LocalDefId,
lifetime: DefId, lifetime: LocalDefId,
) -> Vec<ty::Region<'tcx>> { ) -> Vec<ty::Region<'tcx>> {
let item_generics = tcx.generics_of(item); let item_generics = tcx.generics_of(item);
@ -1934,7 +1934,7 @@ impl ExplicitOutlivesRequirements {
.filter_map(|(clause, _)| match clause.kind().skip_binder() { .filter_map(|(clause, _)| match clause.kind().skip_binder() {
ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => match *a { ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => match *a {
ty::ReEarlyParam(ebr) ty::ReEarlyParam(ebr)
if item_generics.region_param(ebr, tcx).def_id == lifetime => if item_generics.region_param(ebr, tcx).def_id == lifetime.to_def_id() =>
{ {
Some(b) Some(b)
} }
@ -1982,7 +1982,7 @@ impl ExplicitOutlivesRequirements {
let is_inferred = match tcx.named_bound_var(lifetime.hir_id) { let is_inferred = match tcx.named_bound_var(lifetime.hir_id) {
Some(ResolvedArg::EarlyBound(def_id)) => inferred_outlives Some(ResolvedArg::EarlyBound(def_id)) => inferred_outlives
.iter() .iter()
.any(|r| matches!(**r, ty::ReEarlyParam(ebr) if { item_generics.region_param(ebr, tcx).def_id == def_id })), .any(|r| matches!(**r, ty::ReEarlyParam(ebr) if { item_generics.region_param(ebr, tcx).def_id == def_id.to_def_id() })),
_ => false, _ => false,
}; };
@ -2097,7 +2097,7 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
inferred_outlives inferred_outlives
.iter() .iter()
.filter(|(_, span)| !predicate.span.contains(*span)), .filter(|(_, span)| !predicate.span.contains(*span)),
item.owner_id.to_def_id(), item.owner_id.def_id,
region_def_id, region_def_id,
), ),
&predicate.bounds, &predicate.bounds,

View File

@ -300,16 +300,17 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for VisitOpaqueTypes<'tcx> {
Some( Some(
ResolvedArg::EarlyBound(def_id) | ResolvedArg::LateBound(_, _, def_id), ResolvedArg::EarlyBound(def_id) | ResolvedArg::LateBound(_, _, def_id),
) => { ) => {
if self.tcx.def_kind(self.tcx.parent(def_id)) == DefKind::OpaqueTy { if self.tcx.def_kind(self.tcx.local_parent(def_id)) == DefKind::OpaqueTy
{
let def_id = self let def_id = self
.tcx .tcx
.map_opaque_lifetime_to_parent_lifetime(def_id.expect_local()) .map_opaque_lifetime_to_parent_lifetime(def_id)
.opt_param_def_id(self.tcx, self.parent_def_id.to_def_id()) .opt_param_def_id(self.tcx, self.parent_def_id.to_def_id())
.expect("variable should have been duplicated from parent"); .expect("variable should have been duplicated from parent");
explicitly_captured.insert(def_id); explicitly_captured.insert(def_id);
} else { } else {
explicitly_captured.insert(def_id); explicitly_captured.insert(def_id.to_def_id());
} }
} }
_ => { _ => {

View File

@ -2,7 +2,7 @@
use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::fx::FxIndexMap;
use rustc_errors::ErrorGuaranteed; use rustc_errors::ErrorGuaranteed;
use rustc_hir::def_id::DefId; use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::{ItemLocalId, OwnerId}; use rustc_hir::{ItemLocalId, OwnerId};
use rustc_macros::{Decodable, Encodable, HashStable, TyDecodable, TyEncodable}; use rustc_macros::{Decodable, Encodable, HashStable, TyDecodable, TyEncodable};
@ -11,9 +11,9 @@ use crate::ty;
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, HashStable)] #[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, HashStable)]
pub enum ResolvedArg { pub enum ResolvedArg {
StaticLifetime, StaticLifetime,
EarlyBound(/* decl */ DefId), EarlyBound(/* decl */ LocalDefId),
LateBound(ty::DebruijnIndex, /* late-bound index */ u32, /* decl */ DefId), LateBound(ty::DebruijnIndex, /* late-bound index */ u32, /* decl */ LocalDefId),
Free(DefId, /* lifetime decl */ DefId), Free(LocalDefId, /* lifetime decl */ LocalDefId),
Error(ErrorGuaranteed), Error(ErrorGuaranteed),
} }

View File

@ -3035,13 +3035,13 @@ impl<'tcx> TyCtxt<'tcx> {
match self.named_bound_var(lifetime.hir_id) { match self.named_bound_var(lifetime.hir_id) {
Some(resolve_bound_vars::ResolvedArg::EarlyBound(ebv)) => { Some(resolve_bound_vars::ResolvedArg::EarlyBound(ebv)) => {
let new_parent = self.parent(ebv); let new_parent = self.local_parent(ebv);
// If we map to another opaque, then it should be a parent // If we map to another opaque, then it should be a parent
// of the opaque we mapped from. Continue mapping. // of the opaque we mapped from. Continue mapping.
if matches!(self.def_kind(new_parent), DefKind::OpaqueTy) { if matches!(self.def_kind(new_parent), DefKind::OpaqueTy) {
debug_assert_eq!(self.parent(parent.to_def_id()), new_parent); debug_assert_eq!(self.local_parent(parent), new_parent);
opaque_lifetime_param_def_id = ebv.expect_local(); opaque_lifetime_param_def_id = ebv;
continue; continue;
} }
@ -3050,20 +3050,20 @@ impl<'tcx> TyCtxt<'tcx> {
self, self,
ty::EarlyParamRegion { ty::EarlyParamRegion {
index: generics index: generics
.param_def_id_to_index(self, ebv) .param_def_id_to_index(self, ebv.to_def_id())
.expect("early-bound var should be present in fn generics"), .expect("early-bound var should be present in fn generics"),
name: self.hir().name(self.local_def_id_to_hir_id(ebv.expect_local())), name: self.item_name(ebv.to_def_id()),
}, },
); );
} }
Some(resolve_bound_vars::ResolvedArg::LateBound(_, _, lbv)) => { Some(resolve_bound_vars::ResolvedArg::LateBound(_, _, lbv)) => {
let new_parent = self.parent(lbv); let new_parent = self.local_parent(lbv);
return ty::Region::new_late_param( return ty::Region::new_late_param(
self, self,
new_parent, new_parent.to_def_id(),
ty::BoundRegionKind::BrNamed( ty::BoundRegionKind::BrNamed(
lbv, lbv.to_def_id(),
self.hir().name(self.local_def_id_to_hir_id(lbv.expect_local())), self.item_name(lbv.to_def_id()),
), ),
); );
} }

View File

@ -101,7 +101,7 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
// region at the right depth with the same index // region at the right depth with the same index
(Some(rbv::ResolvedArg::EarlyBound(id)), ty::BrNamed(def_id, _)) => { (Some(rbv::ResolvedArg::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.to_def_id() == def_id {
return ControlFlow::Break(arg); return ControlFlow::Break(arg);
} }
} }
@ -118,7 +118,7 @@ impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
debruijn_index debruijn_index
); );
debug!("LateBound id={:?} def_id={:?}", id, def_id); debug!("LateBound id={:?} def_id={:?}", id, def_id);
if debruijn_index == self.current_index && id == def_id { if debruijn_index == self.current_index && id.to_def_id() == def_id {
return ControlFlow::Break(arg); return ControlFlow::Break(arg);
} }
} }
@ -192,7 +192,7 @@ impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
// the lifetime of the TyPath! // the lifetime of the TyPath!
(Some(rbv::ResolvedArg::EarlyBound(id)), ty::BrNamed(def_id, _)) => { (Some(rbv::ResolvedArg::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.to_def_id() == def_id {
return ControlFlow::Break(()); return ControlFlow::Break(());
} }
} }
@ -201,7 +201,7 @@ impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
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);
if debruijn_index == self.current_index && id == def_id { if debruijn_index == self.current_index && id.to_def_id() == def_id {
return ControlFlow::Break(()); return ControlFlow::Break(());
} }
} }

View File

@ -272,7 +272,7 @@ fn clean_lifetime<'tcx>(lifetime: &hir::Lifetime, cx: &mut DocContext<'tcx>) ->
| rbv::ResolvedArg::LateBound(_, _, did) | rbv::ResolvedArg::LateBound(_, _, did)
| rbv::ResolvedArg::Free(_, did), | rbv::ResolvedArg::Free(_, did),
) = cx.tcx.named_bound_var(lifetime.hir_id) ) = cx.tcx.named_bound_var(lifetime.hir_id)
&& let Some(lt) = cx.args.get(&did).and_then(|arg| arg.as_lt()) && let Some(lt) = cx.args.get(&did.to_def_id()).and_then(|arg| arg.as_lt())
{ {
return lt.clone(); return lt.clone();
} }