From edcb870efc7d3da840e7fd9d74bb065c449581ca Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Fri, 8 Sep 2023 01:35:51 +0000 Subject: [PATCH] wip --- compiler/rustc_ast/src/ast.rs | 2 +- compiler/rustc_ast_lowering/src/lib.rs | 4 +- .../src/lifetime_collector.rs | 19 +- compiler/rustc_hir/src/hir.rs | 6 +- .../src/infer/error_reporting/mod.rs | 355 ++++++++---------- compiler/rustc_middle/src/hir/mod.rs | 1 + compiler/rustc_middle/src/ty/context.rs | 6 +- compiler/rustc_resolve/src/late.rs | 2 +- compiler/rustc_span/src/symbol.rs | 3 +- .../issue-109071.no_gate.stderr | 4 +- .../issue-109071.with_gate.stderr | 4 +- ...nd-lifetime-in-binding-only.elision.stderr | 4 +- ...und-lifetime-in-return-only.elision.stderr | 4 +- .../in-trait/async-generics-and-bounds.stderr | 18 +- .../in-trait/async-generics.stderr | 18 +- ...sue-74072-lifetime-name-annotations.stderr | 2 +- .../issue-75785-confusing-named-region.stderr | 2 +- tests/ui/async-await/issue-76547.stderr | 20 +- .../ui/async-await/issues/issue-62097.stderr | 4 +- .../async-await/issues/issue-63388-2.stderr | 4 +- .../ui/async-await/issues/issue-72312.stderr | 4 +- tests/ui/borrowck/issue-103624.stderr | 4 +- tests/ui/c-variadic/variadic-ffi-6.stderr | 4 +- .../ui/closures/binder/implicit-stuff.stderr | 20 +- .../const-param-elided-lifetime.full.stderr | 20 +- .../const-param-elided-lifetime.min.stderr | 20 +- tests/ui/error-codes/E0106.stderr | 12 +- tests/ui/error-codes/E0308-2.stderr | 4 +- tests/ui/error-codes/E0311.fixed | 2 +- tests/ui/error-codes/E0311.stderr | 4 +- tests/ui/error-codes/E0637.stderr | 4 +- tests/ui/foreign-fn-return-lifetime.stderr | 4 +- .../gat-trait-path-generic-type-arg.stderr | 4 +- .../elided-lifetimes.stderr | 8 +- ...rrect-explicit-lifetime-name-needed.stderr | 4 +- .../assoc-type.stderr | 4 +- .../ui/impl-trait/impl-fn-hrtb-bounds.stderr | 4 +- .../impl-fn-parsing-ambiguities.stderr | 4 +- tests/ui/issues/issue-13497.stderr | 4 +- tests/ui/issues/issue-17905-2.stderr | 8 +- tests/ui/issues/issue-19707.stderr | 8 +- tests/ui/issues/issue-30255.stderr | 12 +- tests/ui/issues/issue-60622.stderr | 2 +- tests/ui/issues/issue-65230.stderr | 4 +- tests/ui/issues/issue-69130.stderr | 4 +- tests/ui/lifetimes/fullwidth-ampersand.stderr | 4 +- tests/ui/lifetimes/issue-105227.fixed | 6 +- tests/ui/lifetimes/issue-105227.stderr | 10 +- tests/ui/lifetimes/issue-26638.stderr | 12 +- .../issue-90170-elision-mismatch.fixed | 6 +- .../issue-90170-elision-mismatch.stderr | 12 +- ...urn-type-requires-explicit-lifetime.stderr | 28 +- .../ex1b-return-no-names-if-else.stderr | 4 +- .../ex3-both-anon-regions-2.stderr | 4 +- .../ex3-both-anon-regions-3.stderr | 8 +- ...th-anon-regions-return-type-is-anon.stderr | 4 +- .../ex3-both-anon-regions-self-is-anon.stderr | 4 +- ...x3-both-anon-regions-using-fn-items.stderr | 4 +- ...-both-anon-regions-using-impl-items.stderr | 4 +- ...th-anon-regions-using-trait-objects.stderr | 4 +- .../ex3-both-anon-regions.stderr | 4 +- ...roducing-and-adding-missing-lifetime.fixed | 2 +- ...oducing-and-adding-missing-lifetime.stderr | 4 +- .../method-call-lifetime-args-fail.stderr | 28 +- ...method-call-lifetime-args-lint-fail.stderr | 14 +- .../method-call-lifetime-args-lint.stderr | 2 +- .../methods/method-call-lifetime-args.stderr | 4 +- tests/ui/proc-macro/item-error.stderr | 4 +- tests/ui/regions/regions-in-enums-anon.stderr | 4 +- .../ui/regions/regions-in-structs-anon.stderr | 4 +- .../ui/rfcs/rfc-1623-static/rfc1623-3.stderr | 8 +- ...f_types_pin_lifetime_mismatch-async.stderr | 30 +- ...ry_self_types_pin_lifetime_mismatch.stderr | 8 +- .../ui/self/elision/lt-ref-self-async.stderr | 60 +-- tests/ui/self/elision/lt-ref-self.stderr | 24 +- tests/ui/self/elision/nested-item.stderr | 4 +- .../ui/self/elision/ref-mut-self-async.stderr | 60 +-- tests/ui/self/elision/ref-mut-self.stderr | 24 +- .../self/elision/ref-mut-struct-async.stderr | 50 +-- tests/ui/self/elision/ref-mut-struct.stderr | 20 +- tests/ui/self/elision/ref-self-async.stderr | 70 ++-- tests/ui/self/elision/ref-self.stderr | 28 +- tests/ui/self/elision/ref-struct-async.stderr | 50 +-- tests/ui/self/elision/ref-struct.stderr | 20 +- .../fn-missing-lifetime-in-item.stderr | 4 +- .../impl-trait-missing-lifetime-gated.stderr | 24 +- tests/ui/suggestions/issue-86667.stderr | 10 +- .../suggestions/lifetimes/issue-105544.fixed | 8 +- .../suggestions/lifetimes/issue-105544.stderr | 16 +- .../missing-lifetimes-in-signature-2.fixed | 2 +- .../missing-lifetimes-in-signature-2.stderr | 4 +- ...lifetimes-in-signature-before-const.stderr | 4 +- .../missing-lifetimes-in-signature.stderr | 14 +- ...ifetime-in-assoc-const-type.default.stderr | 4 +- ...ssoc-const-type.generic_const_items.stderr | 4 +- .../missing-lifetime-specifier.stderr | 42 ++- .../ui/suggestions/missing-lt-for-hrtb.stderr | 18 +- .../multiline-multipart-suggestion.stderr | 12 +- .../suggestions/return-elided-lifetime.stderr | 60 +-- .../return-without-lifetime.stderr | 12 +- ...oxed-closure-sugar-lifetime-elision.stderr | 4 +- ...se-inherent-impl-ampersand-rust2015.stderr | 4 +- ...se-inherent-impl-ampersand-rust2018.stderr | 4 +- ...where-clause-trait-impl-region-2015.stderr | 4 +- ...where-clause-trait-impl-region-2018.stderr | 4 +- 105 files changed, 771 insertions(+), 781 deletions(-) diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 395540764ea05..e5cfe759f73af 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -69,7 +69,7 @@ pub struct Lifetime { impl fmt::Debug for Lifetime { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "lifetime({}: {})", self.id, self) + write!(f, "lifetime({}: {:?})", self.id, self.ident) } } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 41db61d391a13..e7049b2f6326f 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1327,7 +1327,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } else { self.next_node_id() }; - let span = self.tcx.sess.source_map().start_point(t.span).shrink_to_hi(); + let span = self.tcx.sess.source_map().start_point(t.span); Lifetime { ident: Ident::new(kw::UnderscoreLifetime, span), id } }); let lifetime = self.lower_lifetime(®ion); @@ -1564,7 +1564,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // in fn return position, like the `fn test<'a>() -> impl Debug + 'a` // example, we only need to duplicate lifetimes that appear in the // bounds, since those are the only ones that are captured by the opaque. - lifetime_collector::lifetimes_in_bounds(&self.resolver, bounds) + lifetime_collector::lifetimes_in_bounds(self.tcx, &self.resolver, bounds) } } hir::OpaqueTyOrigin::AsyncFn(..) => { diff --git a/compiler/rustc_ast_lowering/src/lifetime_collector.rs b/compiler/rustc_ast_lowering/src/lifetime_collector.rs index 6f75419c38765..76acf333b1952 100644 --- a/compiler/rustc_ast_lowering/src/lifetime_collector.rs +++ b/compiler/rustc_ast_lowering/src/lifetime_collector.rs @@ -3,19 +3,20 @@ use rustc_ast::visit::{self, BoundKind, LifetimeCtxt, Visitor}; use rustc_ast::{GenericBounds, Lifetime, NodeId, PathSegment, PolyTraitRef, Ty, TyKind}; use rustc_hir::def::{DefKind, LifetimeRes, Res}; use rustc_middle::span_bug; -use rustc_middle::ty::ResolverAstLowering; +use rustc_middle::ty::{ResolverAstLowering, TyCtxt}; use rustc_span::symbol::{kw, Ident}; use rustc_span::Span; -struct LifetimeCollectVisitor<'ast> { +struct LifetimeCollectVisitor<'ast, 'tcx> { + tcx: TyCtxt<'tcx>, resolver: &'ast ResolverAstLowering, current_binders: Vec, collected_lifetimes: Vec, } -impl<'ast> LifetimeCollectVisitor<'ast> { - fn new(resolver: &'ast ResolverAstLowering) -> Self { - Self { resolver, current_binders: Vec::new(), collected_lifetimes: Vec::new() } +impl<'ast, 'tcx> LifetimeCollectVisitor<'ast, 'tcx> { + fn new(tcx: TyCtxt<'tcx>, resolver: &'ast ResolverAstLowering) -> Self { + Self { tcx, resolver, current_binders: Vec::new(), collected_lifetimes: Vec::new() } } fn record_lifetime_use(&mut self, lifetime: Lifetime) { @@ -58,7 +59,7 @@ impl<'ast> LifetimeCollectVisitor<'ast> { } } -impl<'ast> Visitor<'ast> for LifetimeCollectVisitor<'ast> { +impl<'ast> Visitor<'ast> for LifetimeCollectVisitor<'ast, '_> { fn visit_lifetime(&mut self, lifetime: &'ast Lifetime, _: LifetimeCtxt) { self.record_lifetime_use(*lifetime); } @@ -97,7 +98,8 @@ impl<'ast> Visitor<'ast> for LifetimeCollectVisitor<'ast> { self.current_binders.pop(); } TyKind::Ref(None, _) => { - self.record_elided_anchor(t.id, t.span); + let span = self.tcx.sess.source_map().start_point(t.span); + self.record_elided_anchor(t.id, span); visit::walk_ty(self, t); } _ => { @@ -108,10 +110,11 @@ impl<'ast> Visitor<'ast> for LifetimeCollectVisitor<'ast> { } pub fn lifetimes_in_bounds( + tcx: TyCtxt<'_>, resolver: &ResolverAstLowering, bounds: &GenericBounds, ) -> Vec { - let mut visitor = LifetimeCollectVisitor::new(resolver); + let mut visitor = LifetimeCollectVisitor::new(tcx, resolver); for bound in bounds { visitor.visit_param_bound(bound, BoundKind::Bound); } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index a9b25a390b396..da30b9647b710 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -165,8 +165,10 @@ impl Lifetime { } } else if self.res == LifetimeName::ImplicitObjectLifetimeDefault { (LifetimeSuggestionPosition::ObjectDefault, self.ident.span) - } else if self.ident.span.is_empty() { - (LifetimeSuggestionPosition::Ampersand, self.ident.span) + } else if self.ident.name == kw::UnderscoreLifetime + && self.ident.span.hi() - self.ident.span.lo() == BytePos(1) + { + (LifetimeSuggestionPosition::Ampersand, self.ident.span.shrink_to_hi()) } else { (LifetimeSuggestionPosition::Normal, self.ident.span) } diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index ac5468f3dfd0f..5feee0dd02669 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -66,7 +66,6 @@ use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::Visitor; use rustc_hir::lang_items::LangItem; -use rustc_hir::Node; use rustc_middle::dep_graph::DepContext; use rustc_middle::ty::print::with_forced_trimmed_paths; use rustc_middle::ty::relate::{self, RelateResult, TypeRelation}; @@ -2319,6 +2318,125 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { .emit(); } + pub fn name_region( + &self, + generic_param_scope: LocalDefId, + lifetime: Region<'tcx>, + ) -> Option<(String, Vec<(Span, String)>)> { + struct LifetimeVisitor<'tcx, 'a> { + tcx: TyCtxt<'tcx>, + needle: hir::LifetimeName, + new_lt: &'a str, + add_lt_suggs: &'a mut Vec<(Span, String)>, + } + + impl<'hir, 'tcx> hir::intravisit::Visitor<'hir> for LifetimeVisitor<'tcx, '_> { + fn visit_lifetime(&mut self, lt: &'hir hir::Lifetime) { + if lt.res == self.needle { + let (pos, span) = lt.suggestion_position(); + let new_lt = &self.new_lt; + let sugg = match pos { + hir::LifetimeSuggestionPosition::Normal => format!("{new_lt}"), + hir::LifetimeSuggestionPosition::Ampersand => format!("{new_lt} "), + hir::LifetimeSuggestionPosition::ElidedPath => format!("<{new_lt}>"), + hir::LifetimeSuggestionPosition::ElidedPathArgument => { + format!("{new_lt}, ") + } + hir::LifetimeSuggestionPosition::ObjectDefault => format!("+ {new_lt}"), + }; + self.add_lt_suggs.push((span, sugg)); + } + } + + fn visit_nested_item(&mut self, item_id: hir::ItemId) { + let item = self.tcx.hir().item(item_id); + let hir::ItemKind::OpaqueTy(opaque_ty) = item.kind else { + return; + }; + let Some(new_needle) = opaque_ty + .lifetime_mapping + .iter() + .find(|&(a, _)| a.res == self.needle) + .map(|&(_, b)| hir::LifetimeName::Param(b)) + else { + return; + }; + + let prev_needle = std::mem::replace(&mut self.needle, new_needle); + self.visit_item(item); + self.needle = prev_needle; + } + } + + let mut lifetime = lifetime; + let (lifetime_def_id, lifetime_scope) = loop { + let (def_id, scope) = match lifetime.kind() { + ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, .. }) + | ty::ReFree(ty::FreeRegion { bound_region: ty::BrNamed(def_id, _), .. }) + if !lifetime.has_name() => + { + (def_id.expect_local(), self.tcx.local_parent(def_id)) + } + _ => return None, + }; + if self.tcx.def_kind(scope) != DefKind::OpaqueTy { + break (def_id, scope); + } + lifetime = self.tcx.map_rpit_lifetime_to_fn_lifetime(def_id); + }; + + let mut add_lt_suggs = vec![]; + + let new_lt = { + let generics = self.tcx.generics_of(generic_param_scope); + let mut used_names = + iter::successors(Some(generics), |g| g.parent.map(|p| self.tcx.generics_of(p))) + .flat_map(|g| &g.params) + .filter(|p| matches!(p.kind, ty::GenericParamDefKind::Lifetime)) + .map(|p| p.name) + .collect::>(); + if let Some(hir_id) = self.tcx.opt_local_def_id_to_hir_id(generic_param_scope) { + // consider late-bound lifetimes ... + used_names.extend(self.tcx.late_bound_vars(hir_id).into_iter().filter_map(|p| { + match p { + ty::BoundVariableKind::Region(lt) => lt.get_name(), + _ => None, + } + })) + } + (b'a'..=b'z') + .map(|c| format!("'{}", c as char)) + .find(|candidate| !used_names.iter().any(|e| e.as_str() == candidate)) + .unwrap_or("'lt".to_string()) + }; + + let mut visitor = LifetimeVisitor { + tcx: self.tcx, + needle: hir::LifetimeName::Param(lifetime_def_id), + add_lt_suggs: &mut add_lt_suggs, + new_lt: &new_lt, + }; + match self.tcx.hir().expect_owner(lifetime_scope) { + hir::OwnerNode::Item(i) => visitor.visit_item(i), + hir::OwnerNode::ForeignItem(i) => visitor.visit_foreign_item(i), + hir::OwnerNode::ImplItem(i) => visitor.visit_impl_item(i), + hir::OwnerNode::TraitItem(i) => visitor.visit_trait_item(i), + hir::OwnerNode::Crate(_) => bug!("OwnerNode::Crate doesn not have generics"), + } + + let ast_generics = self.tcx.hir().get_generics(lifetime_scope).unwrap(); + let sugg = ast_generics + .span_for_lifetime_suggestion() + .map(|span| (span, format!("{new_lt}, "))) + .unwrap_or_else(|| (ast_generics.span, format!("<{new_lt}>"))); + add_lt_suggs.push(sugg); + + add_lt_suggs.sort(); + add_lt_suggs.dedup(); + Some((new_lt, add_lt_suggs)) + } + + #[instrument(level = "trace", skip(self))] pub fn construct_generic_bound_failure( &self, generic_param_scope: LocalDefId, @@ -2331,111 +2449,30 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { // suggest adding an explicit lifetime bound to it. let generics = self.tcx.generics_of(generic_param_scope); // type_param_span is (span, has_bounds) - let mut is_synthetic = false; - let mut ast_generics = None; let type_param_span = match bound_kind { - GenericKind::Param(ref param) => { + GenericKind::Param(ref param) if !(generics.has_self && param.index == 0) => { // Account for the case where `param` corresponds to `Self`, // which doesn't have the expected type argument. - if !(generics.has_self && param.index == 0) { - let type_param = generics.type_param(param, self.tcx); - is_synthetic = type_param.kind.is_synthetic(); - type_param.def_id.as_local().map(|def_id| { - // Get the `hir::Param` to verify whether it already has any bounds. - // We do this to avoid suggesting code that ends up as `T: 'a'b`, - // instead we suggest `T: 'a + 'b` in that case. - let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id); - ast_generics = self.tcx.hir().get_generics(hir_id.owner.def_id); - let bounds = - ast_generics.and_then(|g| g.bounds_span_for_suggestions(def_id)); - // `sp` only covers `T`, change it so that it covers - // `T:` when appropriate - if let Some(span) = bounds { - (span, true) - } else { - let sp = self.tcx.def_span(def_id); - (sp.shrink_to_hi(), false) - } - }) + let type_param = generics.type_param(param, self.tcx); + let def_id = type_param.def_id.expect_local(); + // Get the `hir::Param` to verify whether it already has any bounds. + // We do this to avoid suggesting code that ends up as `T: 'a'b`, + // instead we suggest `T: 'a + 'b` in that case. + let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id); + let ast_generics = self.tcx.hir().get_generics(hir_id.owner.def_id); + let bounds = ast_generics.and_then(|g| g.bounds_span_for_suggestions(def_id)); + // `sp` only covers `T`, change it so that it covers + // `T:` when appropriate + if let Some(span) = bounds { + Some((span, true)) } else { - None + let sp = self.tcx.def_span(def_id); + Some((sp.shrink_to_hi(), false)) } } _ => None, }; - let new_lt = { - let mut possible = (b'a'..=b'z').map(|c| format!("'{}", c as char)); - let lts_names = - iter::successors(Some(generics), |g| g.parent.map(|p| self.tcx.generics_of(p))) - .flat_map(|g| &g.params) - .filter(|p| matches!(p.kind, ty::GenericParamDefKind::Lifetime)) - .map(|p| p.name.as_str()) - .collect::>(); - possible - .find(|candidate| !lts_names.contains(&&candidate[..])) - .unwrap_or("'lt".to_string()) - }; - - let mut add_lt_suggs: Vec> = vec![]; - if is_synthetic { - if let Some(ast_generics) = ast_generics { - let named_lifetime_param_exist = ast_generics.params.iter().any(|p| { - matches!( - p.kind, - hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Explicit } - ) - }); - if named_lifetime_param_exist && let [param, ..] = ast_generics.params - { - add_lt_suggs.push(Some(( - self.tcx.def_span(param.def_id).shrink_to_lo(), - format!("{new_lt}, "), - ))); - } else { - add_lt_suggs - .push(Some((ast_generics.span.shrink_to_hi(), format!("<{new_lt}>")))); - } - } - } else { - if let [param, ..] = &generics.params[..] && let Some(def_id) = param.def_id.as_local() - { - add_lt_suggs - .push(Some((self.tcx.def_span(def_id).shrink_to_lo(), format!("{new_lt}, ")))); - } - } - - if let Some(ast_generics) = ast_generics { - for p in ast_generics.params { - if p.is_elided_lifetime() { - if self - .tcx - .sess - .source_map() - .span_to_prev_source(p.span.shrink_to_hi()) - .ok() - .is_some_and(|s| *s.as_bytes().last().unwrap() == b'&') - { - add_lt_suggs - .push(Some( - ( - p.span.shrink_to_hi(), - if let Ok(snip) = self.tcx.sess.source_map().span_to_next_source(p.span) - && snip.starts_with(' ') - { - new_lt.to_string() - } else { - format!("{new_lt} ") - } - ) - )); - } else { - add_lt_suggs.push(Some((p.span.shrink_to_hi(), format!("<{new_lt}>")))); - } - } - } - } - let labeled_user_string = match bound_kind { GenericKind::Param(ref p) => format!("the parameter type `{p}`"), GenericKind::Alias(ref p) => match p.kind(self.tcx) { @@ -2466,14 +2503,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { type_param_span: Option<(Span, bool)>, bound_kind: GenericKind<'tcx>, sub: S, - add_lt_suggs: Vec>, + add_lt_suggs: Vec<(Span, String)>, ) { let msg = "consider adding an explicit lifetime bound"; if let Some((sp, has_lifetimes)) = type_param_span { let suggestion = if has_lifetimes { format!(" + {sub}") } else { format!(": {sub}") }; let mut suggestions = vec![(sp, suggestion)]; - for add_lt_sugg in add_lt_suggs.into_iter().flatten() { + for add_lt_sugg in add_lt_suggs.into_iter() { suggestions.push(add_lt_sugg); } err.multipart_suggestion_verbose( @@ -2487,86 +2524,24 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } } - let new_binding_suggestion = - |err: &mut Diagnostic, type_param_span: Option<(Span, bool)>| { - let msg = "consider introducing an explicit lifetime bound"; - if let Some((sp, has_lifetimes)) = type_param_span { - let suggestion = - if has_lifetimes { format!(" + {new_lt}") } else { format!(": {new_lt}") }; - let mut sugg = - vec![(sp, suggestion), (span.shrink_to_hi(), format!(" + {new_lt}"))]; - for lt in add_lt_suggs.clone().into_iter().flatten() { - sugg.push(lt); - sugg.rotate_right(1); - } - // `MaybeIncorrect` due to issue #41966. - err.multipart_suggestion(msg, sugg, Applicability::MaybeIncorrect); - } - }; - - #[derive(Debug)] - enum SubOrigin<'hir> { - GAT(&'hir hir::Generics<'hir>), - Impl, - Trait, - Fn, - Unknown, - } - let sub_origin = 'origin: { - match *sub { - ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, .. }) => { - let node = self.tcx.hir().get_if_local(def_id).unwrap(); - match node { - Node::GenericParam(param) => { - for h in self.tcx.hir().parent_iter(param.hir_id) { - break 'origin match h.1 { - Node::ImplItem(hir::ImplItem { - kind: hir::ImplItemKind::Type(..), - generics, - .. - }) - | Node::TraitItem(hir::TraitItem { - kind: hir::TraitItemKind::Type(..), - generics, - .. - }) => SubOrigin::GAT(generics), - Node::ImplItem(hir::ImplItem { - kind: hir::ImplItemKind::Fn(..), - .. - }) - | Node::TraitItem(hir::TraitItem { - kind: hir::TraitItemKind::Fn(..), - .. - }) - | Node::Item(hir::Item { - kind: hir::ItemKind::Fn(..), .. - }) => SubOrigin::Fn, - Node::Item(hir::Item { - kind: hir::ItemKind::Trait(..), - .. - }) => SubOrigin::Trait, - Node::Item(hir::Item { - kind: hir::ItemKind::Impl(..), .. - }) => SubOrigin::Impl, - _ => continue, - }; - } - } - _ => {} - } - } - _ => {} + let non_opaque_parent = |mut def_id| loop { + def_id = self.tcx.parent(def_id); + let def_kind = self.tcx.def_kind(def_id); + if def_kind != DefKind::OpaqueTy { + break (def_id, def_kind); } - SubOrigin::Unknown }; - debug!(?sub_origin); - let mut err = match (*sub, sub_origin) { + let mut err = match sub.kind() { // In the case of GATs, we have to be careful. If we a type parameter `T` on an impl, // but a lifetime `'a` on an associated type, then we might need to suggest adding // `where T: 'a`. Importantly, this is on the GAT span, not on the `T` declaration. - (ty::ReEarlyBound(ty::EarlyBoundRegion { name: _, .. }), SubOrigin::GAT(generics)) => { + ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, .. }) + if matches!(non_opaque_parent(def_id), (_, DefKind::AssocTy)) => + { // Does the required lifetime have a nice name we can print? + let lifetime_scope = non_opaque_parent(def_id).0.expect_local(); + let generics = self.tcx.hir().get_generics(lifetime_scope).unwrap(); let mut err = struct_span_err!( self.tcx.sess, span, @@ -2584,11 +2559,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { ); err } - ( - ty::ReEarlyBound(ty::EarlyBoundRegion { name, .. }) - | ty::ReFree(ty::FreeRegion { bound_region: ty::BrNamed(_, name), .. }), - _, - ) if name != kw::UnderscoreLifetime => { + ty::ReEarlyBound(ty::EarlyBoundRegion { name, .. }) + | ty::ReFree(ty::FreeRegion { bound_region: ty::BrNamed(_, name), .. }) + if !matches!(name, kw::UnderscoreLifetime | kw::Empty) => + { // Does the required lifetime have a nice name we can print? let mut err = struct_span_err!( self.tcx.sess, @@ -2605,7 +2579,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { err } - (ty::ReStatic, _) => { + ty::ReStatic => { // Does the required lifetime have a nice name we can print? let mut err = struct_span_err!( self.tcx.sess, @@ -2635,27 +2609,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { "...", None, ); - if let Some(infer::RelateParamBound(_, t, _)) = origin { - let t = self.resolve_vars_if_possible(t); - match t.kind() { - // We've got: - // fn get_later(g: G, dest: &mut T) -> impl FnOnce() + '_ - // suggest: - // fn get_later<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a - ty::Closure(..) | ty::Alias(ty::Opaque, ..) => { - new_binding_suggestion(&mut err, type_param_span); - } - _ => { - binding_suggestion( - &mut err, - type_param_span, - bound_kind, - new_lt, - add_lt_suggs, - ); - } - } - } + let (new_lt, add_lt_suggs) = self + .name_region(generic_param_scope, sub) + .unwrap_or_else(|| (format!("{sub}"), vec![])); + binding_suggestion(&mut err, type_param_span, bound_kind, new_lt, add_lt_suggs); err } }; diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index 0da8fe9cca72f..df8c587fee5b4 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs @@ -144,6 +144,7 @@ pub fn provide(providers: &mut Providers) { }; providers.opt_local_def_id_to_hir_id = |tcx, id| { let owner = tcx.hir_crate(()).owners[id].map(|_| ()); + debug!("local_def_id_to {owner:?}"); Some(match owner { MaybeOwner::Owner(_) => HirId::make_owner(id), MaybeOwner::Phantom => bug!("No HirId for {:?}", id), diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 90d847804f0e5..a484b4af13bec 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2096,7 +2096,11 @@ impl<'tcx> TyCtxt<'tcx> { } pub fn local_def_id_to_hir_id(self, local_def_id: LocalDefId) -> HirId { - self.opt_local_def_id_to_hir_id(local_def_id).unwrap() + debug!("local_def_id_toj {local_def_id:?}"); + debug!("locaaa {:?}", self.hir_crate(()).owners[local_def_id]); + let hh = self.opt_local_def_id_to_hir_id(local_def_id); + debug!("local_def_idi {hh:?}"); + hh.unwrap() } pub fn next_trait_solver_globally(self) -> bool { diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 486d60eab2101..d88e9c8f4d631 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -728,7 +728,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, // Elided lifetime in reference: we resolve as if there was some lifetime `'_` with // NodeId `ty.id`. // This span will be used in case of elision failure. - let span = self.r.tcx.sess.source_map().start_point(ty.span); + let span = self.r.tcx.sess.source_map().start_point(ty.span).shrink_to_hi(); self.resolve_elided_lifetime(ty.id, span); visit::walk_ty(self, ty); } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 2bb58f94adcc5..92b814ae24997 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1809,8 +1809,7 @@ impl Hash for Ident { impl fmt::Debug for Ident { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(self, f)?; - fmt::Debug::fmt(&self.span.ctxt(), f) + write!(f, "{} at {:?}", self, self.span) } } diff --git a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr index 6f206f2b89c79..e24acdce003f4 100644 --- a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr +++ b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/issue-109071.rs:8:17 + --> $DIR/issue-109071.rs:8:18 | LL | type Item = &[T]; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0107]: missing generics for struct `Windows` --> $DIR/issue-109071.rs:7:9 diff --git a/tests/ui/associated-inherent-types/issue-109071.with_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.with_gate.stderr index a91bb7a5162e3..f306bb130d81b 100644 --- a/tests/ui/associated-inherent-types/issue-109071.with_gate.stderr +++ b/tests/ui/associated-inherent-types/issue-109071.with_gate.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/issue-109071.rs:8:17 + --> $DIR/issue-109071.rs:8:18 | LL | type Item = &[T]; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0107]: missing generics for struct `Windows` --> $DIR/issue-109071.rs:7:9 diff --git a/tests/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr b/tests/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr index 4de4afb6e9246..60986f85e1752 100644 --- a/tests/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr +++ b/tests/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/bound-lifetime-in-binding-only.rs:52:23 + --> $DIR/bound-lifetime-in-binding-only.rs:52:24 | LL | fn elision &i32>() { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime diff --git a/tests/ui/associated-types/bound-lifetime-in-return-only.elision.stderr b/tests/ui/associated-types/bound-lifetime-in-return-only.elision.stderr index 7753d186504f8..ffb5df67cc193 100644 --- a/tests/ui/associated-types/bound-lifetime-in-return-only.elision.stderr +++ b/tests/ui/associated-types/bound-lifetime-in-return-only.elision.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/bound-lifetime-in-return-only.rs:34:23 + --> $DIR/bound-lifetime-in-return-only.rs:34:24 | LL | fn elision(_: fn() -> &i32) { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime diff --git a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr index 5c8d64fc6cb4c..8c1e2578a1a05 100644 --- a/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr +++ b/tests/ui/async-await/in-trait/async-generics-and-bounds.stderr @@ -5,15 +5,20 @@ LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^ | note: the parameter type `U` must be valid for the anonymous lifetime as defined here... - --> $DIR/async-generics-and-bounds.rs:12:18 + --> $DIR/async-generics-and-bounds.rs:12:19 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^ + | ^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics-and-bounds.rs:12:28 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^ +help: consider adding an explicit lifetime bound... + | +LL ~ trait MyTrait { +LL ~ async fn foo<'a>(&'a'a self) -> &'a (T, U) where T: Debug + Sized, U: Hash; + | error[E0311]: the parameter type `T` may not live long enough --> $DIR/async-generics-and-bounds.rs:12:28 @@ -22,15 +27,20 @@ LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^ | note: the parameter type `T` must be valid for the anonymous lifetime as defined here... - --> $DIR/async-generics-and-bounds.rs:12:18 + --> $DIR/async-generics-and-bounds.rs:12:19 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; - | ^ + | ^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics-and-bounds.rs:12:28 | LL | async fn foo(&self) -> &(T, U) where T: Debug + Sized, U: Hash; | ^^^^^^^ +help: consider adding an explicit lifetime bound... + | +LL ~ trait MyTrait { +LL ~ async fn foo<'a>(&'a'a self) -> &'a (T, U) where T: Debug + Sized, U: Hash; + | error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/in-trait/async-generics.stderr b/tests/ui/async-await/in-trait/async-generics.stderr index 6ae73d9e3a601..25bbf8934a144 100644 --- a/tests/ui/async-await/in-trait/async-generics.stderr +++ b/tests/ui/async-await/in-trait/async-generics.stderr @@ -5,15 +5,20 @@ LL | async fn foo(&self) -> &(T, U); | ^^^^^^^ | note: the parameter type `U` must be valid for the anonymous lifetime as defined here... - --> $DIR/async-generics.rs:9:18 + --> $DIR/async-generics.rs:9:19 | LL | async fn foo(&self) -> &(T, U); - | ^ + | ^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics.rs:9:28 | LL | async fn foo(&self) -> &(T, U); | ^^^^^^^ +help: consider adding an explicit lifetime bound... + | +LL ~ trait MyTrait { +LL ~ async fn foo<'a>(&'a'a self) -> &'a (T, U); + | error[E0311]: the parameter type `T` may not live long enough --> $DIR/async-generics.rs:9:28 @@ -22,15 +27,20 @@ LL | async fn foo(&self) -> &(T, U); | ^^^^^^^ | note: the parameter type `T` must be valid for the anonymous lifetime as defined here... - --> $DIR/async-generics.rs:9:18 + --> $DIR/async-generics.rs:9:19 | LL | async fn foo(&self) -> &(T, U); - | ^ + | ^ note: ...so that the reference type `&(T, U)` does not outlive the data it points at --> $DIR/async-generics.rs:9:28 | LL | async fn foo(&self) -> &(T, U); | ^^^^^^^ +help: consider adding an explicit lifetime bound... + | +LL ~ trait MyTrait { +LL ~ async fn foo<'a>(&'a'a self) -> &'a (T, U); + | error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr index 628ba1a481893..d81bdcb31bd1d 100644 --- a/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr +++ b/tests/ui/async-await/issue-74072-lifetime-name-annotations.stderr @@ -2,7 +2,7 @@ error[E0506]: cannot assign to `*x` because it is borrowed --> $DIR/issue-74072-lifetime-name-annotations.rs:9:5 | LL | pub async fn async_fn(x: &mut i32) -> &i32 { - | - let's call the lifetime of this reference `'1` + | - let's call the lifetime of this reference `'1` LL | let y = &*x; | --- `*x` is borrowed here LL | *x += 1; diff --git a/tests/ui/async-await/issue-75785-confusing-named-region.stderr b/tests/ui/async-await/issue-75785-confusing-named-region.stderr index b69033a0eda0b..b897f2d46ae89 100644 --- a/tests/ui/async-await/issue-75785-confusing-named-region.stderr +++ b/tests/ui/async-await/issue-75785-confusing-named-region.stderr @@ -2,7 +2,7 @@ error[E0506]: cannot assign to `*x` because it is borrowed --> $DIR/issue-75785-confusing-named-region.rs:9:5 | LL | pub async fn async_fn(x: &mut i32) -> (&i32, &i32) { - | - let's call the lifetime of this reference `'1` + | - let's call the lifetime of this reference `'1` LL | let y = &*x; | --- `*x` is borrowed here LL | *x += 1; diff --git a/tests/ui/async-await/issue-76547.stderr b/tests/ui/async-await/issue-76547.stderr index 4d96cce824b91..52fe1da24b298 100644 --- a/tests/ui/async-await/issue-76547.stderr +++ b/tests/ui/async-await/issue-76547.stderr @@ -2,31 +2,31 @@ error: lifetime may not live long enough --> $DIR/issue-76547.rs:20:13 | LL | async fn fut(bufs: &mut [&mut [u8]]) { - | - - let's call the lifetime of this reference `'2` - | | - | let's call the lifetime of this reference `'1` + | - - let's call the lifetime of this reference `'2` + | | + | let's call the lifetime of this reference `'1` LL | ListFut(bufs).await | ^^^^ this usage requires that `'1` must outlive `'2` | help: consider introducing a named lifetime parameter | -LL | async fn fut<'a>(bufs: &'a mut [&'a mut [u8]]) { - | ++++ ++ ++ +LL | async fn fut<'a>(bufs: 'amut ['amut [u8]]) { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/issue-76547.rs:34:14 | LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 { - | - - let's call the lifetime of this reference `'2` - | | - | let's call the lifetime of this reference `'1` + | - - let's call the lifetime of this reference `'2` + | | + | let's call the lifetime of this reference `'1` LL | ListFut2(bufs).await | ^^^^ this usage requires that `'1` must outlive `'2` | help: consider introducing a named lifetime parameter | -LL | async fn fut2<'a>(bufs: &'a mut [&'a mut [u8]]) -> i32 { - | ++++ ++ ++ +LL | async fn fut2<'a>(bufs: 'amut ['amut [u8]]) -> i32 { + | ++++ ~~ ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/issues/issue-62097.stderr b/tests/ui/async-await/issues/issue-62097.stderr index 21a61548d01e3..da4c767df87fd 100644 --- a/tests/ui/async-await/issues/issue-62097.stderr +++ b/tests/ui/async-await/issues/issue-62097.stderr @@ -21,9 +21,9 @@ error[E0521]: borrowed data escapes outside of method | LL | pub async fn run_dummy_fn(&self) { | ----- - | | + | || + | |let's call the lifetime of this reference `'1` | `self` is a reference that is only valid in the method body - | let's call the lifetime of this reference `'1` LL | foo(|| self.bar()).await; | ^^^^^^^^^^^^^^^^^^ | | diff --git a/tests/ui/async-await/issues/issue-63388-2.stderr b/tests/ui/async-await/issues/issue-63388-2.stderr index e515f227c7ef6..02507aebdb106 100644 --- a/tests/ui/async-await/issues/issue-63388-2.stderr +++ b/tests/ui/async-await/issues/issue-63388-2.stderr @@ -1,10 +1,10 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-63388-2.rs:12:10 + --> $DIR/issue-63388-2.rs:12:11 | LL | foo: &dyn Foo, bar: &'a dyn Foo | -------- ----------- LL | ) -> &dyn Foo - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar` help: consider using the `'a` lifetime diff --git a/tests/ui/async-await/issues/issue-72312.stderr b/tests/ui/async-await/issues/issue-72312.stderr index 679272858bdee..d7c1e6214b7eb 100644 --- a/tests/ui/async-await/issues/issue-72312.stderr +++ b/tests/ui/async-await/issues/issue-72312.stderr @@ -3,9 +3,9 @@ error[E0521]: borrowed data escapes outside of method | LL | pub async fn start(&self) { | ----- - | | + | || + | |let's call the lifetime of this reference `'1` | `self` is a reference that is only valid in the method body - | let's call the lifetime of this reference `'1` ... LL | / require_static(async move { LL | | diff --git a/tests/ui/borrowck/issue-103624.stderr b/tests/ui/borrowck/issue-103624.stderr index 7a281e8aa30ca..f3221f4ce61ea 100644 --- a/tests/ui/borrowck/issue-103624.stderr +++ b/tests/ui/borrowck/issue-103624.stderr @@ -15,9 +15,9 @@ error[E0521]: borrowed data escapes outside of method | LL | async fn foo(&self) { | ----- - | | + | || + | |let's call the lifetime of this reference `'1` | `self` is a reference that is only valid in the method body - | let's call the lifetime of this reference `'1` LL | let bar = self.b.bar().await; LL | / spawn_blocking(move || { LL | | diff --git a/tests/ui/c-variadic/variadic-ffi-6.stderr b/tests/ui/c-variadic/variadic-ffi-6.stderr index 4c7792d965019..60b2ddf8d9e7c 100644 --- a/tests/ui/c-variadic/variadic-ffi-6.stderr +++ b/tests/ui/c-variadic/variadic-ffi-6.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/variadic-ffi-6.rs:7:6 + --> $DIR/variadic-ffi-6.rs:7:7 | LL | ) -> &usize { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime diff --git a/tests/ui/closures/binder/implicit-stuff.stderr b/tests/ui/closures/binder/implicit-stuff.stderr index 779a08a44e5a8..52b1fd381eee1 100644 --- a/tests/ui/closures/binder/implicit-stuff.stderr +++ b/tests/ui/closures/binder/implicit-stuff.stderr @@ -1,20 +1,20 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/implicit-stuff.rs:20:23 + --> $DIR/implicit-stuff.rs:20:24 | LL | let _ = for<> |_: &()| -> () {}; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/implicit-stuff.rs:21:23 + --> $DIR/implicit-stuff.rs:21:24 | LL | let _ = for<> |x: &()| -> &() { x }; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/implicit-stuff.rs:21:31 + --> $DIR/implicit-stuff.rs:21:32 | LL | let _ = for<> |x: &()| -> &() { x }; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `'_` cannot be used here --> $DIR/implicit-stuff.rs:23:24 @@ -29,16 +29,16 @@ LL | let _ = for<> |x: &'_ ()| -> &'_ () { x }; | ^^ `'_` is a reserved lifetime name error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/implicit-stuff.rs:25:25 + --> $DIR/implicit-stuff.rs:25:26 | LL | let _ = for<'a> |x: &()| -> &'a () { x }; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/implicit-stuff.rs:26:36 + --> $DIR/implicit-stuff.rs:26:37 | LL | let _ = for<'a> |x: &'a ()| -> &() { x }; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error: implicit types in closure signatures are forbidden when `for<...>` is present --> $DIR/implicit-stuff.rs:5:22 diff --git a/tests/ui/const-generics/const-param-elided-lifetime.full.stderr b/tests/ui/const-generics/const-param-elided-lifetime.full.stderr index d6753a74f8574..f3d9133e6901d 100644 --- a/tests/ui/const-generics/const-param-elided-lifetime.full.stderr +++ b/tests/ui/const-generics/const-param-elided-lifetime.full.stderr @@ -1,32 +1,32 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:9:19 + --> $DIR/const-param-elided-lifetime.rs:9:20 | LL | struct A; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:14:15 + --> $DIR/const-param-elided-lifetime.rs:14:16 | LL | impl A { - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:17:21 + --> $DIR/const-param-elided-lifetime.rs:17:22 | LL | fn foo(&self) {} - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:22:15 + --> $DIR/const-param-elided-lifetime.rs:22:16 | LL | impl B for A {} - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:26:17 + --> $DIR/const-param-elided-lifetime.rs:26:18 | LL | fn bar() {} - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error: aborting due to 5 previous errors diff --git a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr index 656bc29466f23..b94ee90342907 100644 --- a/tests/ui/const-generics/const-param-elided-lifetime.min.stderr +++ b/tests/ui/const-generics/const-param-elided-lifetime.min.stderr @@ -1,32 +1,32 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:9:19 + --> $DIR/const-param-elided-lifetime.rs:9:20 | LL | struct A; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:14:15 + --> $DIR/const-param-elided-lifetime.rs:14:16 | LL | impl A { - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:17:21 + --> $DIR/const-param-elided-lifetime.rs:17:22 | LL | fn foo(&self) {} - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:22:15 + --> $DIR/const-param-elided-lifetime.rs:22:16 | LL | impl B for A {} - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:26:17 + --> $DIR/const-param-elided-lifetime.rs:26:18 | LL | fn bar() {} - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error: `&u8` is forbidden as the type of a const generic parameter --> $DIR/const-param-elided-lifetime.rs:9:19 diff --git a/tests/ui/error-codes/E0106.stderr b/tests/ui/error-codes/E0106.stderr index d11a24f776855..2d3c76914d086 100644 --- a/tests/ui/error-codes/E0106.stderr +++ b/tests/ui/error-codes/E0106.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/E0106.rs:2:8 + --> $DIR/E0106.rs:2:9 | LL | x: &bool, - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | @@ -11,10 +11,10 @@ LL ~ x: &'a bool, | error[E0106]: missing lifetime specifier - --> $DIR/E0106.rs:7:7 + --> $DIR/E0106.rs:7:8 | LL | B(&bool), - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | @@ -24,10 +24,10 @@ LL ~ B(&'a bool), | error[E0106]: missing lifetime specifier - --> $DIR/E0106.rs:10:14 + --> $DIR/E0106.rs:10:15 | LL | type MyStr = &str; - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | diff --git a/tests/ui/error-codes/E0308-2.stderr b/tests/ui/error-codes/E0308-2.stderr index 3a8a81a73a6ce..e604d48d791d6 100644 --- a/tests/ui/error-codes/E0308-2.stderr +++ b/tests/ui/error-codes/E0308-2.stderr @@ -7,10 +7,10 @@ LL | impl Eq for &dyn DynEq {} = note: expected trait `<&dyn DynEq as PartialEq>` found trait `<&(dyn DynEq + 'static) as PartialEq>` note: the anonymous lifetime as defined here... - --> $DIR/E0308-2.rs:9:13 + --> $DIR/E0308-2.rs:9:14 | LL | impl Eq for &dyn DynEq {} - | ^ + | ^ = note: ...does not necessarily outlive the static lifetime error: aborting due to previous error diff --git a/tests/ui/error-codes/E0311.fixed b/tests/ui/error-codes/E0311.fixed index 4410a4d707af4..09ceecd0666cd 100644 --- a/tests/ui/error-codes/E0311.fixed +++ b/tests/ui/error-codes/E0311.fixed @@ -2,7 +2,7 @@ #![allow(warnings)] -fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() { +fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () { with_restriction::(x) //~ ERROR E0311 } diff --git a/tests/ui/error-codes/E0311.stderr b/tests/ui/error-codes/E0311.stderr index b0e6dd1e2727c..de13a6148f3ae 100644 --- a/tests/ui/error-codes/E0311.stderr +++ b/tests/ui/error-codes/E0311.stderr @@ -16,8 +16,8 @@ LL | with_restriction::(x) | ^^^^^^^^^^^^^^^^^^^^^ help: consider adding an explicit lifetime bound... | -LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() { - | +++ ++++ ++ +LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () { + | +++ ++++ ++ ++ error: aborting due to previous error diff --git a/tests/ui/error-codes/E0637.stderr b/tests/ui/error-codes/E0637.stderr index d9db89ddb0c97..473e5903ebd68 100644 --- a/tests/ui/error-codes/E0637.stderr +++ b/tests/ui/error-codes/E0637.stderr @@ -17,10 +17,10 @@ LL | fn underscore_lifetime<'a, '_>(str1: &'a str, str2: &'a str) -> &'a str { | +++ ~~ ~~ ~~ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/E0637.rs:13:13 + --> $DIR/E0637.rs:13:14 | LL | T: Into<&u32>, - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | diff --git a/tests/ui/foreign-fn-return-lifetime.stderr b/tests/ui/foreign-fn-return-lifetime.stderr index df1a23a19edd5..7d6fee6bfb848 100644 --- a/tests/ui/foreign-fn-return-lifetime.stderr +++ b/tests/ui/foreign-fn-return-lifetime.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/foreign-fn-return-lifetime.rs:5:19 + --> $DIR/foreign-fn-return-lifetime.rs:5:20 | LL | pub fn f() -> &u8; - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime diff --git a/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr b/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr index cb2b9f32bfe72..df0fd8f4359d1 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-generic-type-arg.stderr @@ -8,10 +8,10 @@ LL | type F = &[u8]; | ^^ already used error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/gat-trait-path-generic-type-arg.rs:9:18 + --> $DIR/gat-trait-path-generic-type-arg.rs:9:19 | LL | type F = &[u8]; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0207]: the type parameter `T1` is not constrained by the impl trait, self type, or predicates --> $DIR/gat-trait-path-generic-type-arg.rs:7:10 diff --git a/tests/ui/generic-const-items/elided-lifetimes.stderr b/tests/ui/generic-const-items/elided-lifetimes.stderr index 8cd3f9ee7a918..7fb8d4f6c5b8a 100644 --- a/tests/ui/generic-const-items/elided-lifetimes.stderr +++ b/tests/ui/generic-const-items/elided-lifetimes.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/elided-lifetimes.rs:8:5 + --> $DIR/elided-lifetimes.rs:8:6 | LL | &T: Copy; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | @@ -10,10 +10,10 @@ LL | for<'a> &'a T: Copy; | +++++++ ++ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/elided-lifetimes.rs:10:18 + --> $DIR/elided-lifetimes.rs:10:19 | LL | const I: &str = ""; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `'_` cannot be used here --> $DIR/elided-lifetimes.rs:14:18 diff --git a/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr b/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr index bcd1fbc55edcd..648efc38d960d 100644 --- a/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr +++ b/tests/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:5:37 + --> $DIR/issue-65285-incorrect-explicit-lifetime-name-needed.rs:5:38 | LL | fn should_error() where T : Into<&u32> {} - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | diff --git a/tests/ui/impl-header-lifetime-elision/assoc-type.stderr b/tests/ui/impl-header-lifetime-elision/assoc-type.stderr index c4f27e0b80e41..5aab18101b7e8 100644 --- a/tests/ui/impl-header-lifetime-elision/assoc-type.stderr +++ b/tests/ui/impl-header-lifetime-elision/assoc-type.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/assoc-type.rs:11:19 + --> $DIR/assoc-type.rs:11:20 | LL | type Output = &i32; - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here error[E0637]: `'_` cannot be used here --> $DIR/assoc-type.rs:16:20 diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr index 443ffeb55cdee..7bc134760727b 100644 --- a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr +++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr @@ -17,10 +17,10 @@ LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) { | ^^ | note: lifetime declared here - --> $DIR/impl-fn-hrtb-bounds.rs:4:19 + --> $DIR/impl-fn-hrtb-bounds.rs:4:20 | LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) { - | ^ + | ^ error: higher kinded lifetime bounds on nested opaque types are not supported yet --> $DIR/impl-fn-hrtb-bounds.rs:9:52 diff --git a/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr b/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr index cf6e5ef7baceb..fbb0a0e8741bd 100644 --- a/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr +++ b/tests/ui/impl-trait/impl-fn-parsing-ambiguities.stderr @@ -17,10 +17,10 @@ LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ { | ^^ | note: lifetime declared here - --> $DIR/impl-fn-parsing-ambiguities.rs:4:19 + --> $DIR/impl-fn-parsing-ambiguities.rs:4:20 | LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ { - | ^ + | ^ error: aborting due to 3 previous errors diff --git a/tests/ui/issues/issue-13497.stderr b/tests/ui/issues/issue-13497.stderr index 4b1d979da36e3..585b5bda11a71 100644 --- a/tests/ui/issues/issue-13497.stderr +++ b/tests/ui/issues/issue-13497.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-13497.rs:2:5 + --> $DIR/issue-13497.rs:2:6 | LL | &str - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime diff --git a/tests/ui/issues/issue-17905-2.stderr b/tests/ui/issues/issue-17905-2.stderr index 88b5fbec6cf03..7747978786d76 100644 --- a/tests/ui/issues/issue-17905-2.stderr +++ b/tests/ui/issues/issue-17905-2.stderr @@ -12,10 +12,10 @@ note: the anonymous lifetime defined here... LL | fn say(self: &Pair<&str, isize>) { | ^^^^ note: ...does not necessarily outlive the anonymous lifetime as defined here - --> $DIR/issue-17905-2.rs:5:5 + --> $DIR/issue-17905-2.rs:5:6 | LL | &str, - | ^ + | ^ error[E0308]: mismatched `self` parameter type --> $DIR/issue-17905-2.rs:8:18 @@ -26,10 +26,10 @@ LL | fn say(self: &Pair<&str, isize>) { = note: expected struct `Pair<&str, _>` found struct `Pair<&str, _>` note: the anonymous lifetime as defined here... - --> $DIR/issue-17905-2.rs:5:5 + --> $DIR/issue-17905-2.rs:5:6 | LL | &str, - | ^ + | ^ note: ...does not necessarily outlive the anonymous lifetime defined here --> $DIR/issue-17905-2.rs:8:24 | diff --git a/tests/ui/issues/issue-19707.stderr b/tests/ui/issues/issue-19707.stderr index 3e1bb32c19b92..141fb236356fd 100644 --- a/tests/ui/issues/issue-19707.stderr +++ b/tests/ui/issues/issue-19707.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-19707.rs:3:28 + --> $DIR/issue-19707.rs:3:29 | LL | type Foo = fn(&u8, &u8) -> &u8; - | --- --- ^ expected named lifetime parameter + | --- --- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html @@ -16,10 +16,10 @@ LL | type Foo<'a> = fn(&'a u8, &'a u8) -> &'a u8; | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/issue-19707.rs:5:27 + --> $DIR/issue-19707.rs:5:28 | LL | fn bar &u8>(f: &F) {} - | --- --- ^ expected named lifetime parameter + | --- --- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 help: consider making the bound lifetime-generic with a new `'a` lifetime diff --git a/tests/ui/issues/issue-30255.stderr b/tests/ui/issues/issue-30255.stderr index adb721a1cbaf1..2e6037eae918b 100644 --- a/tests/ui/issues/issue-30255.stderr +++ b/tests/ui/issues/issue-30255.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-30255.rs:9:24 + --> $DIR/issue-30255.rs:9:25 | LL | fn f(a: &S, b: i32) -> &i32 { - | -- ^ expected named lifetime parameter + | -- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `a`'s 2 lifetimes it is borrowed from help: consider introducing a named lifetime parameter @@ -11,10 +11,10 @@ LL | fn f<'a>(a: &'a S<'a>, b: i32) -> &'a i32 { | ++++ ++ ++++ ++ error[E0106]: missing lifetime specifier - --> $DIR/issue-30255.rs:14:34 + --> $DIR/issue-30255.rs:14:35 | LL | fn g(a: &S, b: bool, c: &i32) -> &i32 { - | -- ---- ^ expected named lifetime parameter + | -- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c` help: consider introducing a named lifetime parameter @@ -23,10 +23,10 @@ LL | fn g<'a>(a: &'a S<'a>, b: bool, c: &'a i32) -> &'a i32 { | ++++ ++ ++++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/issue-30255.rs:19:44 + --> $DIR/issue-30255.rs:19:45 | LL | fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { - | ----- -- ---- ^ expected named lifetime parameter + | ----- -- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a`, one of `c`'s 2 lifetimes, or `d` help: consider introducing a named lifetime parameter diff --git a/tests/ui/issues/issue-60622.stderr b/tests/ui/issues/issue-60622.stderr index 43da2773940e5..0970d81087537 100644 --- a/tests/ui/issues/issue-60622.stderr +++ b/tests/ui/issues/issue-60622.stderr @@ -2,7 +2,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/issue-60622.rs:10:11 | LL | fn a(&self) {} - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | b.a::<'_, T>(); | ^^ diff --git a/tests/ui/issues/issue-65230.stderr b/tests/ui/issues/issue-65230.stderr index 7ccab88948371..84da0bc5aa34b 100644 --- a/tests/ui/issues/issue-65230.stderr +++ b/tests/ui/issues/issue-65230.stderr @@ -7,10 +7,10 @@ LL | impl T1 for &dyn T2 {} = note: expected trait `<&dyn T2 as T0>` found trait `<&(dyn T2 + 'static) as T0>` note: the anonymous lifetime as defined here... - --> $DIR/issue-65230.rs:8:13 + --> $DIR/issue-65230.rs:8:14 | LL | impl T1 for &dyn T2 {} - | ^ + | ^ = note: ...does not necessarily outlive the static lifetime error: aborting due to previous error diff --git a/tests/ui/issues/issue-69130.stderr b/tests/ui/issues/issue-69130.stderr index e67cc295d43e1..67a70374dd2e2 100644 --- a/tests/ui/issues/issue-69130.stderr +++ b/tests/ui/issues/issue-69130.stderr @@ -5,10 +5,10 @@ LL | M (§& u8)} | ^ error[E0106]: missing lifetime specifier - --> $DIR/issue-69130.rs:4:5 + --> $DIR/issue-69130.rs:4:6 | LL | M (§& u8)} - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | diff --git a/tests/ui/lifetimes/fullwidth-ampersand.stderr b/tests/ui/lifetimes/fullwidth-ampersand.stderr index 4645254f4b70d..2c736b5aed048 100644 --- a/tests/ui/lifetimes/fullwidth-ampersand.stderr +++ b/tests/ui/lifetimes/fullwidth-ampersand.stderr @@ -10,10 +10,10 @@ LL | fn f(_: &&()) -> &() { todo!() } | ~ error[E0106]: missing lifetime specifier - --> $DIR/fullwidth-ampersand.rs:3:18 + --> $DIR/fullwidth-ampersand.rs:3:19 | LL | fn f(_: &&()) -> &() { todo!() } - | ----- ^ expected named lifetime parameter + | ----- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of argument 1's 2 lifetimes it is borrowed from help: consider introducing a named lifetime parameter diff --git a/tests/ui/lifetimes/issue-105227.fixed b/tests/ui/lifetimes/issue-105227.fixed index f6ed9c82e9158..13b505758e838 100644 --- a/tests/ui/lifetimes/issue-105227.fixed +++ b/tests/ui/lifetimes/issue-105227.fixed @@ -2,19 +2,19 @@ // run-rustfix #![allow(warnings)] -fn chars0<'a>(v :(&'a str, &'a str)) -> impl Iterator + 'a { +fn chars0<'a>(v :(&'a str, &'astr)) -> impl Iterator + 'a { //~^ HELP to declare that `impl Iterator` captures `'_`, you can introduce a named lifetime parameter `'a` v.0.chars().chain(v.1.chars()) //~^ ERROR hidden type for `impl Iterator` captures lifetime that does not appear in bounds } -fn chars1<'a>(v0 : &'a str, v1 : &'a str) -> impl Iterator + 'a { +fn chars1<'a>(v0 : &'a str, v1 : &'astr) -> impl Iterator + 'a { //~^ HELP to declare that `impl Iterator` captures `'_`, you can introduce a named lifetime parameter `'a` v0.chars().chain(v1.chars()) //~^ ERROR hidden type for `impl Iterator` captures lifetime that does not appear in bound } -fn chars2<'b>(v0 : &'b str, v1 : &'b str, v2 : &'b str) -> +fn chars2<'b>(v0 : &'bstr, v1 : &'b str, v2 : &'b str) -> //~^ HELP to declare that `impl Iterator` captures `'_`, you can use the named lifetime parameter `'b` (impl Iterator + 'b , &'b str) { diff --git a/tests/ui/lifetimes/issue-105227.stderr b/tests/ui/lifetimes/issue-105227.stderr index b514db461b478..7a23b2b366f12 100644 --- a/tests/ui/lifetimes/issue-105227.stderr +++ b/tests/ui/lifetimes/issue-105227.stderr @@ -11,8 +11,8 @@ LL | v.0.chars().chain(v.1.chars()) | help: to declare that `impl Iterator` captures `'_`, you can introduce a named lifetime parameter `'a` | -LL | fn chars0<'a>(v :(&'a str, &'a str)) -> impl Iterator + 'a { - | ++++ ++ ++ ++++ +LL | fn chars0<'a>(v :(&'a str, &'astr)) -> impl Iterator + 'a { + | ++++ ++ ++ ++++ error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds --> $DIR/issue-105227.rs:13:5 @@ -27,8 +27,8 @@ LL | v0.chars().chain(v1.chars()) | help: to declare that `impl Iterator` captures `'_`, you can introduce a named lifetime parameter `'a` | -LL | fn chars1<'a>(v0 : &'a str, v1 : &'a str) -> impl Iterator + 'a { - | ++++ ++ ++ ++++ +LL | fn chars1<'a>(v0 : &'a str, v1 : &'astr) -> impl Iterator + 'a { + | ++++ ++ ++ ++++ error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds --> $DIR/issue-105227.rs:21:5 @@ -44,7 +44,7 @@ LL | (v0.chars().chain(v1.chars()), v2) | help: to declare that `impl Iterator` captures `'_`, you can use the named lifetime parameter `'b` | -LL ~ fn chars2<'b>(v0 : &'b str, v1 : &'b str, v2 : &'b str) -> +LL ~ fn chars2<'b>(v0 : &'bstr, v1 : &'b str, v2 : &'b str) -> LL | LL ~ (impl Iterator + 'b , &'b str) | diff --git a/tests/ui/lifetimes/issue-26638.stderr b/tests/ui/lifetimes/issue-26638.stderr index 30afcecf827e5..e30e2b5e025dc 100644 --- a/tests/ui/lifetimes/issue-26638.stderr +++ b/tests/ui/lifetimes/issue-26638.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:1:62 + --> $DIR/issue-26638.rs:1:63 | LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } - | ------------------------------------ ^ expected named lifetime parameter + | ------------------------------------ ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from help: consider introducing a named lifetime parameter @@ -11,10 +11,10 @@ LL | fn parse_type<'a>(iter: Box+'static>) -> &'a str | ++++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:5:40 + --> $DIR/issue-26638.rs:5:41 | LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -23,10 +23,10 @@ LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &'static str { iter() } | +++++++ error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:10:22 + --> $DIR/issue-26638.rs:10:23 | LL | fn parse_type_3() -> &str { unimplemented!() } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime diff --git a/tests/ui/lifetimes/issue-90170-elision-mismatch.fixed b/tests/ui/lifetimes/issue-90170-elision-mismatch.fixed index bd85da1a76384..91298deab0b81 100644 --- a/tests/ui/lifetimes/issue-90170-elision-mismatch.fixed +++ b/tests/ui/lifetimes/issue-90170-elision-mismatch.fixed @@ -1,9 +1,9 @@ // run-rustfix -pub fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } //~ ERROR lifetime may not live long enough +pub fn foo<'a>(x: &mut Vec<'au8>, y: 'au8) { x.push(y); } //~ ERROR lifetime may not live long enough -pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } //~ ERROR lifetime may not live long enough +pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: 'au8) { x.push(y); } //~ ERROR lifetime may not live long enough -pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } //~ ERROR lifetime may not live long enough +pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<'au8>, y: 'au8) { x.push(y); } //~ ERROR lifetime may not live long enough fn main() {} diff --git a/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr b/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr index 48fb3fb4a2293..9069d43ca8a8f 100644 --- a/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr +++ b/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr @@ -9,8 +9,8 @@ LL | pub fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); } | help: consider introducing a named lifetime parameter | -LL | pub fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } - | ++++ ++ ++ +LL | pub fn foo<'a>(x: &mut Vec<'au8>, y: 'au8) { x.push(y); } + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/issue-90170-elision-mismatch.rs:5:44 @@ -23,8 +23,8 @@ LL | pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } | help: consider introducing a named lifetime parameter | -LL | pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } - | ++++ ~~ ++ +LL | pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: 'au8) { x.push(y); } + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/issue-90170-elision-mismatch.rs:7:63 @@ -37,8 +37,8 @@ LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&u8>, y: &u8) { x.push(y); } | help: consider introducing a named lifetime parameter | -LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } - | ++ ++ +LL | pub fn foo3<'a>(_other: &'a [u8], x: &mut Vec<'au8>, y: 'au8) { x.push(y); } + | ~~ ~~ error: aborting due to 3 previous errors diff --git a/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr index 5eee953ef189f..0c79ab72fe8b6 100644 --- a/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr +++ b/tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:2:11 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:2:12 | LL | fn f() -> &isize { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -11,10 +11,10 @@ LL | fn f() -> &'static isize { | +++++++ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:7:33 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:7:34 | LL | fn g(_x: &isize, _y: &isize) -> &isize { - | ------ ------ ^ expected named lifetime parameter + | ------ ------ ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_x` or `_y` help: consider introducing a named lifetime parameter @@ -23,10 +23,10 @@ LL | fn g<'a>(_x: &'a isize, _y: &'a isize) -> &'a isize { | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:19 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:20 | LL | fn h(_x: &Foo) -> &isize { - | ---- ^ expected named lifetime parameter + | ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from help: consider introducing a named lifetime parameter @@ -35,10 +35,10 @@ LL | fn h<'a>(_x: &'a Foo<'a>) -> &'a isize { | ++++ ++ ++++ ++ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:20 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:21 | LL | fn i(_x: isize) -> &isize { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -47,10 +47,10 @@ LL | fn i(_x: isize) -> &'static isize { | +++++++ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:34:24 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:34:25 | LL | fn j(_x: StaticStr) -> &isize { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -59,10 +59,10 @@ LL | fn j(_x: StaticStr) -> &'static isize { | +++++++ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:40:49 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:40:50 | LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'a` lifetime @@ -71,10 +71,10 @@ LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &'a isize { | ++ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:45:37 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:45:38 | LL | fn l<'a>(_: &'a str, _: &'a str) -> &str { "" } - | ------- ------- ^ expected named lifetime parameter + | ------- ------- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments help: consider using the `'a` lifetime diff --git a/tests/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr b/tests/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr index bcc3e9510ac97..b9442b9715ff0 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/ex1b-return-no-names-if-else.rs:1:29 + --> $DIR/ex1b-return-no-names-if-else.rs:1:30 | LL | fn foo(x: &i32, y: &i32) -> &i32 { - | ---- ---- ^ expected named lifetime parameter + | ---- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y` help: consider introducing a named lifetime parameter diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr index 5a23f1e0e9d99..0056eedf8c9db 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr @@ -10,8 +10,8 @@ LL | *v = x; | help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(&mut (ref mut v, w): &mut (&'a u8, &u8), x: &'a u8) { - | ++++ ++ ++ +LL | fn foo<'a>(&mut (ref mut v, w): &mut ('au8, &u8), x: 'au8) { + | ++++ ~~ ~~ error: aborting due to previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr index 6ba130308a33a..e70340c127f42 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr @@ -10,8 +10,8 @@ LL | z.push((x,y)); | help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(z: &mut Vec<(&'a u8,&u8)>, (x, y): (&'a u8, &u8)) { - | ++++ ++ ++ +LL | fn foo<'a>(z: &mut Vec<('au8,&u8)>, (x, y): ('au8, &u8)) { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ex3-both-anon-regions-3.rs:2:5 @@ -25,8 +25,8 @@ LL | z.push((x,y)); | help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(z: &mut Vec<(&u8,&'a u8)>, (x, y): (&u8, &'a u8)) { - | ++++ ++ ++ +LL | fn foo<'a>(z: &mut Vec<(&u8,'au8)>, (x, y): (&u8, 'au8)) { + | ++++ ~~ ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr index 9ff5e42d732cc..f2a8328d413e8 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr @@ -10,8 +10,8 @@ LL | x | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn foo<'a>(&'a self, x: &'a i32) -> &i32 { - | ++ ++ +LL | fn foo<'a>('aself, x: 'ai32) -> &i32 { + | ~~ ~~ error: aborting due to previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr index e4c855e11fe28..d31c776e23c66 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr @@ -10,8 +10,8 @@ LL | if true { x } else { self } | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn foo<'a>(&'a self, x: &'a Foo) -> &Foo { - | ++ ++ +LL | fn foo<'a>('aself, x: 'aFoo) -> &Foo { + | ~~ ~~ error: aborting due to previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr index cb629d2e3d3fc..664d62c01e64d 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr @@ -21,8 +21,8 @@ LL | y.push(z); | help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<&'a u8>, z: &'a u8) { - | ++++ ++ ++ +LL | fn foo<'a>(x:fn(&u8, &u8), y: Vec<'au8>, z: 'au8) { + | ++++ ~~ ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr index 9661f1e5144b4..f784ecac45a81 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr @@ -10,8 +10,8 @@ LL | x.push(y); | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { - | ++++ ++ ++ +LL | fn foo<'a>(x: &mut Vec<'au8>, y: 'au8) { + | ++++ ~~ ~~ error: aborting due to previous error diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index 05f9308124b1e..94ea7a1247700 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -21,8 +21,8 @@ LL | y.push(z); | help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(x:Box , y: Vec<&'a u8>, z: &'a u8) { - | ++++ ++ ++ +LL | fn foo<'a>(x:Box , y: Vec<'au8>, z: 'au8) { + | ++++ ~~ ~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr index ec9fac0c288e0..620281ce97c7a 100644 --- a/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr +++ b/tests/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr @@ -10,8 +10,8 @@ LL | x.push(y); | help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { - | ++++ ++ ++ +LL | fn foo<'a>(x: &mut Vec<'au8>, y: 'au8) { + | ++++ ~~ ~~ error: aborting due to previous error diff --git a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed index f977f0bd3a8c2..7c41549043915 100644 --- a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed +++ b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.fixed @@ -2,7 +2,7 @@ #![allow(warnings)] -fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() { +fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () { with_restriction::(x) //~ ERROR the parameter type `T` may not live long enough } diff --git a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr index 2d58d3a02f35e..b64f5147c0bcd 100644 --- a/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr +++ b/tests/ui/lifetimes/suggest-introducing-and-adding-missing-lifetime.stderr @@ -16,8 +16,8 @@ LL | with_restriction::(x) | ^^^^^^^^^^^^^^^^^^^^^ help: consider adding an explicit lifetime bound... | -LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &() { - | +++ ++++ ++ +LL | fn no_restriction<'a, T: 'a>(x: &'a ()) -> &'a () { + | +++ ++++ ++ ++ error: aborting due to previous error diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index 645d8b8d14ad2..88580d34301d9 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -97,10 +97,10 @@ LL | S::late_implicit::<'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:5:31 + --> $DIR/method-call-lifetime-args-fail.rs:5:32 | LL | fn late_implicit(self, _: &u8, _: &u8) {} - | ^ + | ^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:42:24 @@ -109,10 +109,10 @@ LL | S::late_implicit::<'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:5:31 + --> $DIR/method-call-lifetime-args-fail.rs:5:32 | LL | fn late_implicit(self, _: &u8, _: &u8) {} - | ^ + | ^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:44:24 @@ -121,10 +121,10 @@ LL | S::late_implicit::<'static, 'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:5:31 + --> $DIR/method-call-lifetime-args-fail.rs:5:32 | LL | fn late_implicit(self, _: &u8, _: &u8) {} - | ^ + | ^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:47:30 @@ -133,10 +133,10 @@ LL | S::late_implicit_early::<'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:8:41 + --> $DIR/method-call-lifetime-args-fail.rs:8:42 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } - | ^ + | ^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:49:30 @@ -145,10 +145,10 @@ LL | S::late_implicit_early::<'static, 'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:8:41 + --> $DIR/method-call-lifetime-args-fail.rs:8:42 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } - | ^ + | ^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:52:35 @@ -157,10 +157,10 @@ LL | S::late_implicit_self_early::<'static, 'static>(&S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:9:37 + --> $DIR/method-call-lifetime-args-fail.rs:9:38 | LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} } - | ^ + | ^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:54:35 @@ -169,10 +169,10 @@ LL | S::late_implicit_self_early::<'static, 'static, 'static>(&S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:9:37 + --> $DIR/method-call-lifetime-args-fail.rs:9:38 | LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} } - | ^ + | ^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:57:28 diff --git a/tests/ui/methods/method-call-lifetime-args-lint-fail.stderr b/tests/ui/methods/method-call-lifetime-args-lint-fail.stderr index 394c1ac3c09ee..9559fea25f556 100644 --- a/tests/ui/methods/method-call-lifetime-args-lint-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-lint-fail.stderr @@ -79,7 +79,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/method-call-lifetime-args-lint-fail.rs:44:23 | LL | fn late_implicit(self, _: &u8, _: &u8) {} - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | S.late_implicit::<'static>(&0, &0); | ^^^^^^^ @@ -91,7 +91,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/method-call-lifetime-args-lint-fail.rs:47:23 | LL | fn late_implicit(self, _: &u8, _: &u8) {} - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | S.late_implicit::<'static, 'static>(&0, &0); | ^^^^^^^ @@ -103,7 +103,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/method-call-lifetime-args-lint-fail.rs:50:23 | LL | fn late_implicit(self, _: &u8, _: &u8) {} - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | S.late_implicit::<'static, 'static, 'static>(&0, &0); | ^^^^^^^ @@ -115,7 +115,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/method-call-lifetime-args-lint-fail.rs:54:29 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | S.late_implicit_early::<'static>(&0); | ^^^^^^^ @@ -127,7 +127,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/method-call-lifetime-args-lint-fail.rs:57:29 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | S.late_implicit_early::<'static, 'static>(&0); | ^^^^^^^ @@ -139,7 +139,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/method-call-lifetime-args-lint-fail.rs:60:29 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | S.late_implicit_early::<'static, 'static, 'static>(&0); | ^^^^^^^ @@ -163,7 +163,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/method-call-lifetime-args-lint-fail.rs:73:30 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | S::late_implicit_early::<'static>(S, &0); | ^^^^^^^ diff --git a/tests/ui/methods/method-call-lifetime-args-lint.stderr b/tests/ui/methods/method-call-lifetime-args-lint.stderr index b4fc2d71761c7..fc91420b749ad 100644 --- a/tests/ui/methods/method-call-lifetime-args-lint.stderr +++ b/tests/ui/methods/method-call-lifetime-args-lint.stderr @@ -19,7 +19,7 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime param --> $DIR/method-call-lifetime-args-lint.rs:16:23 | LL | fn late_implicit(self, _: &u8, _: &u8) {} - | - the late bound lifetime parameter is introduced here + | - the late bound lifetime parameter is introduced here ... LL | S.late_implicit::<'static>(&0, &0); | ^^^^^^^ diff --git a/tests/ui/methods/method-call-lifetime-args.stderr b/tests/ui/methods/method-call-lifetime-args.stderr index b215d5832171f..2cb4d58388d5f 100644 --- a/tests/ui/methods/method-call-lifetime-args.stderr +++ b/tests/ui/methods/method-call-lifetime-args.stderr @@ -17,10 +17,10 @@ LL | S::late_implicit::<'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args.rs:5:31 + --> $DIR/method-call-lifetime-args.rs:5:32 | LL | fn late_implicit(self, _: &u8, _: &u8) {} - | ^ + | ^ error: aborting due to 2 previous errors diff --git a/tests/ui/proc-macro/item-error.stderr b/tests/ui/proc-macro/item-error.stderr index b544be6e96a27..c69791e0f36c3 100644 --- a/tests/ui/proc-macro/item-error.stderr +++ b/tests/ui/proc-macro/item-error.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/item-error.rs:10:8 + --> $DIR/item-error.rs:10:9 | LL | a: &u64 - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | diff --git a/tests/ui/regions/regions-in-enums-anon.stderr b/tests/ui/regions/regions-in-enums-anon.stderr index ed547aa9c4100..177f7513cd643 100644 --- a/tests/ui/regions/regions-in-enums-anon.stderr +++ b/tests/ui/regions/regions-in-enums-anon.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/regions-in-enums-anon.rs:4:9 + --> $DIR/regions-in-enums-anon.rs:4:10 | LL | Bar(&isize) - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | diff --git a/tests/ui/regions/regions-in-structs-anon.stderr b/tests/ui/regions/regions-in-structs-anon.stderr index 992d25c9fd124..f764a7794f53f 100644 --- a/tests/ui/regions/regions-in-structs-anon.stderr +++ b/tests/ui/regions/regions-in-structs-anon.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/regions-in-structs-anon.rs:4:8 + --> $DIR/regions-in-structs-anon.rs:4:9 | LL | x: &isize - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | diff --git a/tests/ui/rfcs/rfc-1623-static/rfc1623-3.stderr b/tests/ui/rfcs/rfc-1623-static/rfc1623-3.stderr index 77fc3f0412ebf..2bfb1facd9a89 100644 --- a/tests/ui/rfcs/rfc-1623-static/rfc1623-3.stderr +++ b/tests/ui/rfcs/rfc-1623-static/rfc1623-3.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/rfc1623-3.rs:8:42 + --> $DIR/rfc1623-3.rs:8:43 | LL | static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 = - | --- --- ^ expected named lifetime parameter + | --- --- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html @@ -12,10 +12,10 @@ LL | static NON_ELIDABLE_FN: &for<'a> fn(&'a u8, &'a u8) -> &'a u8 = | +++++++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/rfc1623-3.rs:10:39 + --> $DIR/rfc1623-3.rs:10:40 | LL | &(non_elidable as fn(&u8, &u8) -> &u8); - | --- --- ^ expected named lifetime parameter + | --- --- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 help: consider making the type lifetime-generic with a new `'a` lifetime diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr index 0b4c0a7fecec4..06a63be4d1a31 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr @@ -2,37 +2,37 @@ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52 | LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } - | - - ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | | | - | | let's call the lifetime of this reference `'1` - | let's call the lifetime of this reference `'2` + | - - ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | | | + | | let's call the lifetime of this reference `'1` + | let's call the lifetime of this reference `'2` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn a<'a>(self: Pin<&'a Foo>, f: &'a Foo) -> &Foo { f } - | ++++ ++ ++ +LL | async fn a<'a>(self: Pin<'aFoo>, f: 'aFoo) -> &Foo { f } + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:75 | LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } - | - - ^^^^^^^^^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` - | | | - | | let's call the lifetime of this reference `'1` - | let's call the lifetime of this reference `'2` + | - - ^^^^^^^^^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` + | | | + | | let's call the lifetime of this reference `'1` + | let's call the lifetime of this reference `'2` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn c<'a>(self: Pin<&'a Self>, f: &'a Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } - | ++++ ++ ++ +LL | async fn c<'a>(self: Pin<'aSelf>, f: 'aFoo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64 | LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } - | -- - ^^^ method was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` - | | | - | | let's call the lifetime of this reference `'1` + | -- - ^^^ method was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a` + | | | + | | let's call the lifetime of this reference `'1` | lifetime `'a` defined here error: aborting due to 3 previous errors diff --git a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr index 209dae9c1b3e8..9663674d7cef2 100644 --- a/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr +++ b/tests/ui/self/arbitrary_self_types_pin_lifetime_mismatch.stderr @@ -9,8 +9,8 @@ LL | fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn a<'a>(self: Pin<&'a Foo>, f: &'a Foo) -> &Foo { f } - | ++++ ++ ++ +LL | fn a<'a>(self: Pin<'aFoo>, f: 'aFoo) -> &Foo { f } + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:9:69 @@ -23,8 +23,8 @@ LL | fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn c<'a>(self: Pin<&'a Self>, f: &'a Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } - | ++++ ++ ++ +LL | fn c<'a>(self: Pin<'aSelf>, f: 'aFoo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/arbitrary_self_types_pin_lifetime_mismatch.rs:15:58 diff --git a/tests/ui/self/elision/lt-ref-self-async.stderr b/tests/ui/self/elision/lt-ref-self-async.stderr index 29d60ed663523..2948b87e7985e 100644 --- a/tests/ui/self/elision/lt-ref-self-async.stderr +++ b/tests/ui/self/elision/lt-ref-self-async.stderr @@ -2,91 +2,91 @@ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:13:9 | LL | async fn ref_self(&self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn ref_self<'a>('aself, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:20:9 | LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn ref_Self<'a>(self: 'aSelf, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:25:9 | LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_ref_Self<'a>(self: Box<'aSelf>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:30:9 | LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn pin_ref_Self<'a>(self: Pin<'aSelf>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:35:9 | LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_box_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_box_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self-async.rs:40:9 | LL | async fn box_pin_Self(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_pin_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_pin_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/self/elision/lt-ref-self.stderr b/tests/ui/self/elision/lt-ref-self.stderr index 216737a2c7330..10c0b0364d3ba 100644 --- a/tests/ui/self/elision/lt-ref-self.stderr +++ b/tests/ui/self/elision/lt-ref-self.stderr @@ -10,8 +10,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn ref_self<'a>('aself, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self.rs:18:9 @@ -25,8 +25,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn ref_Self<'a>(self: 'aSelf, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self.rs:23:9 @@ -40,8 +40,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_ref_Self<'a>(self: Box<'aSelf>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self.rs:28:9 @@ -55,8 +55,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn pin_ref_Self<'a>(self: Pin<'aSelf>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self.rs:33:9 @@ -70,8 +70,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_box_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_box_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/lt-ref-self.rs:38:9 @@ -85,8 +85,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_pin_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_pin_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/self/elision/nested-item.stderr b/tests/ui/self/elision/nested-item.stderr index 752fd82332c38..fcb10809efa05 100644 --- a/tests/ui/self/elision/nested-item.stderr +++ b/tests/ui/self/elision/nested-item.stderr @@ -15,10 +15,10 @@ LL | fn wrap(self: Wrap<{ fn bar(&self) {} }>) -> &() { = note: associated functions are those in `impl` or `trait` definitions error[E0106]: missing lifetime specifier - --> $DIR/nested-item.rs:5:46 + --> $DIR/nested-item.rs:5:47 | LL | fn wrap(self: Wrap<{ fn bar(&self) {} }>) -> &() { - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime diff --git a/tests/ui/self/elision/ref-mut-self-async.stderr b/tests/ui/self/elision/ref-mut-self-async.stderr index 62543ba533955..d83aeb940c86f 100644 --- a/tests/ui/self/elision/ref-mut-self-async.stderr +++ b/tests/ui/self/elision/ref-mut-self-async.stderr @@ -2,91 +2,91 @@ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:13:9 | LL | async fn ref_self(&mut self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn ref_self<'a>('amut self, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:20:9 | LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn ref_Self<'a>(self: 'amut Self, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:25:9 | LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_ref_Self<'a>(self: Box<'amut Self>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:30:9 | LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn pin_ref_Self<'a>(self: Pin<'amut Self>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:35:9 | LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_box_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_box_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self-async.rs:40:9 | LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_pin_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_pin_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/self/elision/ref-mut-self.stderr b/tests/ui/self/elision/ref-mut-self.stderr index 12b64a3f6dcb5..c192d72b75e67 100644 --- a/tests/ui/self/elision/ref-mut-self.stderr +++ b/tests/ui/self/elision/ref-mut-self.stderr @@ -10,8 +10,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn ref_self<'a>('amut self, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self.rs:18:9 @@ -25,8 +25,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn ref_Self<'a>(self: 'amut Self, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self.rs:23:9 @@ -40,8 +40,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_ref_Self<'a>(self: Box<'amut Self>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self.rs:28:9 @@ -55,8 +55,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn pin_ref_Self<'a>(self: Pin<'amut Self>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self.rs:33:9 @@ -70,8 +70,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_box_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_box_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-self.rs:38:9 @@ -85,8 +85,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_pin_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_pin_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/self/elision/ref-mut-struct-async.stderr b/tests/ui/self/elision/ref-mut-struct-async.stderr index f8fb2e4a1383b..e5699c3443715 100644 --- a/tests/ui/self/elision/ref-mut-struct-async.stderr +++ b/tests/ui/self/elision/ref-mut-struct-async.stderr @@ -2,76 +2,76 @@ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:13:9 | LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn ref_Struct<'a>(self: 'amut Struct, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:18:9 | LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_ref_Struct<'a>(self: Box<'amut Struct>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:23:9 | LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn pin_ref_Struct<'a>(self: Pin<'amut Struct>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:28:9 | LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_box_ref_Struct<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_box_ref_Struct<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-struct-async.rs:33:9 | LL | async fn box_pin_ref_Struct(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_pin_ref_Struct<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_pin_ref_Struct<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: aborting due to 5 previous errors diff --git a/tests/ui/self/elision/ref-mut-struct.stderr b/tests/ui/self/elision/ref-mut-struct.stderr index cde16ce8ba414..0535bd67ead4e 100644 --- a/tests/ui/self/elision/ref-mut-struct.stderr +++ b/tests/ui/self/elision/ref-mut-struct.stderr @@ -10,8 +10,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn ref_Struct<'a>(self: 'amut Struct, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-struct.rs:16:9 @@ -25,8 +25,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_ref_Struct<'a>(self: Box<'amut Struct>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-struct.rs:21:9 @@ -40,8 +40,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn pin_ref_Struct<'a>(self: Pin<'amut Struct>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-struct.rs:26:9 @@ -55,8 +55,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_box_ref_Struct<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_box_ref_Struct<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-mut-struct.rs:31:9 @@ -70,8 +70,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_pin_ref_Struct<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_pin_ref_Struct<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: aborting due to 5 previous errors diff --git a/tests/ui/self/elision/ref-self-async.stderr b/tests/ui/self/elision/ref-self-async.stderr index 010d281b00224..34f31b0224a0c 100644 --- a/tests/ui/self/elision/ref-self-async.stderr +++ b/tests/ui/self/elision/ref-self-async.stderr @@ -2,106 +2,106 @@ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:23:9 | LL | async fn ref_self(&self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn ref_self<'a>('aself, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:30:9 | LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn ref_Self<'a>(self: 'aSelf, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:35:9 | LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_ref_Self<'a>(self: Box<'aSelf>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:40:9 | LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn pin_ref_Self<'a>(self: Pin<'aSelf>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:45:9 | LL | async fn box_box_ref_Self(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_box_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_box_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:50:9 | LL | async fn box_pin_ref_Self(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_pin_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_pin_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self-async.rs:55:9 | LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn wrap_ref_Self_Self<'a>(self: Wrap<&'a Self, Self>, f: &'a u8) -> &u8 { - | ++++ ++ ++ +LL | async fn wrap_ref_Self_Self<'a>(self: Wrap<'aSelf, Self>, f: 'au8) -> &u8 { + | ++++ ~~ ~~ error: aborting due to 7 previous errors diff --git a/tests/ui/self/elision/ref-self.stderr b/tests/ui/self/elision/ref-self.stderr index 35693257c9919..5afd553c534c1 100644 --- a/tests/ui/self/elision/ref-self.stderr +++ b/tests/ui/self/elision/ref-self.stderr @@ -10,8 +10,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn ref_self<'a>('aself, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self.rs:28:9 @@ -25,8 +25,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn ref_Self<'a>(self: 'aSelf, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self.rs:33:9 @@ -40,8 +40,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_ref_Self<'a>(self: Box<'aSelf>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self.rs:38:9 @@ -55,8 +55,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn pin_ref_Self<'a>(self: Pin<'aSelf>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self.rs:43:9 @@ -70,8 +70,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_box_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_box_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self.rs:48:9 @@ -85,8 +85,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_pin_ref_Self<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_pin_ref_Self<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-self.rs:53:9 @@ -100,8 +100,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn wrap_ref_Self_Self<'a>(self: Wrap<&'a Self, Self>, f: &'a u8) -> &u8 { - | ++++ ++ ++ +LL | fn wrap_ref_Self_Self<'a>(self: Wrap<'aSelf, Self>, f: 'au8) -> &u8 { + | ++++ ~~ ~~ error: aborting due to 7 previous errors diff --git a/tests/ui/self/elision/ref-struct-async.stderr b/tests/ui/self/elision/ref-struct-async.stderr index c9376d58f9096..9af1180ff38de 100644 --- a/tests/ui/self/elision/ref-struct-async.stderr +++ b/tests/ui/self/elision/ref-struct-async.stderr @@ -2,76 +2,76 @@ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:13:9 | LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn ref_Struct<'a>(self: 'aStruct, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:18:9 | LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_ref_Struct<'a>(self: Box<'aStruct>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:23:9 | LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn pin_ref_Struct<'a>(self: Pin<'aStruct>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:28:9 | LL | async fn box_box_ref_Struct(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_box_ref_Struct<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_box_ref_Struct<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-struct-async.rs:33:9 | LL | async fn box_pin_Struct(self: Box>, f: &u32) -> &u32 { - | - - let's call the lifetime of this reference `'1` - | | - | let's call the lifetime of this reference `'2` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | f | ^ method was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | help: consider introducing a named lifetime parameter and update trait if needed | -LL | async fn box_pin_Struct<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | async fn box_pin_Struct<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: aborting due to 5 previous errors diff --git a/tests/ui/self/elision/ref-struct.stderr b/tests/ui/self/elision/ref-struct.stderr index a3d3cebeba9c5..c5baee4135a97 100644 --- a/tests/ui/self/elision/ref-struct.stderr +++ b/tests/ui/self/elision/ref-struct.stderr @@ -10,8 +10,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn ref_Struct<'a>(self: 'aStruct, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-struct.rs:16:9 @@ -25,8 +25,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_ref_Struct<'a>(self: Box<'aStruct>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-struct.rs:21:9 @@ -40,8 +40,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn pin_ref_Struct<'a>(self: Pin<'aStruct>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-struct.rs:26:9 @@ -55,8 +55,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_box_ref_Struct<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_box_ref_Struct<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: lifetime may not live long enough --> $DIR/ref-struct.rs:31:9 @@ -70,8 +70,8 @@ LL | f | help: consider introducing a named lifetime parameter and update trait if needed | -LL | fn box_pin_Struct<'a>(self: Box>, f: &'a u32) -> &u32 { - | ++++ ++ ++ +LL | fn box_pin_Struct<'a>(self: Box>, f: 'au32) -> &u32 { + | ++++ ~~ ~~ error: aborting due to 5 previous errors diff --git a/tests/ui/suggestions/fn-missing-lifetime-in-item.stderr b/tests/ui/suggestions/fn-missing-lifetime-in-item.stderr index 6d7c3d73097a9..b6e6571e67c66 100644 --- a/tests/ui/suggestions/fn-missing-lifetime-in-item.stderr +++ b/tests/ui/suggestions/fn-missing-lifetime-in-item.stderr @@ -15,10 +15,10 @@ LL | struct S1<'a, F: Fn(&i32, &i32) -> &'a i32>(F); | +++ error[E0106]: missing lifetime specifier - --> $DIR/fn-missing-lifetime-in-item.rs:2:32 + --> $DIR/fn-missing-lifetime-in-item.rs:2:33 | LL | struct S2 &i32>(F); - | ---- ---- ^ expected named lifetime parameter + | ---- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 help: consider making the bound lifetime-generic with a new `'a` lifetime diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 50806a6725500..0494f71b9ad94 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime-gated.rs:9:54 + --> $DIR/impl-trait-missing-lifetime-gated.rs:9:55 | LL | fn g(mut x: impl Iterator) -> Option<&()> { x.next() } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -11,10 +11,10 @@ LL | fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next( | +++++++ error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime-gated.rs:19:60 + --> $DIR/impl-trait-missing-lifetime-gated.rs:19:61 | LL | async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -47,10 +47,10 @@ LL | async fn i(mut x: impl Iterator) -> Option<&'static ()> | ~~~~~~~ error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime-gated.rs:47:37 + --> $DIR/impl-trait-missing-lifetime-gated.rs:47:38 | LL | fn g(mut x: impl Foo) -> Option<&()> { x.next() } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -59,10 +59,10 @@ LL | fn g(mut x: impl Foo) -> Option<&'static ()> { x.next() } | +++++++ error[E0106]: missing lifetime specifier - --> $DIR/impl-trait-missing-lifetime-gated.rs:58:41 + --> $DIR/impl-trait-missing-lifetime-gated.rs:58:42 | LL | fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -71,10 +71,10 @@ LL | fn g(mut x: impl Foo<()>) -> Option<&'static ()> { x.next() } | +++++++ error[E0658]: anonymous lifetimes in `impl Trait` are unstable - --> $DIR/impl-trait-missing-lifetime-gated.rs:6:35 + --> $DIR/impl-trait-missing-lifetime-gated.rs:6:34 | LL | fn f(_: impl Iterator) {} - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: add `#![feature(anonymous_lifetime_in_impl_trait)]` to the crate attributes to enable help: consider introducing a named lifetime parameter @@ -83,10 +83,10 @@ LL | fn f<'a>(_: impl Iterator) {} | ++++ ++ error[E0658]: anonymous lifetimes in `impl Trait` are unstable - --> $DIR/impl-trait-missing-lifetime-gated.rs:9:39 + --> $DIR/impl-trait-missing-lifetime-gated.rs:9:38 | LL | fn g(mut x: impl Iterator) -> Option<&()> { x.next() } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: add `#![feature(anonymous_lifetime_in_impl_trait)]` to the crate attributes to enable help: consider introducing a named lifetime parameter diff --git a/tests/ui/suggestions/issue-86667.stderr b/tests/ui/suggestions/issue-86667.stderr index 8d611641626e1..834a96e5ed610 100644 --- a/tests/ui/suggestions/issue-86667.stderr +++ b/tests/ui/suggestions/issue-86667.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-86667.rs:6:35 + --> $DIR/issue-86667.rs:6:36 | LL | async fn a(s1: &str, s2: &str) -> &str { - | ---- ---- ^ expected named lifetime parameter + | ---- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `s1` or `s2` help: consider introducing a named lifetime parameter @@ -11,10 +11,10 @@ LL | async fn a<'a>(s1: &'a str, s2: &'a str) -> &'a str { | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/issue-86667.rs:12:29 + --> $DIR/issue-86667.rs:12:30 | LL | fn b(s1: &str, s2: &str) -> &str { - | ---- ---- ^ expected named lifetime parameter + | ---- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `s1` or `s2` help: consider introducing a named lifetime parameter @@ -26,7 +26,7 @@ error: lifetime may not live long enough --> $DIR/issue-86667.rs:8:5 | LL | async fn a(s1: &str, s2: &str) -> &str { - | - let's call the lifetime of this reference `'1` + | - let's call the lifetime of this reference `'1` LL | LL | s1 | ^^ returning this value requires that `'1` must outlive `'static` diff --git a/tests/ui/suggestions/lifetimes/issue-105544.fixed b/tests/ui/suggestions/lifetimes/issue-105544.fixed index 47087eb474972..ffd976b5fd2fd 100644 --- a/tests/ui/suggestions/lifetimes/issue-105544.fixed +++ b/tests/ui/suggestions/lifetimes/issue-105544.fixed @@ -2,7 +2,7 @@ #![allow(warnings)] -fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here... +fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here... //~^ HELP consider adding an explicit lifetime bound (d, p) //~^ ERROR the parameter type `impl Sized` may not live long enough @@ -15,14 +15,14 @@ fn foo1<'b>(d: impl Sized + 'b, p: &'b mut ()) -> impl Sized + '_ { //~^ ERROR the parameter type `impl Sized` may not live long enough } -fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here... +fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here... //~^ HELP consider adding an explicit lifetime bound (d, p) //~^ ERROR the parameter type `impl Sized + 'a` may not live long enough //~| NOTE ...so that the type `impl Sized + 'a` will meet its required lifetime bounds } -fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here... +fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here... //~^ HELP consider adding an explicit lifetime bound (d, p) //~^ ERROR the parameter type `T` may not live long enough @@ -35,7 +35,7 @@ fn bar1<'b, T : Sized + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { //~^ ERROR the parameter type `T` may not live long enough } -fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here... +fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + 'b { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here... //~^ HELP consider adding an explicit lifetime bound (d, p) //~^ ERROR the parameter type `T` may not live long enough diff --git a/tests/ui/suggestions/lifetimes/issue-105544.stderr b/tests/ui/suggestions/lifetimes/issue-105544.stderr index 08fe21b11b501..7849ff0ff3f8d 100644 --- a/tests/ui/suggestions/lifetimes/issue-105544.stderr +++ b/tests/ui/suggestions/lifetimes/issue-105544.stderr @@ -16,8 +16,8 @@ LL | (d, p) | ^^^^^^ help: consider adding an explicit lifetime bound... | -LL | fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ { - | ++++ ++++ ++ +LL | fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + 'a { + | ++++ ++++ ++ ~~ error[E0309]: the parameter type `impl Sized` may not live long enough --> $DIR/issue-105544.rs:14:5 @@ -48,8 +48,8 @@ LL | (d, p) | ^^^^^^ help: consider adding an explicit lifetime bound... | -LL | fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + '_ { - | +++ ++++ ++ +LL | fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + 'b { + | +++ ++++ ++ ~~ error[E0311]: the parameter type `T` may not live long enough --> $DIR/issue-105544.rs:27:5 @@ -69,8 +69,8 @@ LL | (d, p) | ^^^^^^ help: consider adding an explicit lifetime bound... | -LL | fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ { - | +++ ++++ ++ +LL | fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + 'a { + | +++ ++++ ++ ~~ error[E0309]: the parameter type `T` may not live long enough --> $DIR/issue-105544.rs:34:5 @@ -101,8 +101,8 @@ LL | (d, p) | ^^^^^^ help: consider adding an explicit lifetime bound... | -LL | fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { - | +++ ++++ ++ +LL | fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + 'b { + | +++ ++++ ++ ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed index 4013d98c3cfe7..b6f9420d061a4 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.fixed @@ -19,7 +19,7 @@ trait Test { fn test(&self); } -fn func<'a, T: Test + 'a>(foo: &'a Foo<'a>, t: T) { +fn func<'a, T: Test + 'a>(foo: &Foo<'a>, t: T) { foo.bar(move |_| { //~^ ERROR the parameter type `T` may not live long enough t.test(); diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr index 936d87f796824..ba15c1e283be4 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr @@ -22,8 +22,8 @@ LL | | }); | |______^ help: consider adding an explicit lifetime bound... | -LL | fn func<'a, T: Test + 'a>(foo: &'a Foo<'a>, t: T) { - | +++ ++++ ++ ++++ +LL | fn func<'a, T: Test + 'a>(foo: &Foo<'a>, t: T) { + | +++ ++++ ++++ error: aborting due to previous error diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-before-const.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-before-const.stderr index 7b126c90ee797..74abe79c7a255 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-before-const.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature-before-const.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetimes-in-signature-before-const.rs:4:67 + --> $DIR/missing-lifetimes-in-signature-before-const.rs:4:68 | LL | fn buggy_const(_a: &Option<[u8; N]>, _f: &str) -> &str { - | ---------------- ---- ^ expected named lifetime parameter + | ---------------- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_a` or `_f` help: consider introducing a named lifetime parameter diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index 93cfa60b5ab89..268d81075d559 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -49,7 +49,7 @@ LL | | } | |_____^ help: consider adding an explicit lifetime bound... | -LL ~ fn bar<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + '_ +LL ~ fn bar<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a LL | where LL ~ G: Get + 'a, | @@ -78,8 +78,8 @@ LL | | } | |_____^ help: consider adding an explicit lifetime bound... | -LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + '_ - | +++ ++++ ++ +LL | fn qux<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b + | +++ ++++ ++ ~~ error[E0311]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:61:9 @@ -105,8 +105,8 @@ LL | | } | |_________^ help: consider adding an explicit lifetime bound... | -LL | fn qux<'c, 'b, G: Get + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + '_ { - | +++ ++++ ++ +LL | fn qux<'c, 'b, G: Get + 'b + 'c, T>(g: G, dest: &'c mut T) -> impl FnOnce() + 'c { + | +++ ++++ ++ ~~ error[E0311]: the parameter type `G` may not live long enough --> $DIR/missing-lifetimes-in-signature.rs:73:5 @@ -134,8 +134,8 @@ LL | | } | |_____^ help: consider adding an explicit lifetime bound... | -LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + '_ + 'a - | +++ ++++ ++ +LL | fn bat<'b, 'a, G: 'a + 'b, T>(g: G, dest: &'b mut T) -> impl FnOnce() + 'b + 'a + | +++ ++++ ++ ~~ error[E0621]: explicit lifetime required in the type of `dest` --> $DIR/missing-lifetimes-in-signature.rs:73:5 diff --git a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr index 24e2e0a0f7a25..8a926a2485d98 100644 --- a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr +++ b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-in-assoc-const-type.rs:6:14 + --> $DIR/missing-lifetime-in-assoc-const-type.rs:6:15 | LL | const A: &str = ""; - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | diff --git a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr index a97ffe7da79eb..7c683f0010efb 100644 --- a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr +++ b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-in-assoc-const-type.rs:6:14 + --> $DIR/missing-lifetime-in-assoc-const-type.rs:6:15 | LL | const A: &str = ""; - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider introducing a named lifetime parameter | diff --git a/tests/ui/suggestions/missing-lifetime-specifier.stderr b/tests/ui/suggestions/missing-lifetime-specifier.stderr index 21d2378382cba..973a99581c20f 100644 --- a/tests/ui/suggestions/missing-lifetime-specifier.stderr +++ b/tests/ui/suggestions/missing-lifetime-specifier.stderr @@ -24,12 +24,13 @@ LL | | } = help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 3 lifetimes it is borrowed from error[E0106]: missing lifetime specifiers - --> $DIR/missing-lifetime-specifier.rs:23:44 + --> $DIR/missing-lifetime-specifier.rs:23:45 | LL | static b: RefCell>>> = RefCell::new(HashMap::new()); - | ^^^^ expected 2 lifetime parameters - | | - | expected named lifetime parameter + | ^^^ + | | + | expected named lifetime parameter + | expected 2 lifetime parameters | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -38,13 +39,14 @@ LL | static b: RefCell>> | +++++++ ++++++++++++++++++ error[E0106]: missing lifetime specifiers - --> $DIR/missing-lifetime-specifier.rs:23:44 + --> $DIR/missing-lifetime-specifier.rs:23:45 | LL | / thread_local! { LL | | static b: RefCell>>> = RefCell::new(HashMap::new()); - | | ^^^^ expected 2 lifetime parameters - | | | - | | expected named lifetime parameter + | | ^^^ + | | | + | | expected named lifetime parameter + | | expected 2 lifetime parameters LL | | LL | | LL | | } @@ -78,12 +80,12 @@ LL | | } = help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 3 lifetimes it is borrowed from error[E0106]: missing lifetime specifiers - --> $DIR/missing-lifetime-specifier.rs:33:44 + --> $DIR/missing-lifetime-specifier.rs:33:45 | LL | static d: RefCell>>>> = RefCell::new(HashMap::new()); - | ^ ^ expected 2 lifetime parameters - | | - | expected named lifetime parameter + | ^ ^ expected 2 lifetime parameters + | | + | expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -92,13 +94,13 @@ LL | static d: RefCell $DIR/missing-lifetime-specifier.rs:33:44 + --> $DIR/missing-lifetime-specifier.rs:33:45 | LL | / thread_local! { LL | | static d: RefCell>>>> = RefCell::new(HashMap::new()); - | | ^ ^ expected 2 lifetime parameters - | | | - | | expected named lifetime parameter + | | ^ ^ expected 2 lifetime parameters + | | | + | | expected named lifetime parameter LL | | LL | | LL | | } @@ -107,10 +109,10 @@ LL | | } = help: this function's return type contains a borrowed value, but the signature does not say which one of `init`'s 4 lifetimes it is borrowed from error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-specifier.rs:47:44 + --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | static f: RefCell>>>> = RefCell::new(HashMap::new()); - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -119,11 +121,11 @@ LL | static f: RefCell>>>> = | +++++++ error[E0106]: missing lifetime specifier - --> $DIR/missing-lifetime-specifier.rs:47:44 + --> $DIR/missing-lifetime-specifier.rs:47:45 | LL | / thread_local! { LL | | static f: RefCell>>>> = RefCell::new(HashMap::new()); - | | ^ expected named lifetime parameter + | | ^ expected named lifetime parameter LL | | LL | | ... | diff --git a/tests/ui/suggestions/missing-lt-for-hrtb.stderr b/tests/ui/suggestions/missing-lt-for-hrtb.stderr index fa515644431ac..f0bff0497d402 100644 --- a/tests/ui/suggestions/missing-lt-for-hrtb.stderr +++ b/tests/ui/suggestions/missing-lt-for-hrtb.stderr @@ -1,10 +1,11 @@ error[E0106]: missing lifetime specifiers - --> $DIR/missing-lt-for-hrtb.rs:2:32 + --> $DIR/missing-lt-for-hrtb.rs:2:33 | LL | struct S<'a>(&'a dyn Fn(&X) -> &X); - | -- ^^ expected named lifetime parameter - | | - | expected named lifetime parameter + | -- ^ + | | + | expected named lifetime parameter + | expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of argument 1's 2 lifetimes it is borrowed from help: consider using the `'a` lifetime @@ -13,12 +14,13 @@ LL | struct S<'a>(&'a dyn Fn(&X) -> &'a X<'a>); | ++ ++++ error[E0106]: missing lifetime specifiers - --> $DIR/missing-lt-for-hrtb.rs:4:40 + --> $DIR/missing-lt-for-hrtb.rs:4:41 | LL | struct V<'a>(&'a dyn for<'b> Fn(&X) -> &X); - | -- ^^ expected named lifetime parameter - | | - | expected named lifetime parameter + | -- ^ + | | + | expected named lifetime parameter + | expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of argument 1's 2 lifetimes it is borrowed from note: these named lifetimes are available to use diff --git a/tests/ui/suggestions/multiline-multipart-suggestion.stderr b/tests/ui/suggestions/multiline-multipart-suggestion.stderr index 045a86b4f541f..b860874bea742 100644 --- a/tests/ui/suggestions/multiline-multipart-suggestion.stderr +++ b/tests/ui/suggestions/multiline-multipart-suggestion.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/multiline-multipart-suggestion.rs:4:34 + --> $DIR/multiline-multipart-suggestion.rs:4:35  | LL | fn short(foo_bar: &Vec<&i32>) -> &i32 { - |  ---------- ^ expected named lifetime parameter + |  ---------- ^ expected named lifetime parameter  |  = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from help: consider introducing a named lifetime parameter @@ -11,13 +11,13 @@  | ++++ ++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/multiline-multipart-suggestion.rs:11:6 + --> $DIR/multiline-multipart-suggestion.rs:11:7  | LL |  foo_bar: &Vec<&i32>,  |  ---------- LL |  something_very_long_so_that_the_line_will_wrap_around__________: i32, LL | ) -> &i32 { - |  ^ expected named lifetime parameter + |  ^ expected named lifetime parameter  |  = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from help: consider introducing a named lifetime parameter @@ -29,10 +29,10 @@  | error[E0106]: missing lifetime specifier - --> $DIR/multiline-multipart-suggestion.rs:16:29 + --> $DIR/multiline-multipart-suggestion.rs:16:30  | LL |  foo_bar: &Vec<&i32>) -> &i32 { - |  ---------- ^ expected named lifetime parameter + |  ---------- ^ expected named lifetime parameter  |  = help: this function's return type contains a borrowed value, but the signature does not say which one of `foo_bar`'s 2 lifetimes it is borrowed from help: consider introducing a named lifetime parameter diff --git a/tests/ui/suggestions/return-elided-lifetime.stderr b/tests/ui/suggestions/return-elided-lifetime.stderr index 273d95bc747d3..f0851be6975ee 100644 --- a/tests/ui/suggestions/return-elided-lifetime.stderr +++ b/tests/ui/suggestions/return-elided-lifetime.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/return-elided-lifetime.rs:6:12 + --> $DIR/return-elided-lifetime.rs:6:13 | LL | fn f1() -> &i32 { loop {} } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -11,12 +11,12 @@ LL | fn f1() -> &'static i32 { loop {} } | +++++++ error[E0106]: missing lifetime specifiers - --> $DIR/return-elided-lifetime.rs:8:14 + --> $DIR/return-elided-lifetime.rs:8:15 | LL | fn f1_() -> (&i32, &i32) { loop {} } - | ^ ^ expected named lifetime parameter - | | - | expected named lifetime parameter + | ^ ^ expected named lifetime parameter + | | + | expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -25,10 +25,10 @@ LL | fn f1_() -> (&'static i32, &'static i32) { loop {} } | +++++++ +++++++ error[E0106]: missing lifetime specifier - --> $DIR/return-elided-lifetime.rs:11:26 + --> $DIR/return-elided-lifetime.rs:11:27 | LL | fn f2(a: i32, b: i32) -> &i32 { loop {} } - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -37,12 +37,12 @@ LL | fn f2(a: i32, b: i32) -> &'static i32 { loop {} } | +++++++ error[E0106]: missing lifetime specifiers - --> $DIR/return-elided-lifetime.rs:13:28 + --> $DIR/return-elided-lifetime.rs:13:29 | LL | fn f2_(a: i32, b: i32) -> (&i32, &i32) { loop {} } - | ^ ^ expected named lifetime parameter - | | - | expected named lifetime parameter + | ^ ^ expected named lifetime parameter + | | + | expected named lifetime parameter | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime @@ -51,10 +51,10 @@ LL | fn f2_(a: i32, b: i32) -> (&'static i32, &'static i32) { loop {} } | +++++++ +++++++ error[E0106]: missing lifetime specifier - --> $DIR/return-elided-lifetime.rs:17:17 + --> $DIR/return-elided-lifetime.rs:17:18 | LL | fn f3(s: &S) -> &i32 { loop {} } - | -- ^ expected named lifetime parameter + | -- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `s`'s 3 lifetimes it is borrowed from help: consider introducing a named lifetime parameter @@ -63,12 +63,12 @@ LL | fn f3<'a>(s: &'a S<'a, 'a>) -> &'a i32 { loop {} } | ++++ ++ ++++++++ ++ error[E0106]: missing lifetime specifiers - --> $DIR/return-elided-lifetime.rs:19:26 + --> $DIR/return-elided-lifetime.rs:19:27 | LL | fn f3_(s: &S, t: &S) -> (&i32, &i32) { loop {} } - | -- -- ^ ^ expected named lifetime parameter - | | - | expected named lifetime parameter + | -- -- ^ ^ expected named lifetime parameter + | | + | expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `s`'s 3 lifetimes or one of `t`'s 3 lifetimes help: consider introducing a named lifetime parameter @@ -77,10 +77,10 @@ LL | fn f3_<'a>(s: &'a S<'a, 'a>, t: &'a S<'a, 'a>) -> (&'a i32, &'a i32) { loop | ++++ ++ ++++++++ ++ ++++++++ ++ ++ error[E0106]: missing lifetime specifier - --> $DIR/return-elided-lifetime.rs:22:42 + --> $DIR/return-elided-lifetime.rs:22:43 | LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &i32 { loop {} } - | ------- ------- ^ expected named lifetime parameter + | ------- ------- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments note: these named lifetimes are available to use @@ -94,12 +94,12 @@ LL | fn f4<'a, 'b>(a: &'a i32, b: &'b i32) -> &'lifetime i32 { loop {} } | +++++++++ error[E0106]: missing lifetime specifiers - --> $DIR/return-elided-lifetime.rs:24:44 + --> $DIR/return-elided-lifetime.rs:24:45 | LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&i32, &i32) { loop {} } - | ------- ------- ^ ^ expected named lifetime parameter - | | - | expected named lifetime parameter + | ------- ------- ^ ^ expected named lifetime parameter + | | + | expected named lifetime parameter | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments note: these named lifetimes are available to use @@ -113,10 +113,10 @@ LL | fn f4_<'a, 'b>(a: &'a i32, b: &'b i32) -> (&'lifetime i32, &'lifetime i32) | +++++++++ +++++++++ error[E0106]: missing lifetime specifier - --> $DIR/return-elided-lifetime.rs:27:35 + --> $DIR/return-elided-lifetime.rs:27:36 | LL | fn f5<'a>(a: &'a i32, b: &i32) -> &i32 { loop {} } - | ------- ---- ^ expected named lifetime parameter + | ------- ---- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` help: consider using the `'a` lifetime @@ -125,12 +125,12 @@ LL | fn f5<'a>(a: &'a i32, b: &i32) -> &'a i32 { loop {} } | ++ error[E0106]: missing lifetime specifiers - --> $DIR/return-elided-lifetime.rs:29:37 + --> $DIR/return-elided-lifetime.rs:29:38 | LL | fn f5_<'a>(a: &'a i32, b: &i32) -> (&i32, &i32) { loop {} } - | ------- ---- ^ ^ expected named lifetime parameter - | | - | expected named lifetime parameter + | ------- ---- ^ ^ expected named lifetime parameter + | | + | expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b` help: consider using the `'a` lifetime diff --git a/tests/ui/suggestions/return-without-lifetime.stderr b/tests/ui/suggestions/return-without-lifetime.stderr index 5028e8d628f27..b876132010b4f 100644 --- a/tests/ui/suggestions/return-without-lifetime.stderr +++ b/tests/ui/suggestions/return-without-lifetime.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/return-without-lifetime.rs:2:16 + --> $DIR/return-without-lifetime.rs:2:17 | LL | struct Foo<'a>(&usize); - | ^ expected named lifetime parameter + | ^ expected named lifetime parameter | help: consider using the `'a` lifetime | @@ -10,10 +10,10 @@ LL | struct Foo<'a>(&'a usize); | ++ error[E0106]: missing lifetime specifier - --> $DIR/return-without-lifetime.rs:5:34 + --> $DIR/return-without-lifetime.rs:5:35 | LL | fn func1<'a>(_arg: &'a Thing) -> &() { unimplemented!() } - | --------- ^ expected named lifetime parameter + | --------- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `_arg`'s 2 lifetimes it is borrowed from help: consider using the `'a` lifetime @@ -22,10 +22,10 @@ LL | fn func1<'a>(_arg: &'a Thing) -> &'a () { unimplemented!() } | ++ error[E0106]: missing lifetime specifier - --> $DIR/return-without-lifetime.rs:7:35 + --> $DIR/return-without-lifetime.rs:7:36 | LL | fn func2<'a>(_arg: &Thing<'a>) -> &() { unimplemented!() } - | ---------- ^ expected named lifetime parameter + | ---------- ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `_arg`'s 2 lifetimes it is borrowed from help: consider using the `'a` lifetime diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr index 2b8fec86c8a18..a81198460b0f7 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:39 + --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:40 | LL | let _: dyn Foo(&isize, &usize) -> &usize; - | ------ ------ ^ expected named lifetime parameter + | ------ ------ ^ expected named lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr index 3e197dc9a9d12..0e4bef7b05fca 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2015.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-inherent-impl-ampersand-rust2015.rs:13:17 + --> $DIR/where-clause-inherent-impl-ampersand-rust2015.rs:13:18 | LL | T: WithType<&u32> - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | diff --git a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr index 08b4268e5d237..8f5484fd0e38c 100644 --- a/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr +++ b/tests/ui/underscore-lifetime/where-clause-inherent-impl-ampersand-rust2018.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-inherent-impl-ampersand-rust2018.rs:14:17 + --> $DIR/where-clause-inherent-impl-ampersand-rust2018.rs:14:18 | LL | T: WithType<&u32> - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr index 8c5bbb631b4c7..3a02c71e36a29 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2015.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-trait-impl-region-2015.rs:10:17 + --> $DIR/where-clause-trait-impl-region-2015.rs:10:18 | LL | T: WithType<&u32> - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | diff --git a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr index 0268c59fa4af8..b8639f3a8a427 100644 --- a/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr +++ b/tests/ui/underscore-lifetime/where-clause-trait-impl-region-2018.stderr @@ -1,8 +1,8 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/where-clause-trait-impl-region-2018.rs:11:17 + --> $DIR/where-clause-trait-impl-region-2018.rs:11:18 | LL | T: WithType<&u32> - | ^ explicit lifetime name needed here + | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here |