Use kw::Empty for elided lifetimes in path.

This commit is contained in:
Camille GILLOT
2022-11-06 11:40:31 +00:00
parent 41090346d8
commit 1c737d6997
12 changed files with 281 additions and 83 deletions

View File

@@ -3,7 +3,7 @@ use crate::ty::{EarlyBinder, SubstsRef};
use rustc_ast as ast;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def_id::DefId;
use rustc_span::symbol::Symbol;
use rustc_span::symbol::{kw, Symbol};
use rustc_span::Span;
use super::{EarlyBoundRegion, InstantiatedPredicates, ParamConst, ParamTy, Predicate, TyCtxt};
@@ -78,6 +78,15 @@ impl GenericParamDef {
}
}
pub fn is_anonymous_lifetime(&self) -> bool {
match self.kind {
GenericParamDefKind::Lifetime => {
self.name == kw::UnderscoreLifetime || self.name == kw::Empty
}
_ => false,
}
}
pub fn default_value<'tcx>(
&self,
tcx: TyCtxt<'tcx>,