diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index e2b33509b408d..97780de9ba4af 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -596,7 +596,7 @@ pub(crate) fn run_pass_manager( // tools/lto/LTOCodeGenerator.cpp debug!("running the pass manager"); unsafe { - if write::should_use_new_llvm_pass_manager(config) { + if write::should_use_new_llvm_pass_manager(cgcx, config) { let opt_stage = if thin { llvm::OptStage::ThinLTO } else { llvm::OptStage::FatLTO }; let opt_level = config.opt_level.unwrap_or(config::OptLevel::No); write::optimize_with_new_llvm_pass_manager( diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index ca78254f0c84a..380dfd387235d 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -377,10 +377,19 @@ fn get_pgo_sample_use_path(config: &ModuleConfig) -> Option { .map(|path_buf| CString::new(path_buf.to_string_lossy().as_bytes()).unwrap()) } -pub(crate) fn should_use_new_llvm_pass_manager(config: &ModuleConfig) -> bool { +pub(crate) fn should_use_new_llvm_pass_manager( + cgcx: &CodegenContext, + config: &ModuleConfig, +) -> bool { // The new pass manager is enabled by default for LLVM >= 13. // This matches Clang, which also enables it since Clang 13. - config.new_llvm_pass_manager.unwrap_or_else(|| llvm_util::get_version() >= (13, 0, 0)) + + // FIXME: There are some perf issues with the new pass manager + // when targeting s390x, so it is temporarily disabled for that + // arch, see https://github.com/rust-lang/rust/issues/89609 + config + .new_llvm_pass_manager + .unwrap_or_else(|| cgcx.target_arch != "s390x" && llvm_util::get_version() >= (13, 0, 0)) } pub(crate) unsafe fn optimize_with_new_llvm_pass_manager( @@ -482,7 +491,7 @@ pub(crate) unsafe fn optimize( } if let Some(opt_level) = config.opt_level { - if should_use_new_llvm_pass_manager(config) { + if should_use_new_llvm_pass_manager(cgcx, config) { let opt_stage = match cgcx.lto { Lto::Fat => llvm::OptStage::PreLinkFatLTO, Lto::Thin | Lto::ThinLocal => llvm::OptStage::PreLinkThinLTO, diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 2ef0e0f6b1e56..55ec3703df8f8 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -288,7 +288,7 @@ declare_features! ( (accepted, member_constraints, "1.54.0", Some(61997), None), /// Allows bindings in the subpattern of a binding pattern. /// For example, you can write `x @ Some(y)`. - (accepted, bindings_after_at, "1.54.0", Some(65490), None), + (accepted, bindings_after_at, "1.56.0", Some(65490), None), /// Allows calling `transmute` in const fn (accepted, const_fn_transmute, "1.56.0", Some(53605), None), /// Allows accessing fields of unions inside `const` functions. diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index fdd52bd74952f..62bcbdda22e52 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2235,8 +2235,7 @@ pub enum TyKind<'hir> { /// /// Type parameters may be stored in each `PathSegment`. Path(QPath<'hir>), - /// An opaque type definition itself. This is currently only used for the - /// `opaque type Foo: Trait` item that `impl Trait` in desugars to. + /// An opaque type definition itself. This is only used for `impl Trait`. /// /// The generic argument list contains the lifetimes (and in the future /// possibly parameters) that are actually bound on the `impl Trait`. diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index c44d4361f037a..7a31ccbb45a2f 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -116,7 +116,7 @@ pub(super) fn note_and_explain_region( emit_msg_span(err, prefix, description, span, suffix); } -pub(super) fn note_and_explain_free_region( +fn explain_free_region( tcx: TyCtxt<'tcx>, err: &mut DiagnosticBuilder<'_>, prefix: &str, @@ -125,7 +125,7 @@ pub(super) fn note_and_explain_free_region( ) { let (description, span) = msg_span_from_free_region(tcx, region, None); - emit_msg_span(err, prefix, description, span, suffix); + label_msg_span(err, prefix, description, span, suffix); } fn msg_span_from_free_region( @@ -135,7 +135,8 @@ fn msg_span_from_free_region( ) -> (String, Option) { match *region { ty::ReEarlyBound(_) | ty::ReFree(_) => { - msg_span_from_early_bound_and_free_regions(tcx, region) + let (msg, span) = msg_span_from_early_bound_and_free_regions(tcx, region); + (msg, Some(span)) } ty::ReStatic => ("the static lifetime".to_owned(), alt_span), ty::ReEmpty(ty::UniverseIndex::ROOT) => ("an empty lifetime".to_owned(), alt_span), @@ -147,20 +148,12 @@ fn msg_span_from_free_region( fn msg_span_from_early_bound_and_free_regions( tcx: TyCtxt<'tcx>, region: ty::Region<'tcx>, -) -> (String, Option) { +) -> (String, Span) { let sm = tcx.sess.source_map(); let scope = region.free_region_binding_scope(tcx); let node = tcx.hir().local_def_id_to_hir_id(scope.expect_local()); - let tag = match tcx.hir().find(node) { - Some(Node::Block(_) | Node::Expr(_)) => "body", - Some(Node::Item(it)) => item_scope_tag(&it), - Some(Node::TraitItem(it)) => trait_item_scope_tag(&it), - Some(Node::ImplItem(it)) => impl_item_scope_tag(&it), - Some(Node::ForeignItem(it)) => foreign_item_scope_tag(&it), - _ => unreachable!(), - }; - let (prefix, span) = match *region { + match *region { ty::ReEarlyBound(ref br) => { let mut sp = sm.guess_head_span(tcx.hir().span(node)); if let Some(param) = @@ -168,7 +161,7 @@ fn msg_span_from_early_bound_and_free_regions( { sp = param.span; } - (format!("the lifetime `{}` as defined on", br.name), sp) + (format!("the lifetime `{}` as defined here", br.name), sp) } ty::ReFree(ty::FreeRegion { bound_region: ty::BoundRegionKind::BrNamed(_, name), .. @@ -179,28 +172,26 @@ fn msg_span_from_early_bound_and_free_regions( { sp = param.span; } - (format!("the lifetime `{}` as defined on", name), sp) + (format!("the lifetime `{}` as defined here", name), sp) } ty::ReFree(ref fr) => match fr.bound_region { ty::BrAnon(idx) => { if let Some((ty, _)) = find_anon_type(tcx, region, &fr.bound_region) { - ("the anonymous lifetime defined on".to_string(), ty.span) + ("the anonymous lifetime defined here".to_string(), ty.span) } else { ( - format!("the anonymous lifetime #{} defined on", idx + 1), + format!("the anonymous lifetime #{} defined here", idx + 1), tcx.hir().span(node), ) } } _ => ( - format!("the lifetime `{}` as defined on", region), + format!("the lifetime `{}` as defined here", region), sm.guess_head_span(tcx.hir().span(node)), ), }, _ => bug!(), - }; - let (msg, opt_span) = explain_span(tcx, tag, span); - (format!("{} {}", prefix, msg), opt_span) + } } fn emit_msg_span( @@ -219,44 +210,22 @@ fn emit_msg_span( } } -fn item_scope_tag(item: &hir::Item<'_>) -> &'static str { - match item.kind { - hir::ItemKind::Impl { .. } => "impl", - hir::ItemKind::Struct(..) => "struct", - hir::ItemKind::Union(..) => "union", - hir::ItemKind::Enum(..) => "enum", - hir::ItemKind::Trait(..) => "trait", - hir::ItemKind::Fn(..) => "function body", - _ => "item", - } -} - -fn trait_item_scope_tag(item: &hir::TraitItem<'_>) -> &'static str { - match item.kind { - hir::TraitItemKind::Fn(..) => "method body", - hir::TraitItemKind::Const(..) | hir::TraitItemKind::Type(..) => "associated item", - } -} - -fn impl_item_scope_tag(item: &hir::ImplItem<'_>) -> &'static str { - match item.kind { - hir::ImplItemKind::Fn(..) => "method body", - hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(..) => "associated item", - } -} +fn label_msg_span( + err: &mut DiagnosticBuilder<'_>, + prefix: &str, + description: String, + span: Option, + suffix: &str, +) { + let message = format!("{}{}{}", prefix, description, suffix); -fn foreign_item_scope_tag(item: &hir::ForeignItem<'_>) -> &'static str { - match item.kind { - hir::ForeignItemKind::Fn(..) => "method body", - hir::ForeignItemKind::Static(..) | hir::ForeignItemKind::Type => "associated item", + if let Some(span) = span { + err.span_label(span, &message); + } else { + err.note(&message); } } -fn explain_span(tcx: TyCtxt<'tcx>, heading: &str, span: Span) -> (String, Option) { - let lo = tcx.sess.source_map().lookup_char_pos(span.lo()); - (format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize() + 1), Some(span)) -} - pub fn unexpected_hidden_region_diagnostic( tcx: TyCtxt<'tcx>, span: Span, @@ -291,13 +260,25 @@ pub fn unexpected_hidden_region_diagnostic( // // (*) if not, the `tainted_by_errors` field would be set to // `Some(ErrorReported)` in any case, so we wouldn't be here at all. - note_and_explain_free_region( + explain_free_region( tcx, &mut err, &format!("hidden type `{}` captures ", hidden_ty), hidden_region, "", ); + if let Some(reg_info) = tcx.is_suitable_region(hidden_region) { + let fn_returns = tcx.return_type_impl_or_dyn_traits(reg_info.def_id); + nice_region_error::suggest_new_region_bound( + tcx, + &mut err, + fn_returns, + hidden_region.to_string(), + None, + format!("captures {}", hidden_region), + None, + ) + } } _ => { // Ugh. This is a painful case: the hidden region is not one diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mod.rs index 3f27bf67b59a9..6a3309770028f 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/mod.rs @@ -14,6 +14,8 @@ mod static_impl_trait; mod trait_impl_difference; mod util; +pub use static_impl_trait::suggest_new_region_bound; + impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { pub fn try_report_nice_region_error(&self, error: &RegionResolutionError<'tcx>) -> bool { NiceRegionError::new(self, error.clone()).try_report().is_some() diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index 2d47e72780ebe..7fba6a823d75e 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -217,128 +217,159 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { )); } - debug!("try_report_static_impl_trait: fn_return={:?}", fn_returns); - // FIXME: account for the need of parens in `&(dyn Trait + '_)` - let consider = "consider changing the"; - let declare = "to declare that the"; let arg = match param.param.pat.simple_ident() { Some(simple_ident) => format!("argument `{}`", simple_ident), None => "the argument".to_string(), }; - let explicit = format!("you can add an explicit `{}` lifetime bound", lifetime_name); - let explicit_static = format!("explicit `'static` bound to the lifetime of {}", arg); let captures = format!("captures data from {}", arg); - let add_static_bound = "alternatively, add an explicit `'static` bound to this reference"; - let plus_lt = format!(" + {}", lifetime_name); - for fn_return in fn_returns { - if fn_return.span.desugaring_kind().is_some() { - // Skip `async` desugaring `impl Future`. - continue; - } - match fn_return.kind { - TyKind::OpaqueDef(item_id, _) => { - let item = tcx.hir().item(item_id); - let opaque = if let ItemKind::OpaqueTy(opaque) = &item.kind { - opaque - } else { - err.emit(); - return Some(ErrorReported); - }; + suggest_new_region_bound( + tcx, + &mut err, + fn_returns, + lifetime_name, + Some(arg), + captures, + Some((param.param_ty_span, param.param_ty.to_string())), + ); - if let Some(span) = opaque - .bounds - .iter() - .filter_map(|arg| match arg { - GenericBound::Outlives(Lifetime { - name: LifetimeName::Static, - span, - .. - }) => Some(*span), - _ => None, - }) - .next() - { + err.emit(); + Some(ErrorReported) + } +} + +pub fn suggest_new_region_bound( + tcx: TyCtxt<'tcx>, + err: &mut DiagnosticBuilder<'_>, + fn_returns: Vec<&rustc_hir::Ty<'_>>, + lifetime_name: String, + arg: Option, + captures: String, + param: Option<(Span, String)>, +) { + debug!("try_report_static_impl_trait: fn_return={:?}", fn_returns); + // FIXME: account for the need of parens in `&(dyn Trait + '_)` + let consider = "consider changing the"; + let declare = "to declare that the"; + let explicit = format!("you can add an explicit `{}` lifetime bound", lifetime_name); + let explicit_static = + arg.map(|arg| format!("explicit `'static` bound to the lifetime of {}", arg)); + let add_static_bound = "alternatively, add an explicit `'static` bound to this reference"; + let plus_lt = format!(" + {}", lifetime_name); + for fn_return in fn_returns { + if fn_return.span.desugaring_kind().is_some() { + // Skip `async` desugaring `impl Future`. + continue; + } + match fn_return.kind { + TyKind::OpaqueDef(item_id, _) => { + let item = tcx.hir().item(item_id); + let opaque = if let ItemKind::OpaqueTy(opaque) = &item.kind { + opaque + } else { + return; + }; + + if let Some(span) = opaque + .bounds + .iter() + .filter_map(|arg| match arg { + GenericBound::Outlives(Lifetime { + name: LifetimeName::Static, + span, + .. + }) => Some(*span), + _ => None, + }) + .next() + { + if let Some(explicit_static) = &explicit_static { err.span_suggestion_verbose( span, &format!("{} `impl Trait`'s {}", consider, explicit_static), lifetime_name.clone(), Applicability::MaybeIncorrect, ); + } + if let Some((param_span, param_ty)) = param.clone() { err.span_suggestion_verbose( - param.param_ty_span, + param_span, add_static_bound, - param.param_ty.to_string(), - Applicability::MaybeIncorrect, - ); - } else if opaque - .bounds - .iter() - .filter_map(|arg| match arg { - GenericBound::Outlives(Lifetime { name, span, .. }) - if name.ident().to_string() == lifetime_name => - { - Some(*span) - } - _ => None, - }) - .next() - .is_some() - { - } else { - err.span_suggestion_verbose( - fn_return.span.shrink_to_hi(), - &format!( - "{declare} `impl Trait` {captures}, {explicit}", - declare = declare, - captures = captures, - explicit = explicit, - ), - plus_lt.clone(), + param_ty, Applicability::MaybeIncorrect, ); } + } else if opaque + .bounds + .iter() + .filter_map(|arg| match arg { + GenericBound::Outlives(Lifetime { name, span, .. }) + if name.ident().to_string() == lifetime_name => + { + Some(*span) + } + _ => None, + }) + .next() + .is_some() + { + } else { + err.span_suggestion_verbose( + fn_return.span.shrink_to_hi(), + &format!( + "{declare} `impl Trait` {captures}, {explicit}", + declare = declare, + captures = captures, + explicit = explicit, + ), + plus_lt.clone(), + Applicability::MaybeIncorrect, + ); } - TyKind::TraitObject(_, lt, _) => match lt.name { - LifetimeName::ImplicitObjectLifetimeDefault => { - err.span_suggestion_verbose( - fn_return.span.shrink_to_hi(), - &format!( - "{declare} trait object {captures}, {explicit}", - declare = declare, - captures = captures, - explicit = explicit, - ), - plus_lt.clone(), - Applicability::MaybeIncorrect, - ); - } - name if name.ident().to_string() != lifetime_name => { - // With this check we avoid suggesting redundant bounds. This - // would happen if there are nested impl/dyn traits and only - // one of them has the bound we'd suggest already there, like - // in `impl Foo + '_`. + } + TyKind::TraitObject(_, lt, _) => match lt.name { + LifetimeName::ImplicitObjectLifetimeDefault => { + err.span_suggestion_verbose( + fn_return.span.shrink_to_hi(), + &format!( + "{declare} trait object {captures}, {explicit}", + declare = declare, + captures = captures, + explicit = explicit, + ), + plus_lt.clone(), + Applicability::MaybeIncorrect, + ); + } + name if name.ident().to_string() != lifetime_name => { + // With this check we avoid suggesting redundant bounds. This + // would happen if there are nested impl/dyn traits and only + // one of them has the bound we'd suggest already there, like + // in `impl Foo + '_`. + if let Some(explicit_static) = &explicit_static { err.span_suggestion_verbose( lt.span, &format!("{} trait object's {}", consider, explicit_static), lifetime_name.clone(), Applicability::MaybeIncorrect, ); + } + if let Some((param_span, param_ty)) = param.clone() { err.span_suggestion_verbose( - param.param_ty_span, + param_span, add_static_bound, - param.param_ty.to_string(), + param_ty, Applicability::MaybeIncorrect, ); } - _ => {} - }, + } _ => {} - } + }, + _ => {} } - err.emit(); - Some(ErrorReported) } +} +impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { fn get_impl_ident_and_self_ty_from_trait( &self, def_id: DefId, diff --git a/compiler/rustc_typeck/src/check/method/probe.rs b/compiler/rustc_typeck/src/check/method/probe.rs index 44d6f076f5da4..6eeb28e32f1e9 100644 --- a/compiler/rustc_typeck/src/check/method/probe.rs +++ b/compiler/rustc_typeck/src/check/method/probe.rs @@ -753,17 +753,27 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { let (impl_ty, impl_substs) = self.impl_ty_and_substs(impl_def_id); let impl_ty = impl_ty.subst(self.tcx, impl_substs); + debug!("impl_ty: {:?}", impl_ty); + // Determine the receiver type that the method itself expects. - let xform_tys = self.xform_self_ty(&item, impl_ty, impl_substs); + let (xform_self_ty, xform_ret_ty) = self.xform_self_ty(&item, impl_ty, impl_substs); + debug!("xform_self_ty: {:?}, xform_ret_ty: {:?}", xform_self_ty, xform_ret_ty); // We can't use normalize_associated_types_in as it will pollute the // fcx's fulfillment context after this probe is over. + // Note: we only normalize `xform_self_ty` here since the normalization + // of the return type can lead to inference results that prohibit + // valid canidates from being found, see issue #85671 + // FIXME Postponing the normalization of the return type likely only hides a deeper bug, + // which might be caused by the `param_env` itself. The clauses of the `param_env` + // maybe shouldn't include `Param`s, but rather fresh variables or be canonicalized, + // see isssue #89650 let cause = traits::ObligationCause::misc(self.span, self.body_id); let selcx = &mut traits::SelectionContext::new(self.fcx); - let traits::Normalized { value: (xform_self_ty, xform_ret_ty), obligations } = - traits::normalize(selcx, self.param_env, cause, xform_tys); + let traits::Normalized { value: xform_self_ty, obligations } = + traits::normalize(selcx, self.param_env, cause, xform_self_ty); debug!( - "assemble_inherent_impl_probe: xform_self_ty = {:?}/{:?}", + "assemble_inherent_impl_probe after normalization: xform_self_ty = {:?}/{:?}", xform_self_ty, xform_ret_ty ); @@ -1420,6 +1430,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { }; let mut result = ProbeResult::Match; + let mut xform_ret_ty = probe.xform_ret_ty; + debug!(?xform_ret_ty); + let selcx = &mut traits::SelectionContext::new(self); let cause = traits::ObligationCause::misc(self.span, self.body_id); @@ -1428,7 +1441,17 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { // match as well (or at least may match, sometimes we // don't have enough information to fully evaluate). match probe.kind { - InherentImplCandidate(substs, ref ref_obligations) => { + InherentImplCandidate(ref substs, ref ref_obligations) => { + // `xform_ret_ty` hasn't been normalized yet, only `xform_self_ty`, + // see the reasons mentioned in the comments in `assemble_inherent_impl_probe` + // for why this is necessary + let traits::Normalized { + value: normalized_xform_ret_ty, + obligations: normalization_obligations, + } = traits::normalize(selcx, self.param_env, cause.clone(), probe.xform_ret_ty); + xform_ret_ty = normalized_xform_ret_ty; + debug!("xform_ret_ty after normalization: {:?}", xform_ret_ty); + // Check whether the impl imposes obligations we have to worry about. let impl_def_id = probe.item.container.id(); let impl_bounds = self.tcx.predicates_of(impl_def_id); @@ -1442,7 +1465,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { let candidate_obligations = impl_obligations .chain(norm_obligations.into_iter()) - .chain(ref_obligations.iter().cloned()); + .chain(ref_obligations.iter().cloned()) + .chain(normalization_obligations.into_iter()); + // Evaluate those obligations to see if they might possibly hold. for o in candidate_obligations { let o = self.resolve_vars_if_possible(o); @@ -1527,9 +1552,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { } if let ProbeResult::Match = result { - if let (Some(return_ty), Some(xform_ret_ty)) = - (self.return_type, probe.xform_ret_ty) - { + if let (Some(return_ty), Some(xform_ret_ty)) = (self.return_type, xform_ret_ty) { let xform_ret_ty = self.resolve_vars_if_possible(xform_ret_ty); debug!( "comparing return_ty {:?} with xform ret ty {:?}", @@ -1669,6 +1692,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { self.static_candidates.push(source); } + #[instrument(level = "debug", skip(self))] fn xform_self_ty( &self, item: &ty::AssocItem, @@ -1683,9 +1707,10 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { } } + #[instrument(level = "debug", skip(self))] fn xform_method_sig(&self, method: DefId, substs: SubstsRef<'tcx>) -> ty::FnSig<'tcx> { let fn_sig = self.tcx.fn_sig(method); - debug!("xform_self_ty(fn_sig={:?}, substs={:?})", fn_sig, substs); + debug!(?fn_sig); assert!(!substs.has_escaping_bound_vars()); diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 72fe84222deac..dd04f782f940a 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -69,7 +69,12 @@ )] #![cfg_attr( not(bootstrap), - doc(cfg_hide(not(test), not(any(test, bootstrap)), target_has_atomic = "ptr")) + doc(cfg_hide( + not(test), + not(any(test, bootstrap)), + any(not(feature = "miri-test-libstd"), test, doctest), + target_has_atomic = "ptr" + )) )] #![no_std] #![needs_allocator] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 630876445ba82..e10d01b58b017 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -64,6 +64,7 @@ not(bootstrap), doc(cfg_hide( not(test), + any(not(feature = "miri-test-libstd"), test, doctest), target_pointer_width = "16", target_pointer_width = "32", target_pointer_width = "64", diff --git a/library/std/src/sys/unix/stack_overflow.rs b/library/std/src/sys/unix/stack_overflow.rs index e8747e39bcbf4..db1a2a26a8903 100644 --- a/library/std/src/sys/unix/stack_overflow.rs +++ b/library/std/src/sys/unix/stack_overflow.rs @@ -143,14 +143,15 @@ mod imp { } unsafe fn get_stackp() -> *mut libc::c_void { - let stackp = mmap( - ptr::null_mut(), - SIGSTKSZ + page_size(), - PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANON, - -1, - 0, - ); + // OpenBSD requires this flag for stack mapping + // otherwise the said mapping will fail as a no-op on most systems + // and has a different meaning on FreeBSD + #[cfg(any(target_os = "openbsd", target_os = "netbsd", target_os = "linux",))] + let flags = MAP_PRIVATE | MAP_ANON | libc::MAP_STACK; + #[cfg(not(any(target_os = "openbsd", target_os = "netbsd", target_os = "linux",)))] + let flags = MAP_PRIVATE | MAP_ANON; + let stackp = + mmap(ptr::null_mut(), SIGSTKSZ + page_size(), PROT_READ | PROT_WRITE, flags, -1, 0); if stackp == MAP_FAILED { panic!("failed to allocate an alternative stack: {}", io::Error::last_os_error()); } diff --git a/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr b/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr index 0cce10b54a4a9..f71fb2ee18aa1 100644 --- a/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr +++ b/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr @@ -6,7 +6,7 @@ LL | const NAME: &'a str = "unit"; | = note: expected reference `&'static str` found reference `&'a str` -note: the lifetime `'a` as defined on the impl at 6:6... +note: the lifetime `'a` as defined here... --> $DIR/associated-const-impl-wrong-lifetime.rs:6:6 | LL | impl<'a> Foo for &'a () { diff --git a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr index ad39b3601bffb..536fd43ef75e8 100644 --- a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr +++ b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr @@ -24,12 +24,12 @@ LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d | = note: expected fn pointer `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` found fn pointer `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` -note: the lifetime `'c` as defined on the method body at 27:24... +note: the lifetime `'c` as defined here... --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ -note: ...does not necessarily outlive the lifetime `'c` as defined on the method body at 27:24 +note: ...does not necessarily outlive the lifetime `'c` as defined here --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { @@ -43,12 +43,12 @@ LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d | = note: expected fn pointer `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'_>)` found fn pointer `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'_>)` -note: the lifetime `'c` as defined on the method body at 27:24... +note: the lifetime `'c` as defined here... --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ -note: ...does not necessarily outlive the lifetime `'c` as defined on the method body at 27:24 +note: ...does not necessarily outlive the lifetime `'c` as defined here --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { diff --git a/src/test/ui/c-variadic/issue-86053-1.stderr b/src/test/ui/c-variadic/issue-86053-1.stderr index 793068138a9ac..5d119bb8557a4 100644 --- a/src/test/ui/c-variadic/issue-86053-1.stderr +++ b/src/test/ui/c-variadic/issue-86053-1.stderr @@ -84,12 +84,12 @@ error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 10:16 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/issue-86053-1.rs:10:16 | LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 10:21 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/issue-86053-1.rs:10:21 | LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , diff --git a/src/test/ui/c-variadic/issue-86053-2.stderr b/src/test/ui/c-variadic/issue-86053-2.stderr index 4fc5e6315e45b..815b06e770890 100644 --- a/src/test/ui/c-variadic/issue-86053-2.stderr +++ b/src/test/ui/c-variadic/issue-86053-2.stderr @@ -5,7 +5,7 @@ LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {} | ^^^^^^^^^^^^^^^^^^ | = note: the pointer is valid for the static lifetime -note: but the referenced data is only valid for the lifetime `'a` as defined on the function body at 8:32 +note: but the referenced data is only valid for the lifetime `'a` as defined here --> $DIR/issue-86053-2.rs:8:32 | LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {} diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr index 7a4ff77941052..b25a7ab3dc6c7 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr @@ -6,12 +6,12 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | = note: expected fn pointer `fn(&u32)` found fn pointer `fn(&'x u32)` -note: the anonymous lifetime #1 defined on the body at 16:48... +note: the anonymous lifetime #1 defined here... --> $DIR/expect-fn-supply-fn.rs:16:48 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...does not necessarily outlive the lifetime `'x` as defined on the function body at 13:36 +note: ...does not necessarily outlive the lifetime `'x` as defined here --> $DIR/expect-fn-supply-fn.rs:13:36 | LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { @@ -25,12 +25,12 @@ LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | = note: expected fn pointer `fn(&u32)` found fn pointer `fn(&'x u32)` -note: the lifetime `'x` as defined on the function body at 13:36... +note: the lifetime `'x` as defined here... --> $DIR/expect-fn-supply-fn.rs:13:36 | LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #1 defined on the body at 16:48 +note: ...does not necessarily outlive the anonymous lifetime #1 defined here --> $DIR/expect-fn-supply-fn.rs:16:48 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.stderr index 07a67a6183462..f584b0c8382d0 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.stderr @@ -6,7 +6,7 @@ LL | closure_expecting_bound(|x: &'x u32| { | = note: expected reference `&u32` found reference `&'x u32` -note: the anonymous lifetime #1 defined on the body at 14:29... +note: the anonymous lifetime #1 defined here... --> $DIR/expect-region-supply-region-2.rs:14:29 | LL | closure_expecting_bound(|x: &'x u32| { @@ -18,7 +18,7 @@ LL | | LL | | f = Some(x); LL | | }); | |_____^ -note: ...does not necessarily outlive the lifetime `'x` as defined on the function body at 9:30 +note: ...does not necessarily outlive the lifetime `'x` as defined here --> $DIR/expect-region-supply-region-2.rs:9:30 | LL | fn expect_bound_supply_named<'x>() { @@ -32,12 +32,12 @@ LL | closure_expecting_bound(|x: &'x u32| { | = note: expected reference `&u32` found reference `&'x u32` -note: the lifetime `'x` as defined on the function body at 9:30... +note: the lifetime `'x` as defined here... --> $DIR/expect-region-supply-region-2.rs:9:30 | LL | fn expect_bound_supply_named<'x>() { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #1 defined on the body at 14:29 +note: ...does not necessarily outlive the anonymous lifetime #1 defined here --> $DIR/expect-region-supply-region-2.rs:14:29 | LL | closure_expecting_bound(|x: &'x u32| { diff --git a/src/test/ui/dropck/reject-specialized-drops-8142.stderr b/src/test/ui/dropck/reject-specialized-drops-8142.stderr index cb4d97a8b2023..8dbde9d417df0 100644 --- a/src/test/ui/dropck/reject-specialized-drops-8142.stderr +++ b/src/test/ui/dropck/reject-specialized-drops-8142.stderr @@ -30,7 +30,7 @@ LL | impl Drop for N<'static> { fn drop(&mut self) { } } | = note: expected struct `N<'n>` found struct `N<'static>` -note: the lifetime `'n` as defined on the struct at 7:10... +note: the lifetime `'n` as defined here... --> $DIR/reject-specialized-drops-8142.rs:7:10 | LL | struct N<'n> { x: &'n i8 } @@ -91,12 +91,12 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'lw` LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'l1` as defined on the struct at 16:10... +note: first, the lifetime cannot outlive the lifetime `'l1` as defined here... --> $DIR/reject-specialized-drops-8142.rs:16:10 | LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } | ^^^ -note: ...but the lifetime must also be valid for the lifetime `'l2` as defined on the struct at 16:15... +note: ...but the lifetime must also be valid for the lifetime `'l2` as defined here... --> $DIR/reject-specialized-drops-8142.rs:16:15 | LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } diff --git a/src/test/ui/error-codes/E0308-2.stderr b/src/test/ui/error-codes/E0308-2.stderr index 47fea5a23a78d..bfc6a83d44dca 100644 --- a/src/test/ui/error-codes/E0308-2.stderr +++ b/src/test/ui/error-codes/E0308-2.stderr @@ -6,7 +6,7 @@ LL | impl Eq for &dyn DynEq {} | = note: expected trait `PartialEq` found trait `PartialEq` -note: the lifetime `'_` as defined on the impl at 9:13... +note: the lifetime `'_` as defined here... --> $DIR/E0308-2.rs:9:13 | LL | impl Eq for &dyn DynEq {} diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr index 38736de8d9ac7..ec650085a2b9d 100644 --- a/src/test/ui/error-codes/E0478.stderr +++ b/src/test/ui/error-codes/E0478.stderr @@ -4,12 +4,12 @@ error[E0478]: lifetime bound not satisfied LL | child: Box + 'SnowWhite>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'SnowWhite` as defined on the struct at 3:22 +note: lifetime parameter instantiated with the lifetime `'SnowWhite` as defined here --> $DIR/E0478.rs:3:22 | LL | struct Prince<'kiss, 'SnowWhite> { | ^^^^^^^^^^ -note: but lifetime parameter must outlive the lifetime `'kiss` as defined on the struct at 3:15 +note: but lifetime parameter must outlive the lifetime `'kiss` as defined here --> $DIR/E0478.rs:3:15 | LL | struct Prince<'kiss, 'SnowWhite> { diff --git a/src/test/ui/error-codes/E0490.stderr b/src/test/ui/error-codes/E0490.stderr index 9ba5bc330ea93..96e99bd88a497 100644 --- a/src/test/ui/error-codes/E0490.stderr +++ b/src/test/ui/error-codes/E0490.stderr @@ -4,12 +4,12 @@ error[E0490]: a value of type `&'b ()` is borrowed for too long LL | let x: &'a _ = &y; | ^^ | -note: the type is valid for the lifetime `'a` as defined on the function body at 1:6 +note: the type is valid for the lifetime `'a` as defined here --> $DIR/E0490.rs:1:6 | LL | fn f<'a, 'b>(y: &'b ()) { | ^^ -note: but the borrow lasts for the lifetime `'b` as defined on the function body at 1:10 +note: but the borrow lasts for the lifetime `'b` as defined here --> $DIR/E0490.rs:1:10 | LL | fn f<'a, 'b>(y: &'b ()) { @@ -21,7 +21,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to LL | let x: &'a _ = &y; | ^^ | -note: first, the lifetime cannot outlive the lifetime `'b` as defined on the function body at 1:10... +note: first, the lifetime cannot outlive the lifetime `'b` as defined here... --> $DIR/E0490.rs:1:10 | LL | fn f<'a, 'b>(y: &'b ()) { @@ -31,7 +31,7 @@ note: ...so that the type `&'b ()` is not borrowed for too long | LL | let x: &'a _ = &y; | ^^ -note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 1:6... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/E0490.rs:1:6 | LL | fn f<'a, 'b>(y: &'b ()) { @@ -48,7 +48,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | let x: &'a _ = &y; | ^^ | -note: first, the lifetime cannot outlive the lifetime `'b` as defined on the function body at 1:10... +note: first, the lifetime cannot outlive the lifetime `'b` as defined here... --> $DIR/E0490.rs:1:10 | LL | fn f<'a, 'b>(y: &'b ()) { @@ -60,7 +60,7 @@ LL | let x: &'a _ = &y; | ^^ = note: expected `&'a &()` found `&'a &'b ()` -note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 1:6... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/E0490.rs:1:6 | LL | fn f<'a, 'b>(y: &'b ()) { diff --git a/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr b/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr index 5c976098ae3bc..d5ffa8f1b2fb1 100644 --- a/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr +++ b/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr @@ -6,12 +6,12 @@ LL | Foo<'b,'a> | = note: expected struct `Foo<'a, 'b>` found struct `Foo<'b, 'a>` -note: the lifetime `'b` as defined on the impl at 6:9... +note: the lifetime `'b` as defined here... --> $DIR/explicit-self-lifetime-mismatch.rs:6:9 | LL | impl<'a,'b> Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 6:6 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/explicit-self-lifetime-mismatch.rs:6:6 | LL | impl<'a,'b> Foo<'a,'b> { @@ -25,12 +25,12 @@ LL | Foo<'b,'a> | = note: expected struct `Foo<'a, 'b>` found struct `Foo<'b, 'a>` -note: the lifetime `'a` as defined on the impl at 6:6... +note: the lifetime `'a` as defined here... --> $DIR/explicit-self-lifetime-mismatch.rs:6:6 | LL | impl<'a,'b> Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the impl at 6:9 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/explicit-self-lifetime-mismatch.rs:6:9 | LL | impl<'a,'b> Foo<'a,'b> { diff --git a/src/test/ui/generator/resume-arg-late-bound.stderr b/src/test/ui/generator/resume-arg-late-bound.stderr index 63411b59280bb..5e60e33584e10 100644 --- a/src/test/ui/generator/resume-arg-late-bound.stderr +++ b/src/test/ui/generator/resume-arg-late-bound.stderr @@ -6,7 +6,7 @@ LL | test(gen); | = note: expected type `for<'a> Generator<&'a mut bool>` found type `Generator<&mut bool>` -note: the required lifetime does not necessarily outlive the anonymous lifetime #1 defined on the body at 11:15 +note: the required lifetime does not necessarily outlive the anonymous lifetime #1 defined here --> $DIR/resume-arg-late-bound.rs:11:15 | LL | let gen = |arg: &mut bool| { @@ -29,7 +29,7 @@ LL | test(gen); | = note: expected type `for<'a> Generator<&'a mut bool>` found type `Generator<&mut bool>` -note: the anonymous lifetime #1 defined on the body at 11:15 doesn't meet the lifetime requirements +note: the anonymous lifetime #1 defined here doesn't meet the lifetime requirements --> $DIR/resume-arg-late-bound.rs:11:15 | LL | let gen = |arg: &mut bool| { diff --git a/src/test/ui/generic-associated-types/impl_bounds.stderr b/src/test/ui/generic-associated-types/impl_bounds.stderr index 73415e0faac88..649eadec515d0 100644 --- a/src/test/ui/generic-associated-types/impl_bounds.stderr +++ b/src/test/ui/generic-associated-types/impl_bounds.stderr @@ -22,12 +22,12 @@ error[E0478]: lifetime bound not satisfied LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'a` as defined on the associated item at 17:12 +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/impl_bounds.rs:17:12 | LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ()); | ^^ -note: but lifetime parameter must outlive the lifetime `'b` as defined on the associated item at 17:16 +note: but lifetime parameter must outlive the lifetime `'b` as defined here --> $DIR/impl_bounds.rs:17:16 | LL | type B<'a, 'b> where 'b: 'a = (&'a(), &'b ()); diff --git a/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr b/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr index 8ff6cb569b060..24be83024b458 100644 --- a/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr +++ b/src/test/ui/generic-associated-types/issue-78113-lifetime-mismatch-dyn-trait-box.stderr @@ -9,7 +9,7 @@ note: because this has an unmet lifetime requirement | LL | type T<'a>: A; | ^ introduces a `'static` lifetime requirement -note: the lifetime `'a` as defined on the associated item at 17:12... +note: the lifetime `'a` as defined here... --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:17:12 | LL | type T<'a> = Box; @@ -36,7 +36,7 @@ note: because this has an unmet lifetime requirement | LL | type T<'a>: C; | ^ introduces a `'static` lifetime requirement -note: the lifetime `'a` as defined on the associated item at 27:12... +note: the lifetime `'a` as defined here... --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:27:12 | LL | type T<'a> = Box; @@ -58,7 +58,7 @@ note: because this has an unmet lifetime requirement | LL | type T<'a>: E; | ^ introduces a `'static` lifetime requirement -note: the lifetime `'a` as defined on the associated item at 37:12... +note: the lifetime `'a` as defined here... --> $DIR/issue-78113-lifetime-mismatch-dyn-trait-box.rs:37:12 | LL | type T<'a> = (Box, Box); diff --git a/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr b/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr index 772d027685d08..4f0a023ee39c3 100644 --- a/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr +++ b/src/test/ui/generic-associated-types/unsatified-item-lifetime-bound.stderr @@ -12,7 +12,7 @@ error[E0478]: lifetime bound not satisfied LL | f: ::Y<'a>, | ^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'a` as defined on the struct at 12:10 +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/unsatified-item-lifetime-bound.rs:12:10 | LL | struct B<'a, T: for<'r> X = &'r ()>> { @@ -25,7 +25,7 @@ error[E0478]: lifetime bound not satisfied LL | f: ::Y<'a>, | ^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'a` as defined on the struct at 17:10 +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/unsatified-item-lifetime-bound.rs:17:10 | LL | struct C<'a, T: X> { @@ -38,7 +38,7 @@ error[E0478]: lifetime bound not satisfied LL | f: <() as X>::Y<'a>, | ^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'a` as defined on the struct at 22:10 +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/unsatified-item-lifetime-bound.rs:22:10 | LL | struct D<'a> { diff --git a/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr b/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr index 8237d3718c298..ebb4789345733 100644 --- a/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr +++ b/src/test/ui/generic-associated-types/unsatisfied-outlives-bound.stderr @@ -4,7 +4,7 @@ error[E0477]: the type `&'b ()` does not fulfill the required lifetime LL | type Item<'a> = &'b (); | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: type must outlive the lifetime `'a` as defined on the associated item at 8:15 as required by this binding +note: type must outlive the lifetime `'a` as defined here as required by this binding --> $DIR/unsatisfied-outlives-bound.rs:8:15 | LL | type Item<'a> = &'b (); diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr index 8b0e36ab5f6b1..9f200357222ab 100644 --- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr @@ -10,7 +10,7 @@ LL | | fn(Inv<'y>)) } | = note: expected enum `Option)>` found enum `Option)>` -note: the lifetime `'x` as defined on the function body at 38:20... +note: the lifetime `'x` as defined here... --> $DIR/hr-subtype.rs:38:20 | LL | fn subtype<'x, 'y: 'x, 'z: 'y>() { @@ -19,7 +19,7 @@ LL | fn subtype<'x, 'y: 'x, 'z: 'y>() { LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>), LL | | fn(Inv<'y>)) } | |______________- in this macro invocation -note: ...does not necessarily outlive the lifetime `'y` as defined on the function body at 38:24 +note: ...does not necessarily outlive the lifetime `'y` as defined here --> $DIR/hr-subtype.rs:38:24 | LL | fn subtype<'x, 'y: 'x, 'z: 'y>() { @@ -42,7 +42,7 @@ LL | | fn(Inv<'y>)) } | = note: expected enum `Option)>` found enum `Option)>` -note: the lifetime `'x` as defined on the function body at 44:22... +note: the lifetime `'x` as defined here... --> $DIR/hr-subtype.rs:44:22 | LL | fn supertype<'x, 'y: 'x, 'z: 'y>() { @@ -51,7 +51,7 @@ LL | fn supertype<'x, 'y: 'x, 'z: 'y>() { LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>), LL | | fn(Inv<'y>)) } | |______________- in this macro invocation -note: ...does not necessarily outlive the lifetime `'y` as defined on the function body at 44:26 +note: ...does not necessarily outlive the lifetime `'y` as defined here --> $DIR/hr-subtype.rs:44:26 | LL | fn supertype<'x, 'y: 'x, 'z: 'y>() { diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr index fb1127f7f402c..07add3d91a018 100644 --- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr @@ -10,7 +10,7 @@ LL | | fn(&'y u32)) } | = note: expected enum `Option` found enum `Option` -note: the lifetime `'x` as defined on the function body at 44:22... +note: the lifetime `'x` as defined here... --> $DIR/hr-subtype.rs:44:22 | LL | fn supertype<'x, 'y: 'x, 'z: 'y>() { @@ -19,7 +19,7 @@ LL | fn supertype<'x, 'y: 'x, 'z: 'y>() { LL | / check! { free_x_vs_free_y: (fn(&'x u32), LL | | fn(&'y u32)) } | |______________- in this macro invocation -note: ...does not necessarily outlive the lifetime `'y` as defined on the function body at 44:26 +note: ...does not necessarily outlive the lifetime `'y` as defined here --> $DIR/hr-subtype.rs:44:26 | LL | fn supertype<'x, 'y: 'x, 'z: 'y>() { diff --git a/src/test/ui/impl-trait/hidden-lifetimes.stderr b/src/test/ui/impl-trait/hidden-lifetimes.stderr index 7cea4fb93d929..60d3409a8accf 100644 --- a/src/test/ui/impl-trait/hidden-lifetimes.stderr +++ b/src/test/ui/impl-trait/hidden-lifetimes.stderr @@ -2,25 +2,27 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea --> $DIR/hidden-lifetimes.rs:28:54 | LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a { - | ^^^^^^^^^^^^^^ + | -- ^^^^^^^^^^^^^^ + | | + | hidden type `&'a mut &'b T` captures the lifetime `'b` as defined here | -note: hidden type `&'a mut &'b T` captures the lifetime `'b` as defined on the function body at 28:17 - --> $DIR/hidden-lifetimes.rs:28:17 +help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound | -LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a { - | ^^ +LL | fn hide_ref<'a, 'b, T: 'static>(x: &'a mut &'b T) -> impl Swap + 'a + 'b { + | ++++ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/hidden-lifetimes.rs:45:70 | LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc>) -> impl Swap + 'a { - | ^^^^^^^^^^^^^^ + | -- ^^^^^^^^^^^^^^ + | | + | hidden type `Rc>` captures the lifetime `'b` as defined here | -note: hidden type `Rc>` captures the lifetime `'b` as defined on the function body at 45:24 - --> $DIR/hidden-lifetimes.rs:45:24 +help: to declare that the `impl Trait` captures 'b, you can add an explicit `'b` lifetime bound | -LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc>) -> impl Swap + 'a { - | ^^ +LL | fn hide_rc_refcell<'a, 'b: 'a, T: 'static>(x: Rc>) -> impl Swap + 'a + 'b { + | ++++ error: aborting due to 2 previous errors diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.rs b/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.rs index 96d891b2cf1d7..72e9d96da3677 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.rs @@ -1,6 +1,3 @@ -// compile-flags:-Zborrowck=mir - -#![feature(member_constraints)] #![feature(type_alias_impl_trait)] #[derive(Clone)] diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr b/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr index 59105f11805cd..40bec0da2707d 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling-2.stderr @@ -1,14 +1,10 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/error-handling-2.rs:13:60 + --> $DIR/error-handling-2.rs:10:60 | LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { - | ^^^^^^^^^ - | -note: hidden type `*mut &'a i32` captures the lifetime `'a` as defined on the function body at 13:8 - --> $DIR/error-handling-2.rs:13:8 - | -LL | fn foo<'a: 'b, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { - | ^^ + | -- ^^^^^^^^^ + | | + | hidden type `*mut &'a i32` captures the lifetime `'a` as defined here error: aborting due to previous error diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs index 6d88f16ea8abb..367e7f4e6eafb 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.rs @@ -1,5 +1,3 @@ -// compile-flags:-Zborrowck=mir - #![feature(type_alias_impl_trait)] #[derive(Clone)] diff --git a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr index ccd0040030da2..01d9f506a0c58 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr +++ b/src/test/ui/impl-trait/multiple-lifetimes/error-handling.stderr @@ -1,5 +1,5 @@ error: lifetime may not live long enough - --> $DIR/error-handling.rs:22:16 + --> $DIR/error-handling.rs:20:16 | LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/impl-trait/region-escape-via-bound.stderr b/src/test/ui/impl-trait/region-escape-via-bound.stderr index 969ddc57af882..9dc2ea5bc82a1 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.stderr +++ b/src/test/ui/impl-trait/region-escape-via-bound.stderr @@ -3,12 +3,14 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea | LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> | ^^^^^^^^^^^^^^ +LL | +LL | where 'x: 'y + | -- hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here | -note: hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined on the function body at 17:7 - --> $DIR/region-escape-via-bound.rs:17:7 +help: to declare that the `impl Trait` captures 'x, you can add an explicit `'x` lifetime bound | -LL | where 'x: 'y - | ^^ +LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> + 'x + | ++++ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10291.stderr b/src/test/ui/issues/issue-10291.stderr index ff51aa3acf4d4..a80b0ba5e9151 100644 --- a/src/test/ui/issues/issue-10291.stderr +++ b/src/test/ui/issues/issue-10291.stderr @@ -4,7 +4,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | x | ^ | -note: ...the reference is valid for the anonymous lifetime #1 defined on the body at 2:69... +note: ...the reference is valid for the anonymous lifetime #1 defined here... --> $DIR/issue-10291.rs:2:69 | LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { @@ -12,7 +12,7 @@ LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { LL | | x LL | | })); | |_____^ -note: ...but the borrowed content is only valid for the lifetime `'x` as defined on the function body at 1:9 +note: ...but the borrowed content is only valid for the lifetime `'x` as defined here --> $DIR/issue-10291.rs:1:9 | LL | fn test<'x>(x: &'x isize) { diff --git a/src/test/ui/issues/issue-16683.stderr b/src/test/ui/issues/issue-16683.stderr index 35bcf286c440f..d4e18df8de324 100644 --- a/src/test/ui/issues/issue-16683.stderr +++ b/src/test/ui/issues/issue-16683.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflictin LL | self.a(); | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime defined on the method body at 3:10... +note: first, the lifetime cannot outlive the anonymous lifetime defined here... --> $DIR/issue-16683.rs:3:10 | LL | fn b(&self) { @@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content | LL | self.a(); | ^^^^ -note: but, the lifetime must be valid for the lifetime `'a` as defined on the trait at 1:9... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/issue-16683.rs:1:9 | LL | trait T<'a> { diff --git a/src/test/ui/issues/issue-17740.stderr b/src/test/ui/issues/issue-17740.stderr index 995f5f1fc3de3..d177380415591 100644 --- a/src/test/ui/issues/issue-17740.stderr +++ b/src/test/ui/issues/issue-17740.stderr @@ -6,12 +6,12 @@ LL | fn bar(self: &mut Foo) { | = note: expected struct `Foo<'a>` found struct `Foo<'_>` -note: the anonymous lifetime defined on the method body at 6:23... +note: the anonymous lifetime defined here... --> $DIR/issue-17740.rs:6:23 | LL | fn bar(self: &mut Foo) { | ^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 5:7 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/issue-17740.rs:5:7 | LL | impl <'a> Foo<'a>{ @@ -25,12 +25,12 @@ LL | fn bar(self: &mut Foo) { | = note: expected struct `Foo<'a>` found struct `Foo<'_>` -note: the lifetime `'a` as defined on the impl at 5:7... +note: the lifetime `'a` as defined here... --> $DIR/issue-17740.rs:5:7 | LL | impl <'a> Foo<'a>{ | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined on the method body at 6:23 +note: ...does not necessarily outlive the anonymous lifetime defined here --> $DIR/issue-17740.rs:6:23 | LL | fn bar(self: &mut Foo) { diff --git a/src/test/ui/issues/issue-17758.stderr b/src/test/ui/issues/issue-17758.stderr index 846e8939b53b8..711217033a1f7 100644 --- a/src/test/ui/issues/issue-17758.stderr +++ b/src/test/ui/issues/issue-17758.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflictin LL | self.foo(); | ^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime defined on the method body at 6:12... +note: first, the lifetime cannot outlive the anonymous lifetime defined here... --> $DIR/issue-17758.rs:6:12 | LL | fn bar(&self) { @@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content | LL | self.foo(); | ^^^^ -note: but, the lifetime must be valid for the lifetime `'a` as defined on the trait at 4:11... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/issue-17758.rs:4:11 | LL | trait Foo<'a> { diff --git a/src/test/ui/issues/issue-17905-2.stderr b/src/test/ui/issues/issue-17905-2.stderr index 3c27f7058591c..c68265f71f259 100644 --- a/src/test/ui/issues/issue-17905-2.stderr +++ b/src/test/ui/issues/issue-17905-2.stderr @@ -6,12 +6,12 @@ LL | fn say(self: &Pair<&str, isize>) { | = note: expected struct `Pair<&str, _>` found struct `Pair<&str, _>` -note: the anonymous lifetime defined on the method body at 8:24... +note: the anonymous lifetime defined here... --> $DIR/issue-17905-2.rs:8:24 | LL | fn say(self: &Pair<&str, isize>) { | ^^^^ -note: ...does not necessarily outlive the lifetime `'_` as defined on the impl at 5:5 +note: ...does not necessarily outlive the lifetime `'_` as defined here --> $DIR/issue-17905-2.rs:5:5 | LL | &str, @@ -25,12 +25,12 @@ LL | fn say(self: &Pair<&str, isize>) { | = note: expected struct `Pair<&str, _>` found struct `Pair<&str, _>` -note: the lifetime `'_` as defined on the impl at 5:5... +note: the lifetime `'_` as defined here... --> $DIR/issue-17905-2.rs:5:5 | LL | &str, | ^ -note: ...does not necessarily outlive the anonymous lifetime defined on the method body at 8:24 +note: ...does not necessarily outlive the anonymous lifetime defined here --> $DIR/issue-17905-2.rs:8:24 | LL | fn say(self: &Pair<&str, isize>) { diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr index 03e3311e0f39b..4623c82662859 100644 --- a/src/test/ui/issues/issue-20831-debruijn.stderr +++ b/src/test/ui/issues/issue-20831-debruijn.stderr @@ -4,12 +4,12 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d LL | fn subscribe(&mut self, t : Box::Output> + 'a>) { | ^^^^^^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime defined on the method body at 28:58... +note: first, the lifetime cannot outlive the anonymous lifetime defined here... --> $DIR/issue-20831-debruijn.rs:28:58 | LL | fn subscribe(&mut self, t : Box::Output> + 'a>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the impl at 26:6... +note: ...but the lifetime must also be valid for the lifetime `'a` as defined here... --> $DIR/issue-20831-debruijn.rs:26:6 | LL | impl<'a> Publisher<'a> for MyStruct<'a> { diff --git a/src/test/ui/issues/issue-27942.stderr b/src/test/ui/issues/issue-27942.stderr index 80eecb42d1cef..a0126b68fdcd6 100644 --- a/src/test/ui/issues/issue-27942.stderr +++ b/src/test/ui/issues/issue-27942.stderr @@ -6,12 +6,12 @@ LL | fn select(&self) -> BufferViewHandle; | = note: expected type `Resources<'_>` found type `Resources<'a>` -note: the anonymous lifetime defined on the method body at 5:15... +note: the anonymous lifetime defined here... --> $DIR/issue-27942.rs:5:15 | LL | fn select(&self) -> BufferViewHandle; | ^^^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the trait at 3:18 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/issue-27942.rs:3:18 | LL | pub trait Buffer<'a, R: Resources<'a>> { @@ -25,12 +25,12 @@ LL | fn select(&self) -> BufferViewHandle; | = note: expected type `Resources<'_>` found type `Resources<'a>` -note: the lifetime `'a` as defined on the trait at 3:18... +note: the lifetime `'a` as defined here... --> $DIR/issue-27942.rs:3:18 | LL | pub trait Buffer<'a, R: Resources<'a>> { | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined on the method body at 5:15 +note: ...does not necessarily outlive the anonymous lifetime defined here --> $DIR/issue-27942.rs:5:15 | LL | fn select(&self) -> BufferViewHandle; diff --git a/src/test/ui/issues/issue-37884.stderr b/src/test/ui/issues/issue-37884.stderr index d741d42685232..cd84b6ef48471 100644 --- a/src/test/ui/issues/issue-37884.stderr +++ b/src/test/ui/issues/issue-37884.stderr @@ -11,12 +11,12 @@ LL | | } | = note: expected fn pointer `fn(&mut RepeatMut<'a, T>) -> Option<_>` found fn pointer `fn(&'a mut RepeatMut<'a, T>) -> Option<_>` -note: the anonymous lifetime #1 defined on the method body at 6:5... +note: the anonymous lifetime #1 defined here... --> $DIR/issue-37884.rs:6:5 | LL | fn next(&'a mut self) -> Option | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 3:6 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/issue-37884.rs:3:6 | LL | impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr index 21fc3b2bdd1f7..ce8173169b1b3 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr @@ -6,7 +6,6 @@ LL | let _result = &Some(42).as_deref(); | = note: the following trait bounds were not satisfied: `{integer}: Deref` - `<{integer} as Deref>::Target = _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr index c86b024de21a6..e4e9705b07db5 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr @@ -6,7 +6,7 @@ LL | let _result = &mut Some(42).as_deref_mut(); | = note: the following trait bounds were not satisfied: `{integer}: DerefMut` - `<{integer} as Deref>::Target = _` + `{integer}: Deref` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr index 9711e27d8a8a3..a3b9ac6775805 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr @@ -6,7 +6,6 @@ LL | let _result = &Ok(42).as_deref(); | = note: the following trait bounds were not satisfied: `{integer}: Deref` - `<{integer} as Deref>::Target = _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr index ee7ea1e6a0229..98a7091dd0583 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr @@ -6,7 +6,7 @@ LL | let _result = &mut Ok(42).as_deref_mut(); | = note: the following trait bounds were not satisfied: `{integer}: DerefMut` - `<{integer} as Deref>::Target = _` + `{integer}: Deref` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-52213.stderr b/src/test/ui/issues/issue-52213.stderr index 7463af9332a76..aef5e258a1b06 100644 --- a/src/test/ui/issues/issue-52213.stderr +++ b/src/test/ui/issues/issue-52213.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | match (&t,) { | ^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 1:23... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/issue-52213.rs:1:23 | LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { @@ -16,7 +16,7 @@ LL | match (&t,) { | ^^^^^ = note: expected `(&&(T,),)` found `(&&'a (T,),)` -note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 1:27... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/issue-52213.rs:1:27 | LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { diff --git a/src/test/ui/issues/issue-52533-1.stderr b/src/test/ui/issues/issue-52533-1.stderr index 4247d551565c8..475c7d0b48bfb 100644 --- a/src/test/ui/issues/issue-52533-1.stderr +++ b/src/test/ui/issues/issue-52533-1.stderr @@ -6,12 +6,12 @@ LL | gimme(|x, y| y) | = note: expected reference `&Foo<'_, '_, u32>` found reference `&Foo<'_, '_, u32>` -note: the anonymous lifetime #3 defined on the body at 9:11... +note: the anonymous lifetime #3 defined here... --> $DIR/issue-52533-1.rs:9:11 | LL | gimme(|x, y| y) | ^^^^^^^^ -note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 9:11 +note: ...does not necessarily outlive the anonymous lifetime #2 defined here --> $DIR/issue-52533-1.rs:9:11 | LL | gimme(|x, y| y) diff --git a/src/test/ui/issues/issue-52533.stderr b/src/test/ui/issues/issue-52533.stderr index 4e41620eecfdd..ccedbcfec7a28 100644 --- a/src/test/ui/issues/issue-52533.stderr +++ b/src/test/ui/issues/issue-52533.stderr @@ -4,12 +4,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | foo(|a, b| b) | ^ | -note: ...the reference is valid for the anonymous lifetime #1 defined on the body at 5:9... +note: ...the reference is valid for the anonymous lifetime #1 defined here... --> $DIR/issue-52533.rs:5:9 | LL | foo(|a, b| b) | ^^^^^^^^ -note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined on the body at 5:9 +note: ...but the borrowed content is only valid for the anonymous lifetime #2 defined here --> $DIR/issue-52533.rs:5:9 | LL | foo(|a, b| b) diff --git a/src/test/ui/issues/issue-55796.stderr b/src/test/ui/issues/issue-55796.stderr index 952159ffc3bfe..304339657f0a9 100644 --- a/src/test/ui/issues/issue-55796.stderr +++ b/src/test/ui/issues/issue-55796.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | Box::new(self.out_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the trait at 7:17... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/issue-55796.rs:7:17 | LL | pub trait Graph<'a> { @@ -29,7 +29,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | Box::new(self.in_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the trait at 7:17... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/issue-55796.rs:7:17 | LL | pub trait Graph<'a> { diff --git a/src/test/ui/issues/issue-75777.stderr b/src/test/ui/issues/issue-75777.stderr index 25562f6347e67..bf271ab78f7ee 100644 --- a/src/test/ui/issues/issue-75777.stderr +++ b/src/test/ui/issues/issue-75777.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | Box::new(move |_| fut) | ^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 11:11... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/issue-75777.rs:11:11 | LL | fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box BoxFuture<'a, A>> { diff --git a/src/test/ui/lifetimes/issue-79187-2.stderr b/src/test/ui/lifetimes/issue-79187-2.stderr index a156c74fb3304..2aca8faff9f2c 100644 --- a/src/test/ui/lifetimes/issue-79187-2.stderr +++ b/src/test/ui/lifetimes/issue-79187-2.stderr @@ -25,7 +25,7 @@ LL | take_foo(|a: &i32| a); | = note: expected reference `&i32` found reference `&i32` -note: the anonymous lifetime #1 defined on the body at 9:14 doesn't meet the lifetime requirements +note: the anonymous lifetime #1 defined here doesn't meet the lifetime requirements --> $DIR/issue-79187-2.rs:9:14 | LL | take_foo(|a: &i32| a); @@ -44,7 +44,7 @@ LL | take_foo(|a: &i32| -> &i32 { a }); | = note: expected reference `&i32` found reference `&i32` -note: the anonymous lifetime #1 defined on the body at 10:14 doesn't meet the lifetime requirements +note: the anonymous lifetime #1 defined here doesn't meet the lifetime requirements --> $DIR/issue-79187-2.rs:10:14 | LL | take_foo(|a: &i32| -> &i32 { a }); diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr index 91cdc0205d841..bb691fc072b5a 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr @@ -6,7 +6,7 @@ LL | ref_obj(x) | = note: expected reference `&Box<(dyn Fn() + 'static)>` found reference `&Box<(dyn Fn() + 'a)>` -note: the lifetime `'a` as defined on the function body at 32:10... +note: the lifetime `'a` as defined here... --> $DIR/lifetime-bound-will-change-warning.rs:32:10 | LL | fn test2<'a>(x: &'a Box) { @@ -21,7 +21,7 @@ LL | lib::ref_obj(x) | = note: expected reference `&Box<(dyn Fn() + 'static)>` found reference `&Box<(dyn Fn() + 'a)>` -note: the lifetime `'a` as defined on the function body at 37:12... +note: the lifetime `'a` as defined here... --> $DIR/lifetime-bound-will-change-warning.rs:37:12 | LL | fn test2cc<'a>(x: &'a Box) { diff --git a/src/test/ui/lub-if.stderr b/src/test/ui/lub-if.stderr index 0a4744013a62c..a12c48582c79e 100644 --- a/src/test/ui/lub-if.stderr +++ b/src/test/ui/lub-if.stderr @@ -5,7 +5,7 @@ LL | s | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 23:17 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/lub-if.rs:23:17 | LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { @@ -18,7 +18,7 @@ LL | s | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 32:17 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/lub-if.rs:32:17 | LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { diff --git a/src/test/ui/lub-match.stderr b/src/test/ui/lub-match.stderr index 168a389446921..04d50f5ebf471 100644 --- a/src/test/ui/lub-match.stderr +++ b/src/test/ui/lub-match.stderr @@ -5,7 +5,7 @@ LL | s | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 25:17 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/lub-match.rs:25:17 | LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { @@ -18,7 +18,7 @@ LL | s | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 35:17 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/lub-match.rs:35:17 | LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { diff --git a/src/test/ui/match/match-ref-mut-invariance.stderr b/src/test/ui/match/match-ref-mut-invariance.stderr index 3e9f729dc09f5..f9271cb3d068c 100644 --- a/src/test/ui/match/match-ref-mut-invariance.stderr +++ b/src/test/ui/match/match-ref-mut-invariance.stderr @@ -6,12 +6,12 @@ LL | match self.0 { ref mut x => x } | = note: expected mutable reference `&'a mut &'a i32` found mutable reference `&'a mut &'b i32` -note: the lifetime `'a` as defined on the method body at 9:12... +note: the lifetime `'a` as defined here... --> $DIR/match-ref-mut-invariance.rs:9:12 | LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the impl at 8:6 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/match-ref-mut-invariance.rs:8:6 | LL | impl<'b> S<'b> { diff --git a/src/test/ui/match/match-ref-mut-let-invariance.stderr b/src/test/ui/match/match-ref-mut-let-invariance.stderr index 303aba3422cec..c021a5a91f5c0 100644 --- a/src/test/ui/match/match-ref-mut-let-invariance.stderr +++ b/src/test/ui/match/match-ref-mut-let-invariance.stderr @@ -6,12 +6,12 @@ LL | x | = note: expected mutable reference `&'a mut &'a i32` found mutable reference `&'a mut &'b i32` -note: the lifetime `'a` as defined on the method body at 9:12... +note: the lifetime `'a` as defined here... --> $DIR/match-ref-mut-let-invariance.rs:9:12 | LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the impl at 8:6 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/match-ref-mut-let-invariance.rs:8:6 | LL | impl<'b> S<'b> { diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 521de3742b03f..0ec282dac45e2 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -30,7 +30,7 @@ LL | baz(f); | = note: expected type `for<'r> Fn<(*mut &'r u32,)>` found type `Fn<(*mut &'a u32,)>` -note: the required lifetime does not necessarily outlive the lifetime `'a` as defined on the function body at 9:10 +note: the required lifetime does not necessarily outlive the lifetime `'a` as defined here --> $DIR/closure-arg-type-mismatch.rs:9:10 | LL | fn _test<'a>(f: fn(*mut &'a u32)) { @@ -58,7 +58,7 @@ LL | baz(f); | = note: expected type `for<'r> Fn<(*mut &'r u32,)>` found type `Fn<(*mut &'a u32,)>` -note: the lifetime `'a` as defined on the function body at 9:10 doesn't meet the lifetime requirements +note: the lifetime `'a` as defined here doesn't meet the lifetime requirements --> $DIR/closure-arg-type-mismatch.rs:9:10 | LL | fn _test<'a>(f: fn(*mut &'a u32)) { diff --git a/src/test/ui/nll/issue-50716.stderr b/src/test/ui/nll/issue-50716.stderr index 3dee3345db640..737170912fa45 100644 --- a/src/test/ui/nll/issue-50716.stderr +++ b/src/test/ui/nll/issue-50716.stderr @@ -6,7 +6,7 @@ LL | let _x = *s; | = note: expected type `Sized` found type `Sized` -note: the lifetime `'a` as defined on the function body at 9:8... +note: the lifetime `'a` as defined here... --> $DIR/issue-50716.rs:9:8 | LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) diff --git a/src/test/ui/nll/issue-52742.stderr b/src/test/ui/nll/issue-52742.stderr index 23bb12f942075..3f8481219a9ad 100644 --- a/src/test/ui/nll/issue-52742.stderr +++ b/src/test/ui/nll/issue-52742.stderr @@ -4,12 +4,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | self.y = b.z | ^^^ | -note: ...the reference is valid for the lifetime `'_` as defined on the impl at 12:10... +note: ...the reference is valid for the lifetime `'_` as defined here... --> $DIR/issue-52742.rs:12:10 | LL | impl Foo<'_, '_> { | ^^ -note: ...but the borrowed content is only valid for the anonymous lifetime defined on the method body at 13:31 +note: ...but the borrowed content is only valid for the anonymous lifetime defined here --> $DIR/issue-52742.rs:13:31 | LL | fn take_bar(&mut self, b: Bar<'_>) { diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.stderr index dbc478e5b4c87..197f8dfa2abe7 100644 --- a/src/test/ui/nll/issue-55394.stderr +++ b/src/test/ui/nll/issue-55394.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'s` d LL | Foo { bar } | ^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime defined on the method body at 8:17... +note: first, the lifetime cannot outlive the anonymous lifetime defined here... --> $DIR/issue-55394.rs:8:17 | LL | fn new(bar: &mut Bar) -> Self { @@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content | LL | Foo { bar } | ^^^ -note: but, the lifetime must be valid for the lifetime `'_` as defined on the impl at 7:10... +note: but, the lifetime must be valid for the lifetime `'_` as defined here... --> $DIR/issue-55394.rs:7:10 | LL | impl Foo<'_> { diff --git a/src/test/ui/nll/issue-55401.stderr b/src/test/ui/nll/issue-55401.stderr index 2dc7236cbc274..55c51d532e779 100644 --- a/src/test/ui/nll/issue-55401.stderr +++ b/src/test/ui/nll/issue-55401.stderr @@ -5,7 +5,7 @@ LL | *y | ^^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 1:47 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/issue-55401.rs:1:47 | LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { diff --git a/src/test/ui/nll/normalization-bounds-error.stderr b/src/test/ui/nll/normalization-bounds-error.stderr index 8c7c8918f3fc6..6da3d5d96925d 100644 --- a/src/test/ui/nll/normalization-bounds-error.stderr +++ b/src/test/ui/nll/normalization-bounds-error.stderr @@ -4,12 +4,12 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` d LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'d` as defined on the function body at 12:14... +note: first, the lifetime cannot outlive the lifetime `'d` as defined here... --> $DIR/normalization-bounds-error.rs:12:14 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ -note: ...but the lifetime must also be valid for the lifetime `'a` as defined on the function body at 12:18... +note: ...but the lifetime must also be valid for the lifetime `'a` as defined here... --> $DIR/normalization-bounds-error.rs:12:18 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} diff --git a/src/test/ui/nll/trait-associated-constant.stderr b/src/test/ui/nll/trait-associated-constant.stderr index 2af5b2a2e0095..000ebc716572a 100644 --- a/src/test/ui/nll/trait-associated-constant.stderr +++ b/src/test/ui/nll/trait-associated-constant.stderr @@ -6,12 +6,12 @@ LL | const AC: Option<&'c str> = None; | = note: expected enum `Option<&'b str>` found enum `Option<&'c str>` -note: the lifetime `'c` as defined on the impl at 20:18... +note: the lifetime `'c` as defined here... --> $DIR/trait-associated-constant.rs:20:18 | LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the impl at 20:14 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/trait-associated-constant.rs:20:14 | LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { diff --git a/src/test/ui/nll/type-alias-free-regions.stderr b/src/test/ui/nll/type-alias-free-regions.stderr index dbb63b71af8a2..71f5f8fb17668 100644 --- a/src/test/ui/nll/type-alias-free-regions.stderr +++ b/src/test/ui/nll/type-alias-free-regions.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d LL | C { f: b } | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime defined on the method body at 16:24... +note: first, the lifetime cannot outlive the anonymous lifetime defined here... --> $DIR/type-alias-free-regions.rs:16:24 | LL | fn from_box(b: Box) -> Self { @@ -16,7 +16,7 @@ LL | C { f: b } | ^ = note: expected `Box>` found `Box>` -note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 15:6... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/type-alias-free-regions.rs:15:6 | LL | impl<'a> FromBox<'a> for C<'a> { @@ -35,7 +35,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | C { f: Box::new(b.0) } | ^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime defined on the method body at 26:23... +note: first, the lifetime cannot outlive the anonymous lifetime defined here... --> $DIR/type-alias-free-regions.rs:26:23 | LL | fn from_tuple(b: (B,)) -> Self { @@ -47,7 +47,7 @@ LL | C { f: Box::new(b.0) } | ^^^ = note: expected `Box<&isize>` found `Box<&isize>` -note: but, the lifetime must be valid for the lifetime `'a` as defined on the impl at 25:6... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/type-alias-free-regions.rs:25:6 | LL | impl<'a> FromTuple<'a> for C<'a> { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr index 4c7adf75d2fd7..d33c458421406 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr @@ -5,7 +5,7 @@ LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 17:8 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/constant-in-expr-normalize.rs:17:8 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr index d01d022cba796..3ec3a2af8cab3 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr @@ -5,7 +5,7 @@ LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 9:8 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/constant-in-expr-trait-item-1.rs:9:8 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr index dd294280b903a..b36bc3bdd9cdb 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr @@ -5,7 +5,7 @@ LL | >::C | ^^^^^^^^^^^^^^^^^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 9:8 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/constant-in-expr-trait-item-2.rs:9:8 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr index ba0a1748c5e9f..806492b71f449 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d LL | T::C | ^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 9:8... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/constant-in-expr-trait-item-3.rs:9:8 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr index ee1a461257228..5af4c5bdfaed3 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to LL | ss | ^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 54:10... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/object-lifetime-default-elision.rs:54:10 | LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { @@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content | LL | ss | ^^ -note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 54:13... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/object-lifetime-default-elision.rs:54:13 | LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { @@ -33,7 +33,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | ss | ^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 54:10... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/object-lifetime-default-elision.rs:54:10 | LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { @@ -43,7 +43,7 @@ note: ...so that the declared lifetime parameter bounds are satisfied | LL | ss | ^^ -note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 54:13... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/object-lifetime-default-elision.rs:54:13 | LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait { diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr index a789c4906ef4f..e7fab9ecefcd1 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr @@ -6,7 +6,7 @@ LL | ss.t = t; | = note: expected reference `&'a Box<(dyn Test + 'static)>` found reference `&'a Box<(dyn Test + 'a)>` -note: the lifetime `'a` as defined on the function body at 14:6... +note: the lifetime `'a` as defined here... --> $DIR/object-lifetime-default-from-rptr-box-error.rs:14:6 | LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr index 65f8a32f06dd2..07c321ed8c344 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr @@ -6,7 +6,7 @@ LL | ss.t = t; | = note: expected reference `&'a MyBox<(dyn Test + 'static)>` found reference `&'a MyBox<(dyn Test + 'a)>` -note: the lifetime `'a` as defined on the function body at 20:6... +note: the lifetime `'a` as defined here... --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:20:6 | LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr index 404717ff55e5e..4c5fb452ebe42 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr @@ -18,7 +18,7 @@ LL | load0(ss) | = note: expected reference `&MyBox<(dyn SomeTrait + 'static)>` found reference `&MyBox<(dyn SomeTrait + 'a)>` -note: the lifetime `'a` as defined on the function body at 30:10... +note: the lifetime `'a` as defined here... --> $DIR/object-lifetime-default-mybox.rs:30:10 | LL | fn load2<'a>(ss: &MyBox) -> MyBox { diff --git a/src/test/ui/regions/issue-28848.stderr b/src/test/ui/regions/issue-28848.stderr index 83313b34316b4..afa0c9c76b2c5 100644 --- a/src/test/ui/regions/issue-28848.stderr +++ b/src/test/ui/regions/issue-28848.stderr @@ -4,12 +4,12 @@ error[E0478]: lifetime bound not satisfied LL | Foo::<'a, 'b>::xmute(u) | ^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'b` as defined on the function body at 9:16 +note: lifetime parameter instantiated with the lifetime `'b` as defined here --> $DIR/issue-28848.rs:9:16 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | ^^ -note: but lifetime parameter must outlive the lifetime `'a` as defined on the function body at 9:12 +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/issue-28848.rs:9:12 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { diff --git a/src/test/ui/regions/issue-78262.default.stderr b/src/test/ui/regions/issue-78262.default.stderr index 5250848a65cc3..dcb67e6a65492 100644 --- a/src/test/ui/regions/issue-78262.default.stderr +++ b/src/test/ui/regions/issue-78262.default.stderr @@ -6,7 +6,7 @@ LL | let f = |x: &dyn TT| x.func(); | = note: expected reference `&(dyn TT + 'static)` found reference `&dyn TT` -note: the anonymous lifetime #1 defined on the body at 14:13... +note: the anonymous lifetime #1 defined here... --> $DIR/issue-78262.rs:14:13 | LL | let f = |x: &dyn TT| x.func(); diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr index 1fff85e766428..2ec2ca49b1142 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr @@ -10,12 +10,12 @@ error[E0478]: lifetime bound not satisfied LL | z: Box+'b+'c>, | ^^^^^^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'b` as defined on the struct at 11:15 +note: lifetime parameter instantiated with the lifetime `'b` as defined here --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:15 | LL | struct Foo<'a,'b,'c> { | ^^ -note: but lifetime parameter must outlive the lifetime `'a` as defined on the struct at 11:12 +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:12 | LL | struct Foo<'a,'b,'c> { diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.stderr index 750cc3566e032..34287070eec77 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.stderr @@ -13,7 +13,7 @@ LL | | }; | = note: expected struct `Invariant<'a>` found struct `Invariant<'static>` -note: the lifetime `'a` as defined on the function body at 13:10... +note: the lifetime `'a` as defined here... --> $DIR/region-invariant-static-error-reporting.rs:13:10 | LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.stderr index 74ea1b731e9ac..380e27ab0e011 100644 --- a/src/test/ui/regions/region-object-lifetime-2.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflictin LL | x.borrowed() | ^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 9:42... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/region-object-lifetime-2.rs:9:42 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { @@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content | LL | x.borrowed() | ^ -note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 9:45... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/region-object-lifetime-2.rs:9:45 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () { diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.stderr index 1053218290588..b59163ef13b31 100644 --- a/src/test/ui/regions/region-object-lifetime-4.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflictin LL | x.borrowed() | ^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 11:41... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/region-object-lifetime-4.rs:11:41 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { @@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content | LL | x.borrowed() | ^ -note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 11:44... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/region-object-lifetime-4.rs:11:44 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () { diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr index 852ca0f21b166..04d22e58a1dc5 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr @@ -52,7 +52,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | Box::new(v) | ^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 22:6... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/region-object-lifetime-in-coercion.rs:22:6 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { @@ -64,7 +64,7 @@ LL | Box::new(v) | ^ = note: expected `&[u8]` found `&'a [u8]` -note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 22:9... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/region-object-lifetime-in-coercion.rs:22:9 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.stderr index 62e9058365f11..f638064ef8378 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'_` as defined on the body at 7:18... +note: first, the lifetime cannot outlive the lifetime `'_` as defined here... --> $DIR/regions-addr-of-upvar-self.rs:7:18 | LL | let _f = || { diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr index c0401780b8f5b..6ae70ec672ce1 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifet LL | let _: &'a WithAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 33:15 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:33:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 33:18 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:33:18 | LL | fn with_assoc<'a,'b>() { diff --git a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr index 52802848d563c..f4153b2a8166d 100644 --- a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr +++ b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr @@ -16,7 +16,7 @@ error[E0477]: the type `&'a i32` does not fulfill the required lifetime LL | type Value = &'a i32; | ^^^^^^^^^^^^^^^^^^^^^ | -note: type must outlive the lifetime `'b` as defined on the impl at 19:10 as required by this binding +note: type must outlive the lifetime `'b` as defined here as required by this binding --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:10 | LL | impl<'a, 'b> Foo<'b> for &'a i64 { diff --git a/src/test/ui/regions/regions-bounds.stderr b/src/test/ui/regions/regions-bounds.stderr index a4eebab38639e..90227e574ad47 100644 --- a/src/test/ui/regions/regions-bounds.stderr +++ b/src/test/ui/regions/regions-bounds.stderr @@ -6,12 +6,12 @@ LL | return e; | = note: expected struct `TupleStruct<'b>` found struct `TupleStruct<'a>` -note: the lifetime `'a` as defined on the function body at 8:10... +note: the lifetime `'a` as defined here... --> $DIR/regions-bounds.rs:8:10 | LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the function body at 8:13 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/regions-bounds.rs:8:13 | LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { @@ -25,12 +25,12 @@ LL | return e; | = note: expected struct `Struct<'b>` found struct `Struct<'a>` -note: the lifetime `'a` as defined on the function body at 12:10... +note: the lifetime `'a` as defined here... --> $DIR/regions-bounds.rs:12:10 | LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the function body at 12:13 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/regions-bounds.rs:12:13 | LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr index 0cb0b24f108b0..aa22fd96deb64 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | Box::new(v) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 18:20... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:20 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { @@ -14,7 +14,7 @@ note: ...so that the declared lifetime parameter bounds are satisfied | LL | Box::new(v) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: but, the lifetime must be valid for the lifetime `'c` as defined on the function body at 18:26... +note: but, the lifetime must be valid for the lifetime `'c` as defined here... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.stderr index 44bd88e01a267..8b1b90f5b1a84 100644 --- a/src/test/ui/regions/regions-creating-enums4.stderr +++ b/src/test/ui/regions/regions-creating-enums4.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d LL | Ast::Add(x, y) | ^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 6:16... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/regions-creating-enums4.rs:6:16 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { @@ -16,7 +16,7 @@ LL | Ast::Add(x, y) | ^ = note: expected `&Ast<'_>` found `&Ast<'a>` -note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/regions-creating-enums4.rs:6:19 | LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { diff --git a/src/test/ui/regions/regions-early-bound-error-method.stderr b/src/test/ui/regions/regions-early-bound-error-method.stderr index 9095451da0522..99a5f0ce4cd80 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.stderr +++ b/src/test/ui/regions/regions-early-bound-error-method.stderr @@ -4,12 +4,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | g2.get() | ^^^^^^^^ | -note: ...the reference is valid for the lifetime `'a` as defined on the impl at 18:6... +note: ...the reference is valid for the lifetime `'a` as defined here... --> $DIR/regions-early-bound-error-method.rs:18:6 | LL | impl<'a> Box<'a> { | ^^ -note: ...but the borrowed content is only valid for the lifetime `'b` as defined on the method body at 19:11 +note: ...but the borrowed content is only valid for the lifetime `'b` as defined here --> $DIR/regions-early-bound-error-method.rs:19:11 | LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { diff --git a/src/test/ui/regions/regions-early-bound-error.stderr b/src/test/ui/regions/regions-early-bound-error.stderr index 162d573362d45..df9e979eacf0f 100644 --- a/src/test/ui/regions/regions-early-bound-error.stderr +++ b/src/test/ui/regions/regions-early-bound-error.stderr @@ -4,12 +4,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | g1.get() | ^^^^^^^^ | -note: ...the reference is valid for the lifetime `'b` as defined on the function body at 18:11... +note: ...the reference is valid for the lifetime `'b` as defined here... --> $DIR/regions-early-bound-error.rs:18:11 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | ^^ -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 18:8 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/regions-early-bound-error.rs:18:8 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { diff --git a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr index 5ab423d9e2077..1df7ca0e3e900 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { | ^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 5:14 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-free-region-ordering-callee-4.rs:5:14 | LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 5:18 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-free-region-ordering-callee-4.rs:5:18 | LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr index 06e1b0f1ac262..c0f3b24f68cfe 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller.migrate.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'b &'a usize`, reference has a longer lifetime than the LL | let z: Option<&'b &'a usize> = None; | ^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'b` as defined on the function body at 10:14 +note: the pointer is valid for the lifetime `'b` as defined here --> $DIR/regions-free-region-ordering-caller.rs:10:14 | LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ -note: but the referenced data is only valid for the lifetime `'a` as defined on the function body at 10:10 +note: but the referenced data is only valid for the lifetime `'a` as defined here --> $DIR/regions-free-region-ordering-caller.rs:10:10 | LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { @@ -21,12 +21,12 @@ error[E0491]: in type `&'b Paramd<'a>`, reference has a longer lifetime than the LL | let z: Option<&'b Paramd<'a>> = None; | ^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'b` as defined on the function body at 15:14 +note: the pointer is valid for the lifetime `'b` as defined here --> $DIR/regions-free-region-ordering-caller.rs:15:14 | LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ -note: but the referenced data is only valid for the lifetime `'a` as defined on the function body at 15:10 +note: but the referenced data is only valid for the lifetime `'a` as defined here --> $DIR/regions-free-region-ordering-caller.rs:15:10 | LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { @@ -38,12 +38,12 @@ error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the LL | let z: Option<&'a &'b usize> = None; | ^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 21:10 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-free-region-ordering-caller.rs:21:10 | LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 21:14 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-free-region-ordering-caller.rs:21:14 | LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr index 10644174b9bc4..b0a8f4af3973d 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to LL | None => &self.val | ^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the method body at 14:12... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/regions-free-region-ordering-incorrect.rs:14:12 | LL | fn get<'a>(&'a self) -> &'b T { @@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content | LL | None => &self.val | ^^^^^^^^^ -note: but, the lifetime must be valid for the lifetime `'b` as defined on the impl at 13:6... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/regions-free-region-ordering-incorrect.rs:13:6 | LL | impl<'b, T> Node<'b, T> { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr index 4de380ad03b5b..afd522aa00316 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr @@ -6,7 +6,7 @@ LL | b_isize | = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` -note: the lifetime `'r` as defined on the function body at 11:23... +note: the lifetime `'r` as defined here... --> $DIR/regions-infer-invariance-due-to-decl.rs:11:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr index a98d2f0222e65..bb594f3676e37 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr @@ -6,7 +6,7 @@ LL | b_isize | = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` -note: the lifetime `'r` as defined on the function body at 9:23... +note: the lifetime `'r` as defined here... --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:9:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr index deb08ff862cc2..04d11b5b7c71c 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr @@ -6,7 +6,7 @@ LL | b_isize | = note: expected struct `Invariant<'static>` found struct `Invariant<'r>` -note: the lifetime `'r` as defined on the function body at 9:23... +note: the lifetime `'r` as defined here... --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:9:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.stderr index a6e2047559cce..a23bdeb834fad 100644 --- a/src/test/ui/regions/regions-infer-not-param.stderr +++ b/src/test/ui/regions/regions-infer-not-param.stderr @@ -6,12 +6,12 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | = note: expected struct `Direct<'b>` found struct `Direct<'a>` -note: the lifetime `'a` as defined on the function body at 15:16... +note: the lifetime `'a` as defined here... --> $DIR/regions-infer-not-param.rs:15:16 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the function body at 15:19 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/regions-infer-not-param.rs:15:19 | LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } @@ -25,12 +25,12 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | = note: expected struct `Indirect2<'b>` found struct `Indirect2<'a>` -note: the lifetime `'a` as defined on the function body at 19:19... +note: the lifetime `'a` as defined here... --> $DIR/regions-infer-not-param.rs:19:19 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the function body at 19:22 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/regions-infer-not-param.rs:19:22 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } @@ -44,12 +44,12 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | = note: expected struct `Indirect2<'b>` found struct `Indirect2<'a>` -note: the lifetime `'b` as defined on the function body at 19:22... +note: the lifetime `'b` as defined here... --> $DIR/regions-infer-not-param.rs:19:22 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the function body at 19:19 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/regions-infer-not-param.rs:19:19 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.stderr index 95eb4d1f75b72..d2b369fb07b9c 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.stderr @@ -6,12 +6,12 @@ LL | self.f = b; | = note: expected struct `Box>` found struct `Box>` -note: the anonymous lifetime defined on the method body at 21:36... +note: the anonymous lifetime defined here... --> $DIR/regions-infer-paramd-indirect.rs:21:36 | LL | fn set_f_bad(&mut self, b: Box) { | ^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 16:6 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/regions-infer-paramd-indirect.rs:16:6 | LL | impl<'a> SetF<'a> for C<'a> { diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr index eeec0cc786267..11affcaaa79ca 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | let mut ay = &y; | ^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the body at 7:58... +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... --> $DIR/regions-nested-fns.rs:7:58 | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { @@ -19,7 +19,7 @@ note: ...so that reference does not outlive borrowed content | LL | ay = z; | ^ -note: but, the lifetime must be valid for the anonymous lifetime #1 defined on the body at 13:72... +note: but, the lifetime must be valid for the anonymous lifetime #1 defined here... --> $DIR/regions-nested-fns.rs:13:72 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { @@ -48,7 +48,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | if false { return x; } | ^ | -note: ...the reference is valid for the anonymous lifetime #1 defined on the body at 13:72... +note: ...the reference is valid for the anonymous lifetime #1 defined here... --> $DIR/regions-nested-fns.rs:13:72 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { @@ -58,7 +58,7 @@ LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ -note: ...but the borrowed content is only valid for the lifetime `'x` as defined on the function body at 3:11 +note: ...but the borrowed content is only valid for the lifetime `'x` as defined here --> $DIR/regions-nested-fns.rs:3:11 | LL | fn nested<'x>(x: &'x isize) { diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr index ddb2b31ce1095..2bb58b5ec2df5 100644 --- a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr +++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr @@ -8,12 +8,12 @@ LL | | where LL | | <() as Project<'a, 'b>>::Item: Eq, | |______________________________________^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:8... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/regions-normalize-in-where-clause-list.rs:24:8 | LL | fn bar<'a, 'b>() | ^^ -note: ...but the lifetime must also be valid for the lifetime `'b` as defined on the function body at 24:12... +note: ...but the lifetime must also be valid for the lifetime `'b` as defined here... --> $DIR/regions-normalize-in-where-clause-list.rs:24:12 | LL | fn bar<'a, 'b>() @@ -36,12 +36,12 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d LL | fn bar<'a, 'b>() | ^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:8... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/regions-normalize-in-where-clause-list.rs:24:8 | LL | fn bar<'a, 'b>() | ^^ -note: ...but the lifetime must also be valid for the lifetime `'b` as defined on the function body at 24:12... +note: ...but the lifetime must also be valid for the lifetime `'b` as defined here... --> $DIR/regions-normalize-in-where-clause-list.rs:24:12 | LL | fn bar<'a, 'b>() diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr index 0992d9bf295c1..60c115b3f5939 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.migrate.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a WithHrAssoc>`, reference has a longer lif LL | let _: &'a WithHrAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 27:15 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-projection-container-hrtb.rs:27:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 27:18 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-projection-container-hrtb.rs:27:18 | LL | fn with_assoc<'a,'b>() { @@ -21,12 +21,12 @@ error[E0491]: in type `&'a WithHrAssocSub>`, reference has a longer LL | let _: &'a WithHrAssocSub> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 46:19 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-projection-container-hrtb.rs:46:19 | LL | fn with_assoc_sub<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 46:22 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-projection-container-hrtb.rs:46:22 | LL | fn with_assoc_sub<'a,'b>() { diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr index 49e28a14d8a4e..8430b69f99832 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.migrate.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifet LL | let _: &'a WithAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 27:15 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-projection-container-wc.rs:27:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 27:18 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-projection-container-wc.rs:27:18 | LL | fn with_assoc<'a,'b>() { diff --git a/src/test/ui/regions/regions-outlives-projection-container.stderr b/src/test/ui/regions/regions-outlives-projection-container.stderr index dba15fb0576ee..8c2b2c1e24ae1 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifet LL | let _x: &'a WithAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 28:15 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-projection-container.rs:28:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 28:18 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-projection-container.rs:28:18 | LL | fn with_assoc<'a,'b>() { @@ -21,12 +21,12 @@ error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer li LL | let _x: &'a WithoutAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 50:18 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-projection-container.rs:50:18 | LL | fn without_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 50:21 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-projection-container.rs:50:21 | LL | fn without_assoc<'a,'b>() { @@ -38,12 +38,12 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifet LL | call::<&'a WithAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 58:20 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-projection-container.rs:58:20 | LL | fn call_with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 58:23 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-projection-container.rs:58:23 | LL | fn call_with_assoc<'a,'b>() { @@ -55,12 +55,12 @@ error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer li LL | call::<&'a WithoutAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the function body at 67:23 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-projection-container.rs:67:23 | LL | fn call_without_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 67:26 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-projection-container.rs:67:26 | LL | fn call_without_assoc<'a,'b>() { diff --git a/src/test/ui/regions/regions-ret-borrowed-1.stderr b/src/test/ui/regions/regions-ret-borrowed-1.stderr index b5b54bc3c8b73..86df7bfeb7062 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.stderr +++ b/src/test/ui/regions/regions-ret-borrowed-1.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | with(|o| o) | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the body at 10:10... +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... --> $DIR/regions-ret-borrowed-1.rs:10:10 | LL | with(|o| o) @@ -16,7 +16,7 @@ LL | with(|o| o) | ^ = note: expected `&isize` found `&isize` -note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 9:14... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/regions-ret-borrowed-1.rs:9:14 | LL | fn return_it<'a>() -> &'a isize { diff --git a/src/test/ui/regions/regions-ret-borrowed.stderr b/src/test/ui/regions/regions-ret-borrowed.stderr index debae47d16d0b..b9a06d974334c 100644 --- a/src/test/ui/regions/regions-ret-borrowed.stderr +++ b/src/test/ui/regions/regions-ret-borrowed.stderr @@ -4,7 +4,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen LL | with(|o| o) | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the body at 13:10... +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... --> $DIR/regions-ret-borrowed.rs:13:10 | LL | with(|o| o) @@ -16,7 +16,7 @@ LL | with(|o| o) | ^ = note: expected `&isize` found `&isize` -note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 12:14... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/regions-ret-borrowed.rs:12:14 | LL | fn return_it<'a>() -> &'a isize { diff --git a/src/test/ui/regions/regions-static-bound.migrate.stderr b/src/test/ui/regions/regions-static-bound.migrate.stderr index 644458e2063ce..8f11e148220d6 100644 --- a/src/test/ui/regions/regions-static-bound.migrate.stderr +++ b/src/test/ui/regions/regions-static-bound.migrate.stderr @@ -5,7 +5,7 @@ LL | t | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime `'a` as defined on the function body at 8:24 +note: ...but the borrowed content is only valid for the lifetime `'a` as defined here --> $DIR/regions-static-bound.rs:8:24 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr index f16dfdd6e8c77..d45ca94ad27fa 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr @@ -4,12 +4,12 @@ error[E0478]: lifetime bound not satisfied LL | x | ^ | -note: lifetime parameter instantiated with the lifetime `'a` as defined on the function body at 13:9 +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/regions-trait-object-subtyping.rs:13:9 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { | ^^ -note: but lifetime parameter must outlive the lifetime `'b` as defined on the function body at 13:12 +note: but lifetime parameter must outlive the lifetime `'b` as defined here --> $DIR/regions-trait-object-subtyping.rs:13:12 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { @@ -21,7 +21,7 @@ error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to LL | x | ^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 13:9... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/regions-trait-object-subtyping.rs:13:9 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { @@ -31,7 +31,7 @@ note: ...so that reference does not outlive borrowed content | LL | x | ^ -note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 13:12... +note: but, the lifetime must be valid for the lifetime `'b` as defined here... --> $DIR/regions-trait-object-subtyping.rs:13:12 | LL | fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { @@ -52,12 +52,12 @@ LL | x | = note: expected struct `Wrapper<&'b mut (dyn Dummy + 'b)>` found struct `Wrapper<&'a mut (dyn Dummy + 'a)>` -note: the lifetime `'b` as defined on the function body at 20:15... +note: the lifetime `'b` as defined here... --> $DIR/regions-trait-object-subtyping.rs:20:15 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { | ^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the function body at 20:9 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/regions-trait-object-subtyping.rs:20:9 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr index e7a5db671bf6b..7801517595d33 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr @@ -6,7 +6,7 @@ LL | let _: Invariant<'static> = c; | = note: expected struct `Invariant<'static>` found struct `Invariant<'b>` -note: the lifetime `'b` as defined on the function body at 11:9... +note: the lifetime `'b` as defined here... --> $DIR/regions-variance-invariant-use-covariant.rs:11:9 | LL | fn use_<'b>(c: Invariant<'b>) { diff --git a/src/test/ui/regions/regions-wf-trait-object.stderr b/src/test/ui/regions/regions-wf-trait-object.stderr index 1ddbf73a46372..f6006ca046a88 100644 --- a/src/test/ui/regions/regions-wf-trait-object.stderr +++ b/src/test/ui/regions/regions-wf-trait-object.stderr @@ -4,12 +4,12 @@ error[E0478]: lifetime bound not satisfied LL | x: Box+'b> | ^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'b` as defined on the struct at 6:15 +note: lifetime parameter instantiated with the lifetime `'b` as defined here --> $DIR/regions-wf-trait-object.rs:6:15 | LL | struct Foo<'a,'b> { | ^^ -note: but lifetime parameter must outlive the lifetime `'a` as defined on the struct at 6:12 +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/regions-wf-trait-object.rs:6:12 | LL | struct Foo<'a,'b> { diff --git a/src/test/ui/resolve/issue-85671.rs b/src/test/ui/resolve/issue-85671.rs new file mode 100644 index 0000000000000..337ec307ef326 --- /dev/null +++ b/src/test/ui/resolve/issue-85671.rs @@ -0,0 +1,37 @@ +// check-pass + +// Some trait with a function that returns a slice: +pub trait AsSlice { + type Element; + fn as_slice(&self) -> &[Self::Element]; +} + +// Some type +pub struct A(Cont); + +// Here we say that if A wraps a slice, then it implements AsSlice +impl<'a, Element> AsSlice for A<&'a [Element]> { + type Element = Element; + fn as_slice(&self) -> &[Self::Element] { + self.0 + } +} + +impl A { + // We want this function to work + pub fn failing(&self) + where + Self: AsSlice, + { + self.as_ref_a().as_ref_a(); + } + + pub fn as_ref_a(&self) -> A<&[::Element]> + where + Self: AsSlice, + { + A(self.as_slice()) + } +} + +fn main() {} diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr index 09b51fe056870..5dff4c8fffcaf 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the da LL | type Out = &'a Foo<'b>; | ^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the impl at 16:14 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:14 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr index 957a9d6dd3c12..975776cddffb4 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a Foo<'b>`, reference has a longer lifetime than the da LL | type Out = &'a Foo<'b>; | ^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-nominal-type-region.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the impl at 16:14 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-nominal-type-region.rs:16:14 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr index 1589f93d90c8e..be05ecec0c9b0 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than t LL | type Out = &'a Foo<&'b i32>; | ^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the impl at 16:14 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:14 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr index 4bfaa1aac782a..4ba1778d6443f 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr @@ -4,12 +4,12 @@ error[E0491]: in type `&'a Foo<&'b i32>`, reference has a longer lifetime than t LL | type Out = &'a Foo<&'b i32>; | ^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the impl at 16:10 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-outlives-nominal-type-type.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the impl at 16:14 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-outlives-nominal-type-type.rs:16:14 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr index 1b1a2f7b043b7..f886126299120 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr @@ -26,12 +26,12 @@ error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data LL | type Out = &'a &'b T; | ^^^^^^^^^ | -note: the pointer is valid for the lifetime `'a` as defined on the impl at 24:6 +note: the pointer is valid for the lifetime `'a` as defined here --> $DIR/regions-struct-not-wf.rs:24:6 | LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined on the impl at 24:10 +note: but the referenced data is only valid for the lifetime `'b` as defined here --> $DIR/regions-struct-not-wf.rs:24:10 | LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { diff --git a/src/test/ui/static/static-lifetime.stderr b/src/test/ui/static/static-lifetime.stderr index bda325dc01160..4af3370c79944 100644 --- a/src/test/ui/static/static-lifetime.stderr +++ b/src/test/ui/static/static-lifetime.stderr @@ -4,7 +4,7 @@ error[E0478]: lifetime bound not satisfied LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} | ^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime `'a` as defined on the impl at 3:6 +note: lifetime parameter instantiated with the lifetime `'a` as defined here --> $DIR/static-lifetime.rs:3:6 | LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} diff --git a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr index 4e7d52978400f..0cf0074dc3d25 100644 --- a/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr +++ b/src/test/ui/suggestions/lifetimes/missing-lifetimes-in-signature-2.stderr @@ -6,7 +6,7 @@ LL | fn func(foo: &Foo, t: T) { LL | foo.bar(move |_| { | ^^^ | -note: the parameter type `T` must be valid for the anonymous lifetime defined on the function body at 19:24... +note: the parameter type `T` must be valid for the anonymous lifetime defined here... --> $DIR/missing-lifetimes-in-signature-2.rs:19:24 | LL | fn func(foo: &Foo, t: T) { diff --git a/src/test/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/src/test/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr index 539a56f010a84..5572c6515ff92 100644 --- a/src/test/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr +++ b/src/test/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr @@ -4,12 +4,12 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` d LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'a` as defined on the impl at 24:6... +note: first, the lifetime cannot outlive the lifetime `'a` as defined here... --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:6 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^ -note: ...but the lifetime must also be valid for the lifetime `'b` as defined on the impl at 24:9... +note: ...but the lifetime must also be valid for the lifetime `'b` as defined here... --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:9 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { diff --git a/src/test/ui/traits/matching-lifetimes.stderr b/src/test/ui/traits/matching-lifetimes.stderr index 5c28d40160d0c..de1c878a51311 100644 --- a/src/test/ui/traits/matching-lifetimes.stderr +++ b/src/test/ui/traits/matching-lifetimes.stderr @@ -6,12 +6,12 @@ LL | fn foo(x: Foo<'b,'a>) { | = note: expected fn pointer `fn(Foo<'a, 'b>)` found fn pointer `fn(Foo<'b, 'a>)` -note: the lifetime `'b` as defined on the impl at 13:9... +note: the lifetime `'b` as defined here... --> $DIR/matching-lifetimes.rs:13:9 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 13:6 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/matching-lifetimes.rs:13:6 | LL | impl<'a,'b> Tr for Foo<'a,'b> { @@ -25,12 +25,12 @@ LL | fn foo(x: Foo<'b,'a>) { | = note: expected fn pointer `fn(Foo<'a, 'b>)` found fn pointer `fn(Foo<'b, 'a>)` -note: the lifetime `'a` as defined on the impl at 13:6... +note: the lifetime `'a` as defined here... --> $DIR/matching-lifetimes.rs:13:6 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the impl at 13:9 +note: ...does not necessarily outlive the lifetime `'b` as defined here --> $DIR/matching-lifetimes.rs:13:9 | LL | impl<'a,'b> Tr for Foo<'a,'b> { diff --git a/src/test/ui/traits/trait-upcasting/type-checking-test-3.stderr b/src/test/ui/traits/trait-upcasting/type-checking-test-3.stderr index 593ee0a34300a..641e5c97c10fb 100644 --- a/src/test/ui/traits/trait-upcasting/type-checking-test-3.stderr +++ b/src/test/ui/traits/trait-upcasting/type-checking-test-3.stderr @@ -6,7 +6,7 @@ LL | let _ = x as &dyn Bar<'a>; // Error | = note: expected trait object `dyn Bar<'a>` found trait object `dyn Bar<'static>` -note: the lifetime `'a` as defined on the function body at 12:16... +note: the lifetime `'a` as defined here... --> $DIR/type-checking-test-3.rs:12:16 | LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) { @@ -21,7 +21,7 @@ LL | let _ = x as &dyn Bar<'static>; // Error | = note: expected trait object `dyn Bar<'static>` found trait object `dyn Bar<'a>` -note: the lifetime `'a` as defined on the function body at 17:16... +note: the lifetime `'a` as defined here... --> $DIR/type-checking-test-3.rs:17:16 | LL | fn test_wrong2<'a>(x: &dyn Foo<'a>) { diff --git a/src/test/ui/traits/trait-upcasting/type-checking-test-4.stderr b/src/test/ui/traits/trait-upcasting/type-checking-test-4.stderr index 811e524eda78b..4967f3dc2c8cf 100644 --- a/src/test/ui/traits/trait-upcasting/type-checking-test-4.stderr +++ b/src/test/ui/traits/trait-upcasting/type-checking-test-4.stderr @@ -6,7 +6,7 @@ LL | let _ = x as &dyn Bar<'static, 'a>; // Error | = note: expected trait object `dyn Bar<'static, 'a>` found trait object `dyn Bar<'static, 'static>` -note: the lifetime `'a` as defined on the function body at 16:16... +note: the lifetime `'a` as defined here... --> $DIR/type-checking-test-4.rs:16:16 | LL | fn test_wrong1<'a>(x: &dyn Foo<'static>, y: &'a u32) { @@ -21,7 +21,7 @@ LL | let _ = x as &dyn Bar<'a, 'static>; // Error | = note: expected trait object `dyn Bar<'a, 'static>` found trait object `dyn Bar<'static, 'static>` -note: the lifetime `'a` as defined on the function body at 21:16... +note: the lifetime `'a` as defined here... --> $DIR/type-checking-test-4.rs:21:16 | LL | fn test_wrong2<'a>(x: &dyn Foo<'static>, y: &'a u32) { diff --git a/src/test/ui/type-alias-impl-trait/bounds-are-checked.stderr b/src/test/ui/type-alias-impl-trait/bounds-are-checked.stderr index d5fafe05887b9..da9f81d6bd370 100644 --- a/src/test/ui/type-alias-impl-trait/bounds-are-checked.stderr +++ b/src/test/ui/type-alias-impl-trait/bounds-are-checked.stderr @@ -14,7 +14,7 @@ LL | type X<'a> = impl Into<&'static str> + From<&'a str>; | = note: expected trait `From<&'a str>` found trait `From<&'static str>` -note: the lifetime `'a` as defined on the item at 6:8... +note: the lifetime `'a` as defined here... --> $DIR/bounds-are-checked.rs:6:8 | LL | type X<'a> = impl Into<&'static str> + From<&'a str>; diff --git a/src/test/ui/type-alias-impl-trait/issue-74761-2.rs b/src/test/ui/type-alias-impl-trait/issue-74761-2.rs index 4345b5d886ee2..d26ca5c3ead38 100644 --- a/src/test/ui/type-alias-impl-trait/issue-74761-2.rs +++ b/src/test/ui/type-alias-impl-trait/issue-74761-2.rs @@ -1,4 +1,3 @@ -#![feature(member_constraints)] #![feature(type_alias_impl_trait)] pub trait A { diff --git a/src/test/ui/type-alias-impl-trait/issue-74761-2.stderr b/src/test/ui/type-alias-impl-trait/issue-74761-2.stderr index 7a321458b0bf1..f15d0a069ca8a 100644 --- a/src/test/ui/type-alias-impl-trait/issue-74761-2.stderr +++ b/src/test/ui/type-alias-impl-trait/issue-74761-2.stderr @@ -1,11 +1,11 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-74761-2.rs:8:6 + --> $DIR/issue-74761-2.rs:7:6 | LL | impl<'a, 'b> A for () { | ^^ unconstrained lifetime parameter error[E0207]: the lifetime parameter `'b` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-74761-2.rs:8:10 + --> $DIR/issue-74761-2.rs:7:10 | LL | impl<'a, 'b> A for () { | ^^ unconstrained lifetime parameter diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr index 133ecab2296b7..f325d1d8182f1 100644 --- a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -33,12 +33,12 @@ LL | fn dummy2(self: &Bar) {} | = note: expected reference `&'a Bar` found reference `&Bar` -note: the anonymous lifetime defined on the method body at 37:21... +note: the anonymous lifetime defined here... --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} | ^^^^^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 35:6 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { @@ -52,12 +52,12 @@ LL | fn dummy2(self: &Bar) {} | = note: expected reference `&'a Bar` found reference `&Bar` -note: the lifetime `'a` as defined on the impl at 35:6... +note: the lifetime `'a` as defined here... --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined on the method body at 37:21 +note: ...does not necessarily outlive the anonymous lifetime defined here --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} @@ -71,12 +71,12 @@ LL | fn dummy3(self: &&Bar) {} | = note: expected reference `&'a Bar` found reference `&Bar` -note: the anonymous lifetime defined on the method body at 39:22... +note: the anonymous lifetime defined here... --> $DIR/ufcs-explicit-self-bad.rs:39:22 | LL | fn dummy3(self: &&Bar) {} | ^^^^^^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the impl at 35:6 +note: ...does not necessarily outlive the lifetime `'a` as defined here --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { @@ -90,12 +90,12 @@ LL | fn dummy3(self: &&Bar) {} | = note: expected reference `&'a Bar` found reference `&Bar` -note: the lifetime `'a` as defined on the impl at 35:6... +note: the lifetime `'a` as defined here... --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ -note: ...does not necessarily outlive the anonymous lifetime defined on the method body at 39:22 +note: ...does not necessarily outlive the anonymous lifetime defined here --> $DIR/ufcs-explicit-self-bad.rs:39:22 | LL | fn dummy3(self: &&Bar) {} diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr index bd20fd26180cb..d7813338f68cb 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr @@ -4,7 +4,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | x.set(y); | ^ | -note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 16:14... +note: ...the reference is valid for the anonymous lifetime #2 defined here... --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14 | LL | doit(0, &|x, y| { @@ -12,7 +12,7 @@ LL | doit(0, &|x, y| { LL | | x.set(y); LL | | }); | |_____^ -note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined on the body at 16:14 +note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined here --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14 | LL | doit(0, &|x, y| { diff --git a/src/test/ui/variance/variance-associated-types2.stderr b/src/test/ui/variance/variance-associated-types2.stderr index 52cdd6493b06d..af4f2a7c2a066 100644 --- a/src/test/ui/variance/variance-associated-types2.stderr +++ b/src/test/ui/variance/variance-associated-types2.stderr @@ -6,7 +6,7 @@ LL | let _: Box> = make(); | = note: expected trait object `dyn Foo` found trait object `dyn Foo` -note: the lifetime `'a` as defined on the function body at 12:9... +note: the lifetime `'a` as defined here... --> $DIR/variance-associated-types2.rs:12:9 | LL | fn take<'a>(_: &'a u32) { diff --git a/src/test/ui/variance/variance-btree-invariant-types.stderr b/src/test/ui/variance/variance-btree-invariant-types.stderr index ba47bdff281a2..df519e25641c3 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.stderr @@ -6,7 +6,7 @@ LL | v | = note: expected struct `std::collections::btree_map::IterMut<'_, &'new (), _>` found struct `std::collections::btree_map::IterMut<'_, &'static (), _>` -note: the lifetime `'new` as defined on the function body at 3:21... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:3:21 | LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { @@ -21,7 +21,7 @@ LL | v | = note: expected struct `std::collections::btree_map::IterMut<'_, _, &'new ()>` found struct `std::collections::btree_map::IterMut<'_, _, &'static ()>` -note: the lifetime `'new` as defined on the function body at 6:21... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:6:21 | LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> { @@ -36,7 +36,7 @@ LL | v | = note: expected struct `std::collections::btree_map::IterMut<'_, &'static (), _>` found struct `std::collections::btree_map::IterMut<'_, &'new (), _>` -note: the lifetime `'new` as defined on the function body at 9:24... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:9:24 | LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> { @@ -51,7 +51,7 @@ LL | v | = note: expected struct `std::collections::btree_map::IterMut<'_, _, &'static ()>` found struct `std::collections::btree_map::IterMut<'_, _, &'new ()>` -note: the lifetime `'new` as defined on the function body at 12:24... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:12:24 | LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> { @@ -66,7 +66,7 @@ LL | v | = note: expected struct `RangeMut<'_, &'new (), _>` found struct `RangeMut<'_, &'static (), _>` -note: the lifetime `'new` as defined on the function body at 16:22... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:16:22 | LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a, &'new (), ()> { @@ -81,7 +81,7 @@ LL | v | = note: expected struct `RangeMut<'_, _, &'new ()>` found struct `RangeMut<'_, _, &'static ()>` -note: the lifetime `'new` as defined on the function body at 19:22... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:19:22 | LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a, (), &'new ()> { @@ -96,7 +96,7 @@ LL | v | = note: expected struct `RangeMut<'_, &'static (), _>` found struct `RangeMut<'_, &'new (), _>` -note: the lifetime `'new` as defined on the function body at 22:25... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:22:25 | LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a, &'static (), ()> { @@ -111,7 +111,7 @@ LL | v | = note: expected struct `RangeMut<'_, _, &'static ()>` found struct `RangeMut<'_, _, &'new ()>` -note: the lifetime `'new` as defined on the function body at 25:25... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:25:25 | LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a, (), &'static ()> { @@ -126,7 +126,7 @@ LL | v | = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` found struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` -note: the lifetime `'new` as defined on the function body at 29:20... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:29:20 | LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) @@ -141,7 +141,7 @@ LL | v | = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` -note: the lifetime `'new` as defined on the function body at 33:20... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:33:20 | LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) @@ -156,7 +156,7 @@ LL | v | = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` found struct `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` -note: the lifetime `'new` as defined on the function body at 37:23... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:37:23 | LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) @@ -171,7 +171,7 @@ LL | v | = note: expected struct `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` found struct `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` -note: the lifetime `'new` as defined on the function body at 41:23... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:41:23 | LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) @@ -186,7 +186,7 @@ LL | v | = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>` found struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>` -note: the lifetime `'new` as defined on the function body at 46:20... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:46:20 | LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) @@ -201,7 +201,7 @@ LL | v | = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` found struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` -note: the lifetime `'new` as defined on the function body at 50:20... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:50:20 | LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) @@ -216,7 +216,7 @@ LL | v | = note: expected struct `std::collections::btree_map::VacantEntry<'_, &'static (), _>` found struct `std::collections::btree_map::VacantEntry<'_, &'new (), _>` -note: the lifetime `'new` as defined on the function body at 54:23... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:54:23 | LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) @@ -231,7 +231,7 @@ LL | v | = note: expected struct `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` found struct `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` -note: the lifetime `'new` as defined on the function body at 58:23... +note: the lifetime `'new` as defined here... --> $DIR/variance-btree-invariant-types.rs:58:23 | LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.stderr index a512a60aa42d9..16583fa793109 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.stderr @@ -6,12 +6,12 @@ LL | v | = note: expected trait object `dyn Get<&'min i32>` found trait object `dyn Get<&'max i32>` -note: the lifetime `'min` as defined on the function body at 10:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-contravariant-arg-object.rs:10:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 10:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-contravariant-arg-object.rs:10:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) @@ -25,12 +25,12 @@ LL | v | = note: expected trait object `dyn Get<&'max i32>` found trait object `dyn Get<&'min i32>` -note: the lifetime `'min` as defined on the function body at 17:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-contravariant-arg-object.rs:17:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 17:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-contravariant-arg-object.rs:17:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr index 1752b3b36a484..370e57f73df10 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr @@ -6,12 +6,12 @@ LL | impls_get::() | = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` -note: the lifetime `'min` as defined on the function body at 10:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-contravariant-arg-trait-match.rs:10:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 10:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-contravariant-arg-trait-match.rs:10:27 | LL | fn get_min_from_max<'min, 'max, G>() @@ -25,12 +25,12 @@ LL | impls_get::() | = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` -note: the lifetime `'min` as defined on the function body at 16:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-contravariant-arg-trait-match.rs:16:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 16:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-contravariant-arg-trait-match.rs:16:27 | LL | fn get_max_from_min<'min, 'max, G>() diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr index e35aec4c0ce27..a82fc4d68542e 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr @@ -6,12 +6,12 @@ LL | impls_get::<&'min G>(); | = note: expected type `Get` found type `Get` -note: the lifetime `'min` as defined on the function body at 10:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-contravariant-self-trait-match.rs:10:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 10:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-contravariant-self-trait-match.rs:10:27 | LL | fn get_min_from_max<'min, 'max, G>() @@ -25,12 +25,12 @@ LL | impls_get::<&'max G>(); | = note: expected type `Get` found type `Get` -note: the lifetime `'min` as defined on the function body at 16:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-contravariant-self-trait-match.rs:16:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 16:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-contravariant-self-trait-match.rs:16:27 | LL | fn get_max_from_min<'min, 'max, G>() diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.stderr index 75b6d588c1593..d590a4dc2d9d5 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.stderr @@ -6,12 +6,12 @@ LL | v | = note: expected trait object `dyn Get<&'min i32>` found trait object `dyn Get<&'max i32>` -note: the lifetime `'min` as defined on the function body at 10:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-covariant-arg-object.rs:10:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 10:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-covariant-arg-object.rs:10:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) @@ -25,12 +25,12 @@ LL | v | = note: expected trait object `dyn Get<&'max i32>` found trait object `dyn Get<&'min i32>` -note: the lifetime `'min` as defined on the function body at 18:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-covariant-arg-object.rs:18:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 18:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-covariant-arg-object.rs:18:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr index aa383fcc26280..eb1766b096c07 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr @@ -6,12 +6,12 @@ LL | impls_get::() | = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` -note: the lifetime `'min` as defined on the function body at 10:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-covariant-arg-trait-match.rs:10:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 10:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-covariant-arg-trait-match.rs:10:27 | LL | fn get_min_from_max<'min, 'max, G>() @@ -25,12 +25,12 @@ LL | impls_get::() | = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` -note: the lifetime `'min` as defined on the function body at 17:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-covariant-arg-trait-match.rs:17:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 17:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-covariant-arg-trait-match.rs:17:27 | LL | fn get_max_from_min<'min, 'max, G>() diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.stderr index a25d1044d4256..87b40115d46a1 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-self-trait-match.stderr @@ -6,12 +6,12 @@ LL | impls_get::<&'min G>(); | = note: expected type `Get` found type `Get` -note: the lifetime `'min` as defined on the function body at 10:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-covariant-self-trait-match.rs:10:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 10:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-covariant-self-trait-match.rs:10:27 | LL | fn get_min_from_max<'min, 'max, G>() @@ -25,12 +25,12 @@ LL | impls_get::<&'max G>(); | = note: expected type `Get` found type `Get` -note: the lifetime `'min` as defined on the function body at 17:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-covariant-self-trait-match.rs:17:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 17:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-covariant-self-trait-match.rs:17:27 | LL | fn get_max_from_min<'min, 'max, G>() diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.stderr index 13ee9b9da3c98..6c1b07e6677e3 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.stderr @@ -6,12 +6,12 @@ LL | v | = note: expected trait object `dyn Get<&'min i32>` found trait object `dyn Get<&'max i32>` -note: the lifetime `'min` as defined on the function body at 7:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-invariant-arg-object.rs:7:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 7:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-invariant-arg-object.rs:7:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) @@ -25,12 +25,12 @@ LL | v | = note: expected trait object `dyn Get<&'max i32>` found trait object `dyn Get<&'min i32>` -note: the lifetime `'min` as defined on the function body at 14:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-invariant-arg-object.rs:14:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 14:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-invariant-arg-object.rs:14:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr index b58993737c783..0328496546eb7 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr @@ -6,12 +6,12 @@ LL | impls_get::() | = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` -note: the lifetime `'min` as defined on the function body at 7:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-invariant-arg-trait-match.rs:7:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 7:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-invariant-arg-trait-match.rs:7:27 | LL | fn get_min_from_max<'min, 'max, G>() @@ -25,12 +25,12 @@ LL | impls_get::() | = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` -note: the lifetime `'min` as defined on the function body at 13:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-invariant-arg-trait-match.rs:13:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 13:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-invariant-arg-trait-match.rs:13:27 | LL | fn get_max_from_min<'min, 'max, G>() diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.stderr index 4a1d4d28b4805..426dd136448fe 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-self-trait-match.stderr @@ -6,12 +6,12 @@ LL | impls_get::<&'min G>(); | = note: expected type `Get` found type `Get` -note: the lifetime `'min` as defined on the function body at 7:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-invariant-self-trait-match.rs:7:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 7:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-invariant-self-trait-match.rs:7:27 | LL | fn get_min_from_max<'min, 'max, G>() @@ -25,12 +25,12 @@ LL | impls_get::<&'max G>(); | = note: expected type `Get` found type `Get` -note: the lifetime `'min` as defined on the function body at 13:21... +note: the lifetime `'min` as defined here... --> $DIR/variance-invariant-self-trait-match.rs:13:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 13:27 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-invariant-self-trait-match.rs:13:27 | LL | fn get_max_from_min<'min, 'max, G>() diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr index 423c9a601f456..ec0cb22cdb6ba 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr @@ -6,12 +6,12 @@ LL | v | = note: expected struct `SomeStruct<&'min ()>` found struct `SomeStruct<&'max ()>` -note: the lifetime `'min` as defined on the function body at 8:8... +note: the lifetime `'min` as defined here... --> $DIR/variance-use-contravariant-struct-1.rs:8:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 8:13 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-use-contravariant-struct-1.rs:8:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.stderr index 3f9224804bdd0..0c0071cf9e16f 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-covariant-struct-1.stderr @@ -6,12 +6,12 @@ LL | v | = note: expected struct `SomeStruct<&'max ()>` found struct `SomeStruct<&'min ()>` -note: the lifetime `'min` as defined on the function body at 6:8... +note: the lifetime `'min` as defined here... --> $DIR/variance-use-covariant-struct-1.rs:6:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 6:13 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-use-covariant-struct-1.rs:6:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.stderr index 7063f1c9c8f97..76e4bd76b998f 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-invariant-struct-1.stderr @@ -6,12 +6,12 @@ LL | v | = note: expected struct `SomeStruct<&'min ()>` found struct `SomeStruct<&'max ()>` -note: the lifetime `'min` as defined on the function body at 8:8... +note: the lifetime `'min` as defined here... --> $DIR/variance-use-invariant-struct-1.rs:8:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 8:13 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-use-invariant-struct-1.rs:8:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) @@ -25,12 +25,12 @@ LL | v | = note: expected struct `SomeStruct<&'max ()>` found struct `SomeStruct<&'min ()>` -note: the lifetime `'min` as defined on the function body at 15:8... +note: the lifetime `'min` as defined here... --> $DIR/variance-use-invariant-struct-1.rs:15:8 | LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ -note: ...does not necessarily outlive the lifetime `'max` as defined on the function body at 15:13 +note: ...does not necessarily outlive the lifetime `'max` as defined here --> $DIR/variance-use-invariant-struct-1.rs:15:13 | LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) diff --git a/src/test/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr b/src/test/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr index 4e927cd983d0d..d3593d8c1eb67 100644 --- a/src/test/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr +++ b/src/test/ui/wf/wf-in-foreign-fn-decls-issue-80468.stderr @@ -17,7 +17,7 @@ note: because this has an unmet lifetime requirement | LL | pub struct Wrapper(T); | ^^^^^ introduces a `'static` lifetime requirement -note: the anonymous lifetime #1 defined on the method body at 16:5... +note: the anonymous lifetime #1 defined here... --> $DIR/wf-in-foreign-fn-decls-issue-80468.rs:16:5 | LL | pub fn repro(_: Wrapper); diff --git a/src/test/ui/wf/wf-static-method.stderr b/src/test/ui/wf/wf-static-method.stderr index c02a8fe4aaff6..c663931c5d605 100644 --- a/src/test/ui/wf/wf-static-method.stderr +++ b/src/test/ui/wf/wf-static-method.stderr @@ -4,12 +4,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | u | ^ | -note: ...the reference is valid for the lifetime `'a` as defined on the impl at 14:6... +note: ...the reference is valid for the lifetime `'a` as defined here... --> $DIR/wf-static-method.rs:14:6 | LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { | ^^ -note: ...but the borrowed content is only valid for the lifetime `'b` as defined on the impl at 14:10 +note: ...but the borrowed content is only valid for the lifetime `'b` as defined here --> $DIR/wf-static-method.rs:14:10 | LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { @@ -21,12 +21,12 @@ error[E0478]: lifetime bound not satisfied LL | let me = Self::make_me(); | ^^^^ | -note: lifetime parameter instantiated with the lifetime `'b` as defined on the impl at 23:10 +note: lifetime parameter instantiated with the lifetime `'b` as defined here --> $DIR/wf-static-method.rs:23:10 | LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { | ^^ -note: but lifetime parameter must outlive the lifetime `'a` as defined on the impl at 23:6 +note: but lifetime parameter must outlive the lifetime `'a` as defined here --> $DIR/wf-static-method.rs:23:6 | LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { @@ -38,12 +38,12 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... LL | u | ^ | -note: ...the reference is valid for the lifetime `'a` as defined on the impl at 31:6... +note: ...the reference is valid for the lifetime `'a` as defined here... --> $DIR/wf-static-method.rs:31:6 | LL | impl<'a, 'b> Evil<'a, 'b> { | ^^ -note: ...but the borrowed content is only valid for the lifetime `'b` as defined on the impl at 31:10 +note: ...but the borrowed content is only valid for the lifetime `'b` as defined here --> $DIR/wf-static-method.rs:31:10 | LL | impl<'a, 'b> Evil<'a, 'b> { @@ -55,7 +55,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` d LL | <()>::static_evil(b) | ^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'b` as defined on the function body at 40:13... +note: first, the lifetime cannot outlive the lifetime `'b` as defined here... --> $DIR/wf-static-method.rs:40:13 | LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { @@ -65,7 +65,7 @@ note: ...so that reference does not outlive borrowed content | LL | <()>::static_evil(b) | ^ -note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 40:9... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/wf-static-method.rs:40:9 | LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { @@ -82,7 +82,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` d LL | ::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'b` as defined on the function body at 44:22... +note: first, the lifetime cannot outlive the lifetime `'b` as defined here... --> $DIR/wf-static-method.rs:44:22 | LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { @@ -92,7 +92,7 @@ note: ...so that reference does not outlive borrowed content | LL | ::static_evil(b) | ^ -note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 44:18... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/wf-static-method.rs:44:18 | LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { @@ -109,7 +109,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` d LL | ::inherent_evil(b) | ^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime `'b` as defined on the function body at 49:22... +note: first, the lifetime cannot outlive the lifetime `'b` as defined here... --> $DIR/wf-static-method.rs:49:22 | LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 { @@ -119,7 +119,7 @@ note: ...so that reference does not outlive borrowed content | LL | ::inherent_evil(b) | ^ -note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 49:18... +note: but, the lifetime must be valid for the lifetime `'a` as defined here... --> $DIR/wf-static-method.rs:49:18 | LL | fn inherent_evil<'a, 'b>(b: &'b u32) -> &'a u32 {