Rollup merge of #129510 - GrigorenkoPV:fix-elided-named-lifetimes, r=cjgillot

Fix `elided_named_lifetimes` in code

https://github.com/rust-lang/rust/pull/129207#issuecomment-2308428671

r? cjgillot
This commit is contained in:
Matthias Krüger 2024-08-24 22:14:15 +02:00 committed by GitHub
commit e664ff5d8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 18 additions and 15 deletions

View File

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

View File

@ -80,7 +80,7 @@ pub fn entrypoint(txt: &str) -> MdStream<'_> {
}
/// 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 Prev::{Escape, Newline, Whitespace};

View File

@ -59,7 +59,7 @@ fn translate_message<'a>(
&'a self,
message: &'a DiagMessage,
args: &'a FluentArgs<'_>,
) -> Result<Cow<'_, str>, TranslateError<'_>> {
) -> Result<Cow<'a, str>, TranslateError<'a>> {
trace!(?message, ?args);
let (identifier, attr) = match message {
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>,
def_id: LocalDefId,
owner_def_id: LocalDefId,
) -> Ty<'_> {
) -> Ty<'tcx> {
let tables = tcx.typeck(owner_def_id);
// Check that all of the opaques we inferred during HIR are compatible.

View File

@ -106,7 +106,7 @@ fn identity(_: Ty<'_>) -> Vec<Adjustment<'_>> {
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 }]
}

View File

@ -87,14 +87,17 @@ fn used_trait_imports(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &UnordSet<LocalDef
&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();
typeck_with_fallback(tcx, def_id, fallback, None)
}
/// 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.
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 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")

View File

@ -98,7 +98,7 @@ pub fn parse(&self) -> Result<QueryResult<'_, ast::Crate>> {
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(|| {
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))
}
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))
}

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`.
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);
match param.kind {
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<'_, '_, '_> {
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 =
Diag::new(dcx, level, fluent::mir_build_non_exhaustive_patterns_type_not_empty);
diag.span(self.scrut_span);

View File

@ -366,7 +366,7 @@ fn adt_consider_insignificant_dtor<'tcx>(
fn adt_drop_tys<'tcx>(
tcx: TyCtxt<'tcx>,
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
// significant.
let adt_has_dtor =

View File

@ -53,7 +53,7 @@ fn filter_assoc_items_by_name_and_namespace<'a>(
assoc_items_of: DefId,
ident: Ident,
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| {
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
/// 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::Call(func, [ref arg_0, ..]) = expr.kind {
if matches!(

View File

@ -1157,7 +1157,7 @@ fn set_thread_name(&mut self, thread: ThreadId, new_thread_name: Vec<u8>) {
}
#[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
'tcx: 'c,
{