Fix elided_named_lifetimes in code

This commit is contained in:
Pavel Grigorenko 2024-08-23 01:12:57 +03:00
parent f167efad2f
commit 53ce92770d
14 changed files with 18 additions and 15 deletions

View File

@ -125,7 +125,7 @@ fn extract_bundled_libs<'a>(
rlib: &'a Path, rlib: &'a Path,
outdir: &Path, outdir: &Path,
bundled_lib_file_names: &FxIndexSet<Symbol>, bundled_lib_file_names: &FxIndexSet<Symbol>,
) -> Result<(), ExtractBundledLibsError<'_>> { ) -> Result<(), ExtractBundledLibsError<'a>> {
let archive_map = unsafe { let archive_map = unsafe {
Mmap::map( Mmap::map(
File::open(rlib) File::open(rlib)

View File

@ -80,7 +80,7 @@ pub fn entrypoint(txt: &str) -> MdStream<'_> {
} }
/// Parse a buffer with specified context /// Parse a buffer with specified context
fn parse_recursive<'a>(buf: &'a [u8], ctx: Context) -> MdStream<'_> { fn parse_recursive<'a>(buf: &'a [u8], ctx: Context) -> MdStream<'a> {
use ParseOpt as Po; use ParseOpt as Po;
use Prev::{Escape, Newline, Whitespace}; use Prev::{Escape, Newline, Whitespace};

View File

@ -59,7 +59,7 @@ fn translate_message<'a>(
&'a self, &'a self,
message: &'a DiagMessage, message: &'a DiagMessage,
args: &'a FluentArgs<'_>, args: &'a FluentArgs<'_>,
) -> Result<Cow<'_, str>, TranslateError<'_>> { ) -> Result<Cow<'a, str>, TranslateError<'a>> {
trace!(?message, ?args); trace!(?message, ?args);
let (identifier, attr) = match message { let (identifier, attr) = match message {
DiagMessage::Str(msg) | DiagMessage::Translated(msg) => { DiagMessage::Str(msg) | DiagMessage::Translated(msg) => {

View File

@ -331,7 +331,7 @@ pub(super) fn find_opaque_ty_constraints_for_rpit<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
def_id: LocalDefId, def_id: LocalDefId,
owner_def_id: LocalDefId, owner_def_id: LocalDefId,
) -> Ty<'_> { ) -> Ty<'tcx> {
let tables = tcx.typeck(owner_def_id); let tables = tcx.typeck(owner_def_id);
// Check that all of the opaques we inferred during HIR are compatible. // Check that all of the opaques we inferred during HIR are compatible.

View File

@ -106,7 +106,7 @@ fn identity(_: Ty<'_>) -> Vec<Adjustment<'_>> {
vec![] vec![]
} }
fn simple<'tcx>(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec<Adjustment<'_>> { fn simple<'tcx>(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>> {
move |target| vec![Adjustment { kind, target }] move |target| vec![Adjustment { kind, target }]
} }

View File

@ -87,14 +87,17 @@ fn used_trait_imports(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &UnordSet<LocalDef
&tcx.typeck(def_id).used_trait_imports &tcx.typeck(def_id).used_trait_imports
} }
fn typeck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &ty::TypeckResults<'tcx> { fn typeck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> {
let fallback = move || tcx.type_of(def_id.to_def_id()).instantiate_identity(); let fallback = move || tcx.type_of(def_id.to_def_id()).instantiate_identity();
typeck_with_fallback(tcx, def_id, fallback, None) typeck_with_fallback(tcx, def_id, fallback, None)
} }
/// Used only to get `TypeckResults` for type inference during error recovery. /// Used only to get `TypeckResults` for type inference during error recovery.
/// Currently only used for type inference of `static`s and `const`s to avoid type cycle errors. /// Currently only used for type inference of `static`s and `const`s to avoid type cycle errors.
fn diagnostic_only_typeck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &ty::TypeckResults<'tcx> { fn diagnostic_only_typeck<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
) -> &'tcx ty::TypeckResults<'tcx> {
let fallback = move || { let fallback = move || {
let span = tcx.hir().span(tcx.local_def_id_to_hir_id(def_id)); let span = tcx.hir().span(tcx.local_def_id_to_hir_id(def_id));
Ty::new_error_with_message(tcx, span, "diagnostic only typeck table used") Ty::new_error_with_message(tcx, span, "diagnostic only typeck table used")

View File

@ -98,7 +98,7 @@ pub fn parse(&self) -> Result<QueryResult<'_, ast::Crate>> {
self.parse.compute(|| passes::parse(&self.compiler.sess)) self.parse.compute(|| passes::parse(&self.compiler.sess))
} }
pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'_, &'tcx GlobalCtxt<'tcx>>> { pub fn global_ctxt(&'tcx self) -> Result<QueryResult<'tcx, &'tcx GlobalCtxt<'tcx>>> {
self.gcx.compute(|| { self.gcx.compute(|| {
let krate = self.parse()?.steal(); let krate = self.parse()?.steal();

View File

@ -1487,7 +1487,7 @@ fn get_proc_macro_quoted_span(self, index: usize, sess: &Session) -> Span {
.decode((self, sess)) .decode((self, sess))
} }
fn get_foreign_modules(self, sess: &'a Session) -> impl Iterator<Item = ForeignModule> + '_ { fn get_foreign_modules(self, sess: &'a Session) -> impl Iterator<Item = ForeignModule> + 'a {
self.root.foreign_modules.decode((self, sess)) self.root.foreign_modules.decode((self, sess))
} }

View File

@ -269,7 +269,7 @@ pub fn type_param(&'tcx self, param: ParamTy, tcx: TyCtxt<'tcx>) -> &'tcx Generi
} }
/// Returns the `GenericParamDef` associated with this `ParamConst`. /// Returns the `GenericParamDef` associated with this `ParamConst`.
pub fn const_param(&'tcx self, param: ParamConst, tcx: TyCtxt<'tcx>) -> &GenericParamDef { pub fn const_param(&'tcx self, param: ParamConst, tcx: TyCtxt<'tcx>) -> &'tcx GenericParamDef {
let param = self.param_at(param.index as usize, tcx); let param = self.param_at(param.index as usize, tcx);
match param.kind { match param.kind {
GenericParamDefKind::Const { .. } => param, GenericParamDefKind::Const { .. } => param,

View File

@ -493,7 +493,7 @@ pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> {
} }
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> { impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> {
fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'_, G> { fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
let mut diag = let mut diag =
Diag::new(dcx, level, fluent::mir_build_non_exhaustive_patterns_type_not_empty); Diag::new(dcx, level, fluent::mir_build_non_exhaustive_patterns_type_not_empty);
diag.span(self.scrut_span); diag.span(self.scrut_span);

View File

@ -366,7 +366,7 @@ fn adt_consider_insignificant_dtor<'tcx>(
fn adt_drop_tys<'tcx>( fn adt_drop_tys<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
def_id: DefId, def_id: DefId,
) -> Result<&ty::List<Ty<'tcx>>, AlwaysRequiresDrop> { ) -> Result<&'tcx ty::List<Ty<'tcx>>, AlwaysRequiresDrop> {
// This is for the "adt_drop_tys" query, that considers all `Drop` impls, therefore all dtors are // This is for the "adt_drop_tys" query, that considers all `Drop` impls, therefore all dtors are
// significant. // significant.
let adt_has_dtor = let adt_has_dtor =

View File

@ -53,7 +53,7 @@ fn filter_assoc_items_by_name_and_namespace<'a>(
assoc_items_of: DefId, assoc_items_of: DefId,
ident: Ident, ident: Ident,
ns: Namespace, ns: Namespace,
) -> impl Iterator<Item = &ty::AssocItem> + 'a { ) -> impl Iterator<Item = &'a ty::AssocItem> + 'a {
tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name).filter(move |item| { tcx.associated_items(assoc_items_of).filter_by_name_unhygienic(ident.name).filter(move |item| {
item.kind.namespace() == ns && tcx.hygienic_eq(ident, item.ident(tcx), assoc_items_of) item.kind.namespace() == ns && tcx.hygienic_eq(ident, item.ident(tcx), assoc_items_of)
}) })

View File

@ -235,7 +235,7 @@ fn unpack_match<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
/// If `expr` is an (e).await, return the inner expression "e" that's being /// If `expr` is an (e).await, return the inner expression "e" that's being
/// waited on. Otherwise return None. /// waited on. Otherwise return None.
fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &hir::Expr<'a> { fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
if let ExprKind::Match(expr, _, hir::MatchSource::AwaitDesugar) = expr.kind { if let ExprKind::Match(expr, _, hir::MatchSource::AwaitDesugar) = expr.kind {
if let ExprKind::Call(func, [ref arg_0, ..]) = expr.kind { if let ExprKind::Call(func, [ref arg_0, ..]) = expr.kind {
if matches!( if matches!(

View File

@ -1157,7 +1157,7 @@ fn set_thread_name(&mut self, thread: ThreadId, new_thread_name: Vec<u8>) {
} }
#[inline] #[inline]
fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&[u8]> fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&'c [u8]>
where where
'tcx: 'c, 'tcx: 'c,
{ {