Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8772747

Browse files
committedJun 30, 2018
Auto merge of #51862 - estebank:lifetime-spans, r=nikomatsakis
Point to lifetime spans on lifetime errors
2 parents 96b4733 + 8449c5a commit 8772747

27 files changed

+236
-170
lines changed
 

‎src/librustc/hir/map/mod.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use rustc_target::spec::abi::Abi;
2525
use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID};
2626
use syntax::codemap::Spanned;
2727
use syntax::ext::base::MacroKind;
28-
use syntax_pos::Span;
28+
use syntax_pos::{Span, DUMMY_SP};
2929

3030
use hir::*;
3131
use hir::print::Nested;
@@ -664,6 +664,33 @@ impl<'hir> Map<'hir> {
664664
self.as_local_node_id(id).map(|id| self.get(id)) // read recorded by `get`
665665
}
666666

667+
pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics> {
668+
self.get_if_local(id).and_then(|node| {
669+
match node {
670+
NodeImplItem(ref impl_item) => Some(&impl_item.generics),
671+
NodeTraitItem(ref trait_item) => Some(&trait_item.generics),
672+
NodeItem(ref item) => {
673+
match item.node {
674+
ItemFn(_, _, ref generics, _) |
675+
ItemTy(_, ref generics) |
676+
ItemEnum(_, ref generics) |
677+
ItemStruct(_, ref generics) |
678+
ItemUnion(_, ref generics) |
679+
ItemTrait(_, _, ref generics, ..) |
680+
ItemTraitAlias(ref generics, _) |
681+
ItemImpl(_, _, _, ref generics, ..) => Some(generics),
682+
_ => None,
683+
}
684+
}
685+
_ => None,
686+
}
687+
})
688+
}
689+
690+
pub fn get_generics_span(&self, id: DefId) -> Option<Span> {
691+
self.get_generics(id).map(|generics| generics.span).filter(|sp| *sp != DUMMY_SP)
692+
}
693+
667694
/// Retrieve the Node corresponding to `id`, returning None if
668695
/// cannot be found.
669696
pub fn find(&self, id: NodeId) -> Option<Node<'hir>> {

‎src/librustc/hir/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use hir::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX};
3131
use util::nodemap::{NodeMap, FxHashSet};
3232
use mir::mono::Linkage;
3333

34-
use syntax_pos::{Span, DUMMY_SP};
34+
use syntax_pos::{Span, DUMMY_SP, symbol::InternedString};
3535
use syntax::codemap::{self, Spanned};
3636
use rustc_target::spec::abi::Abi;
3737
use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
@@ -547,6 +547,15 @@ impl Generics {
547547

548548
own_counts
549549
}
550+
551+
pub fn get_named(&self, name: &InternedString) -> Option<&GenericParam> {
552+
for param in &self.params {
553+
if *name == param.name.ident().as_interned_str() {
554+
return Some(param);
555+
}
556+
}
557+
None
558+
}
550559
}
551560

552561
/// Synthetic Type Parameters are converted to an other form during lowering, this allows

‎src/librustc/infer/error_reporting/mod.rs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
189189
self,
190190
region: ty::Region<'tcx>,
191191
) -> (String, Option<Span>) {
192+
let cm = self.sess.codemap();
193+
192194
let scope = region.free_region_binding_scope(self);
193195
let node = self.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
194196
let unknown;
@@ -219,10 +221,26 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
219221
}
220222
};
221223
let (prefix, span) = match *region {
222-
ty::ReEarlyBound(ref br) => (
223-
format!("the lifetime {} as defined on", br.name),
224-
self.sess.codemap().def_span(self.hir.span(node)),
225-
),
224+
ty::ReEarlyBound(ref br) => {
225+
let mut sp = cm.def_span(self.hir.span(node));
226+
if let Some(param) = self.hir.get_generics(scope).and_then(|generics| {
227+
generics.get_named(&br.name)
228+
}) {
229+
sp = param.span;
230+
}
231+
(format!("the lifetime {} as defined on", br.name), sp)
232+
}
233+
ty::ReFree(ty::FreeRegion {
234+
bound_region: ty::BoundRegion::BrNamed(_, ref name), ..
235+
}) => {
236+
let mut sp = cm.def_span(self.hir.span(node));
237+
if let Some(param) = self.hir.get_generics(scope).and_then(|generics| {
238+
generics.get_named(&name)
239+
}) {
240+
sp = param.span;
241+
}
242+
(format!("the lifetime {} as defined on", name), sp)
243+
}
226244
ty::ReFree(ref fr) => match fr.bound_region {
227245
ty::BrAnon(idx) => (
228246
format!("the anonymous lifetime #{} defined on", idx + 1),
@@ -234,7 +252,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
234252
),
235253
_ => (
236254
format!("the lifetime {} as defined on", fr.bound_region),
237-
self.sess.codemap().def_span(self.hir.span(node)),
255+
cm.def_span(self.hir.span(node)),
238256
),
239257
},
240258
_ => bug!(),

‎src/librustc_typeck/check/compare_method.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
356356
impl_generics: &ty::Generics,
357357
trait_to_skol_substs: &Substs<'tcx>)
358358
-> Result<(), ErrorReported> {
359-
let span = tcx.sess.codemap().def_span(span);
360359
let trait_params = trait_generics.own_counts().lifetimes;
361360
let impl_params = impl_generics.own_counts().lifetimes;
362361

@@ -378,16 +377,20 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
378377
// are zero. Since I don't quite know how to phrase things at
379378
// the moment, give a kind of vague error message.
380379
if trait_params != impl_params {
381-
let mut err = struct_span_err!(tcx.sess,
382-
span,
383-
E0195,
384-
"lifetime parameters or bounds on method `{}` do not match \
385-
the trait declaration",
386-
impl_m.ident);
380+
let def_span = tcx.sess.codemap().def_span(span);
381+
let span = tcx.hir.get_generics_span(impl_m.def_id).unwrap_or(def_span);
382+
let mut err = struct_span_err!(
383+
tcx.sess,
384+
span,
385+
E0195,
386+
"lifetime parameters or bounds on method `{}` do not match the trait declaration",
387+
impl_m.ident,
388+
);
387389
err.span_label(span, "lifetimes do not match method in trait");
388390
if let Some(sp) = tcx.hir.span_if_local(trait_m.def_id) {
389-
err.span_label(tcx.sess.codemap().def_span(sp),
390-
"lifetimes in impl do not match this method in trait");
391+
let def_sp = tcx.sess.codemap().def_span(sp);
392+
let sp = tcx.hir.get_generics_span(trait_m.def_id).unwrap_or(def_sp);
393+
err.span_label(sp, "lifetimes in impl do not match this method in trait");
391394
}
392395
err.emit();
393396
return Err(ErrorReported);

‎src/test/ui/associated-const-impl-wrong-lifetime.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ LL | const NAME: &'a str = "unit";
66
|
77
= note: expected type `&'static str`
88
found type `&'a str`
9-
note: the lifetime 'a as defined on the impl at 17:1...
10-
--> $DIR/associated-const-impl-wrong-lifetime.rs:17:1
9+
note: the lifetime 'a as defined on the impl at 17:6...
10+
--> $DIR/associated-const-impl-wrong-lifetime.rs:17:6
1111
|
1212
LL | impl<'a> Foo for &'a () {
13-
| ^^^^^^^^^^^^^^^^^^^^^^^
13+
| ^^
1414
= note: ...does not necessarily outlive the static lifetime
1515

1616
error: aborting due to previous error

‎src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ LL | //~^ ERROR E0373
77
LL | }
88
| - borrowed value only lives until here
99
|
10-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 19:1...
11-
--> $DIR/borrowck-escaping-closure-error-2.rs:19:1
10+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 19:8...
11+
--> $DIR/borrowck-escaping-closure-error-2.rs:19:8
1212
|
1313
LL | fn foo<'a>(x: &'a i32) -> Box<FnMut()+'a> {
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
| ^^
1515

1616
error: aborting due to previous error
1717

‎src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub trait Foo<'a, 't> {
2020
fn no_bound<'b>(self, b: Inv<'b>);
2121
fn has_bound<'b:'a>(self, b: Inv<'b>);
2222
fn wrong_bound1<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>);
23+
fn wrong_bound2<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>);
2324
fn okay_bound<'b,'c,'d:'a+'b+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>);
2425
fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>);
2526
}
@@ -47,6 +48,10 @@ impl<'a, 't> Foo<'a, 't> for &'a isize {
4748
// cases.
4849
}
4950

51+
fn wrong_bound2(self, b: Inv, c: Inv, d: Inv) {
52+
//~^ ERROR lifetime parameters or bounds on method `wrong_bound2` do not match the trait
53+
}
54+
5055
fn okay_bound<'b,'c,'e:'b+'c>(self, b: Inv<'b>, c: Inv<'c>, e: Inv<'e>) {
5156
}
5257

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,59 @@
11
error[E0195]: lifetime parameters or bounds on method `no_bound` do not match the trait declaration
2-
--> $DIR/regions-bound-missing-bound-in-impl.rs:28:5
2+
--> $DIR/regions-bound-missing-bound-in-impl.rs:29:16
33
|
44
LL | fn no_bound<'b>(self, b: Inv<'b>);
5-
| ---------------------------------- lifetimes in impl do not match this method in trait
5+
| ---- lifetimes in impl do not match this method in trait
66
...
77
LL | fn no_bound<'b:'a>(self, b: Inv<'b>) {
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
8+
| ^^^^^^^ lifetimes do not match method in trait
99

1010
error[E0195]: lifetime parameters or bounds on method `has_bound` do not match the trait declaration
11-
--> $DIR/regions-bound-missing-bound-in-impl.rs:32:5
11+
--> $DIR/regions-bound-missing-bound-in-impl.rs:33:17
1212
|
1313
LL | fn has_bound<'b:'a>(self, b: Inv<'b>);
14-
| -------------------------------------- lifetimes in impl do not match this method in trait
14+
| ------- lifetimes in impl do not match this method in trait
1515
...
1616
LL | fn has_bound<'b>(self, b: Inv<'b>) {
17-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
17+
| ^^^^ lifetimes do not match method in trait
1818

1919
error[E0308]: method not compatible with trait
20-
--> $DIR/regions-bound-missing-bound-in-impl.rs:36:5
20+
--> $DIR/regions-bound-missing-bound-in-impl.rs:37:5
2121
|
2222
LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
2424
|
2525
= note: expected type `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'d>)`
2626
found type `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'d>)`
27-
note: the lifetime 'c as defined on the method body at 36:5...
28-
--> $DIR/regions-bound-missing-bound-in-impl.rs:36:5
27+
note: the lifetime 'c as defined on the method body at 37:24...
28+
--> $DIR/regions-bound-missing-bound-in-impl.rs:37:24
2929
|
3030
LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
31-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32-
note: ...does not necessarily outlive the lifetime 'c as defined on the method body at 36:5
33-
--> $DIR/regions-bound-missing-bound-in-impl.rs:36:5
31+
| ^^
32+
note: ...does not necessarily outlive the lifetime 'c as defined on the method body at 37:24
33+
--> $DIR/regions-bound-missing-bound-in-impl.rs:37:24
3434
|
3535
LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) {
36-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
| ^^
37+
38+
error[E0195]: lifetime parameters or bounds on method `wrong_bound2` do not match the trait declaration
39+
--> $DIR/regions-bound-missing-bound-in-impl.rs:51:5
40+
|
41+
LL | fn wrong_bound2<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>);
42+
| ---------------- lifetimes in impl do not match this method in trait
43+
...
44+
LL | fn wrong_bound2(self, b: Inv, c: Inv, d: Inv) {
45+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
3746

3847
error[E0276]: impl has stricter requirements than trait
39-
--> $DIR/regions-bound-missing-bound-in-impl.rs:53:5
48+
--> $DIR/regions-bound-missing-bound-in-impl.rs:58:5
4049
|
4150
LL | fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>);
4251
| ------------------------------------------------------- definition of `another_bound` from trait
4352
...
4453
LL | fn another_bound<'x: 't>(self, x: Inv<'x>, y: Inv<'t>) {
4554
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'x: 't`
4655

47-
error: aborting due to 4 previous errors
56+
error: aborting due to 5 previous errors
4857

4958
Some errors occurred: E0195, E0276, E0308.
5059
For more information about an error, try `rustc --explain E0195`.

‎src/test/ui/closure-expected-type/expect-region-supply-region.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ LL | |
3838
LL | | //~^ ERROR borrowed data cannot be stored outside of its closure
3939
LL | | });
4040
| |_____^
41-
note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 42:1
42-
--> $DIR/expect-region-supply-region.rs:42:1
41+
note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 42:30
42+
--> $DIR/expect-region-supply-region.rs:42:30
4343
|
4444
LL | fn expect_bound_supply_named<'x>() {
45-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45+
| ^^
4646

4747
error[E0308]: mismatched types
4848
--> $DIR/expect-region-supply-region.rs:47:33
@@ -52,11 +52,11 @@ LL | closure_expecting_bound(|x: &'x u32| {
5252
|
5353
= note: expected type `&u32`
5454
found type `&'x u32`
55-
note: the lifetime 'x as defined on the function body at 42:1...
56-
--> $DIR/expect-region-supply-region.rs:42:1
55+
note: the lifetime 'x as defined on the function body at 42:30...
56+
--> $DIR/expect-region-supply-region.rs:42:30
5757
|
5858
LL | fn expect_bound_supply_named<'x>() {
59-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59+
| ^^
6060
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 47:29
6161
--> $DIR/expect-region-supply-region.rs:47:29
6262
|

‎src/test/ui/error-codes/E0195.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0195]: lifetime parameters or bounds on method `bar` do not match the trait declaration
2-
--> $DIR/E0195.rs:19:5
2+
--> $DIR/E0195.rs:19:11
33
|
44
LL | fn bar<'a,'b:'a>(x: &'a str, y: &'b str);
5-
| ----------------------------------------- lifetimes in impl do not match this method in trait
5+
| ---------- lifetimes in impl do not match this method in trait
66
...
77
LL | fn bar<'a,'b>(x: &'a str, y: &'b str) { //~ ERROR E0195
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
8+
| ^^^^^^^ lifetimes do not match method in trait
99

1010
error: aborting due to previous error
1111

‎src/test/ui/error-codes/E0478.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ error[E0478]: lifetime bound not satisfied
44
LL | child: Box<Wedding<'kiss> + 'SnowWhite>, //~ ERROR E0478
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 13:1
8-
--> $DIR/E0478.rs:13:1
7+
note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 13:22
8+
--> $DIR/E0478.rs:13:22
99
|
1010
LL | struct Prince<'kiss, 'SnowWhite> {
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12-
note: but lifetime parameter must outlive the lifetime 'kiss as defined on the struct at 13:1
13-
--> $DIR/E0478.rs:13:1
11+
| ^^^^^^^^^^
12+
note: but lifetime parameter must outlive the lifetime 'kiss as defined on the struct at 13:15
13+
--> $DIR/E0478.rs:13:15
1414
|
1515
LL | struct Prince<'kiss, 'SnowWhite> {
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
| ^^^^^
1717

1818
error: aborting due to previous error
1919

‎src/test/ui/impl-trait/region-escape-via-bound.stderr

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
44
LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y>
55
| ^^^^^^^^^^^^^^
66
|
7-
note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 26:1
8-
--> $DIR/region-escape-via-bound.rs:26:1
7+
note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 28:7
8+
--> $DIR/region-escape-via-bound.rs:28:7
99
|
10-
LL | / fn foo(x: Cell<&'x u32>) -> impl Trait<'y>
11-
LL | | //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds [E0700]
12-
LL | | where 'x: 'y
13-
LL | | {
14-
LL | | x
15-
LL | | }
16-
| |_^
10+
LL | where 'x: 'y
11+
| ^^
1712

1813
error: aborting due to previous error
1914

‎src/test/ui/impl-trait/static-return-lifetime-infered.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ LL | self.x.iter().map(|a| a.0)
3030
| |
3131
| ...but this borrow...
3232
|
33-
note: ...can't outlive the lifetime 'a as defined on the method body at 20:5
34-
--> $DIR/static-return-lifetime-infered.rs:20:5
33+
note: ...can't outlive the lifetime 'a as defined on the method body at 20:20
34+
--> $DIR/static-return-lifetime-infered.rs:20:20
3535
|
3636
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38-
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the method body at 20:5
37+
| ^^
38+
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the method body at 20:20
3939
|
4040
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

‎src/test/ui/in-band-lifetimes/impl/dyn-trait.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requiremen
44
LL | static_val(x); //~ ERROR cannot infer
55
| ^
66
|
7-
note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 31:1...
8-
--> $DIR/dyn-trait.rs:31:1
7+
note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 31:26...
8+
--> $DIR/dyn-trait.rs:31:26
99
|
1010
LL | fn with_dyn_debug_static<'a>(x: Box<dyn Debug + 'a>) {
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11+
| ^^
1212
= note: ...so that the expression is assignable:
1313
expected std::boxed::Box<dyn std::fmt::Debug>
1414
found std::boxed::Box<(dyn std::fmt::Debug + 'a)>

‎src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infe
1111
LL | | x
1212
LL | | }
1313
| |_____^
14-
note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 19:5...
15-
--> $DIR/mismatched_trait_impl.rs:19:5
14+
note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 19:32...
15+
--> $DIR/mismatched_trait_impl.rs:19:32
1616
|
1717
LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer
18-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
| ^^
1919
= note: ...so that the method type is compatible with trait:
2020
expected fn(&i32, &'a u32, &u32) -> &'a u32
2121
found fn(&i32, &u32, &u32) -> &u32

‎src/test/ui/issue-27942.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ note: the anonymous lifetime #1 defined on the method body at 15:5...
1111
|
1212
LL | fn select(&self) -> BufferViewHandle<R>;
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14-
note: ...does not necessarily outlive the lifetime 'a as defined on the trait at 13:1
15-
--> $DIR/issue-27942.rs:13:1
14+
note: ...does not necessarily outlive the lifetime 'a as defined on the trait at 13:18
15+
--> $DIR/issue-27942.rs:13:18
1616
|
1717
LL | pub trait Buffer<'a, R: Resources<'a>> {
18-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
| ^^
1919

2020
error[E0308]: mismatched types
2121
--> $DIR/issue-27942.rs:15:5
@@ -25,11 +25,11 @@ LL | fn select(&self) -> BufferViewHandle<R>;
2525
|
2626
= note: expected type `Resources<'_>`
2727
found type `Resources<'a>`
28-
note: the lifetime 'a as defined on the trait at 13:1...
29-
--> $DIR/issue-27942.rs:13:1
28+
note: the lifetime 'a as defined on the trait at 13:18...
29+
--> $DIR/issue-27942.rs:13:18
3030
|
3131
LL | pub trait Buffer<'a, R: Resources<'a>> {
32-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32+
| ^^
3333
note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 15:5
3434
--> $DIR/issue-27942.rs:15:5
3535
|

‎src/test/ui/issue-37884.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ LL | | {
2121
LL | | Some(&mut self.0)
2222
LL | | }
2323
| |_____^
24-
note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:1
25-
--> $DIR/issue-37884.rs:13:1
24+
note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:6
25+
--> $DIR/issue-37884.rs:13:6
2626
|
2727
LL | impl<'a, T: 'a> Iterator for RepeatMut<'a, T> {
28-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
| ^^
2929

3030
error: aborting due to previous error
3131

‎src/test/ui/issue-4335.nll.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ LL | id(Box::new(|| *v))
1313
LL | }
1414
| - borrowed value only lives until here
1515
|
16-
note: borrowed value must be valid for the lifetime 'r as defined on the function body at 15:1...
17-
--> $DIR/issue-4335.rs:15:1
16+
note: borrowed value must be valid for the lifetime 'r as defined on the function body at 15:6...
17+
--> $DIR/issue-4335.rs:15:6
1818
|
1919
LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
20-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
| ^^
2121

2222
error: aborting due to 2 previous errors
2323

‎src/test/ui/issue-46472.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ LL | &mut 4
77
LL | }
88
| - temporary value only lives until here
99
|
10-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:1...
11-
--> $DIR/issue-46472.rs:13:1
10+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8...
11+
--> $DIR/issue-46472.rs:13:8
1212
|
1313
LL | fn bar<'a>() -> &'a mut u32 {
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
| ^^
1515

1616
error[E0597]: borrowed value does not live long enough (Mir)
1717
--> $DIR/issue-46472.rs:14:10
@@ -22,11 +22,11 @@ LL | &mut 4
2222
LL | }
2323
| - temporary value only lives until here
2424
|
25-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:1...
26-
--> $DIR/issue-46472.rs:13:1
25+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8...
26+
--> $DIR/issue-46472.rs:13:8
2727
|
2828
LL | fn bar<'a>() -> &'a mut u32 {
29-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
29+
| ^^
3030

3131
error: aborting due to 2 previous errors
3232

‎src/test/ui/nll/borrowed-universal-error-2.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ LL | //~^ ERROR `v` does not live long enough [E0597]
77
LL | }
88
| - borrowed value only lives until here
99
|
10-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:1...
11-
--> $DIR/borrowed-universal-error-2.rs:14:1
10+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 14:8...
11+
--> $DIR/borrowed-universal-error-2.rs:14:8
1212
|
1313
LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
| ^^
1515

1616
error: aborting due to previous error
1717

‎src/test/ui/nll/borrowed-universal-error.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ LL | //~^ ERROR borrowed value does not live long enough [E0597]
77
LL | }
88
| - temporary value only lives until here
99
|
10-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:1...
11-
--> $DIR/borrowed-universal-error.rs:18:1
10+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:8...
11+
--> $DIR/borrowed-universal-error.rs:18:8
1212
|
1313
LL | fn foo<'a>(x: &'a (u32,)) -> &'a u32 {
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
| ^^
1515

1616
error: aborting due to previous error
1717

‎src/test/ui/nll/issue-31567.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ LL | &s_inner.0
77
LL | }
88
| - borrowed value only lives until here
99
|
10-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:1...
11-
--> $DIR/issue-31567.rs:21:1
10+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:17...
11+
--> $DIR/issue-31567.rs:21:17
1212
|
1313
LL | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 {
14-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14+
| ^^
1515

1616
error: aborting due to previous error
1717

‎src/test/ui/nll/issue-47470.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ LL | &local //~ ERROR `local` does not live long enough
66
LL | }
77
| - borrowed value only lives until here
88
|
9-
note: borrowed value must be valid for the lifetime 'a as defined on the impl at 23:1...
10-
--> $DIR/issue-47470.rs:23:1
9+
note: borrowed value must be valid for the lifetime 'a as defined on the impl at 23:6...
10+
--> $DIR/issue-47470.rs:23:6
1111
|
1212
LL | impl<'a> Bar for Foo<'a> {
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^
13+
| ^^
1414

1515
error: aborting due to previous error
1616

‎src/test/ui/nll/normalization-bounds-error.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` d
44
LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
note: first, the lifetime cannot outlive the lifetime 'd as defined on the function body at 23:1...
8-
--> $DIR/normalization-bounds-error.rs:23:1
7+
note: first, the lifetime cannot outlive the lifetime 'd as defined on the function body at 23:14...
8+
--> $DIR/normalization-bounds-error.rs:23:14
99
|
1010
LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12-
note: ...but the lifetime must also be valid for the lifetime 'a as defined on the function body at 23:1...
13-
--> $DIR/normalization-bounds-error.rs:23:1
11+
| ^^
12+
note: ...but the lifetime must also be valid for the lifetime 'a as defined on the function body at 23:18...
13+
--> $DIR/normalization-bounds-error.rs:23:18
1414
|
1515
LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {}
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
| ^^
1717
= note: ...so that the types are compatible:
1818
expected Visitor<'d>
1919
found Visitor<'_>

‎src/test/ui/nll/trait-associated-constant.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ LL | const AC: Option<&'c str> = None;
66
|
77
= note: expected type `std::option::Option<&'b str>`
88
found type `std::option::Option<&'c str>`
9-
note: the lifetime 'c as defined on the impl at 30:1...
10-
--> $DIR/trait-associated-constant.rs:30:1
9+
note: the lifetime 'c as defined on the impl at 30:18...
10+
--> $DIR/trait-associated-constant.rs:30:18
1111
|
1212
LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 {
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14-
note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 30:1
15-
--> $DIR/trait-associated-constant.rs:30:1
13+
| ^^
14+
note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 30:14
15+
--> $DIR/trait-associated-constant.rs:30:14
1616
|
1717
LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 {
18-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
| ^^
1919

2020
error[E0308]: mismatched types
2121
--> $DIR/trait-associated-constant.rs:38:5
@@ -25,16 +25,16 @@ LL | const AC: Option<&'a str> = None;
2525
|
2626
= note: expected type `std::option::Option<&'b str>`
2727
found type `std::option::Option<&'a str>`
28-
note: the lifetime 'a as defined on the impl at 37:1...
29-
--> $DIR/trait-associated-constant.rs:37:1
28+
note: the lifetime 'a as defined on the impl at 37:6...
29+
--> $DIR/trait-associated-constant.rs:37:6
3030
|
3131
LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 {
32-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33-
note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 37:1
34-
--> $DIR/trait-associated-constant.rs:37:1
32+
| ^^
33+
note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 37:14
34+
--> $DIR/trait-associated-constant.rs:37:14
3535
|
3636
LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 {
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37+
| ^^
3838

3939
error: aborting due to 2 previous errors
4040

‎src/test/ui/region-borrow-params-issue-29793-small.nll.stderr

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x
4343
LL | };
4444
| - borrowed value only lives until here
4545
|
46-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 64:5...
47-
--> $DIR/region-borrow-params-issue-29793-small.rs:64:5
46+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 64:10...
47+
--> $DIR/region-borrow-params-issue-29793-small.rs:64:10
4848
|
4949
LL | fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
50-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50+
| ^^
5151

5252
error[E0597]: `y` does not live long enough
5353
--> $DIR/region-borrow-params-issue-29793-small.rs:65:17
@@ -58,11 +58,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x
5858
LL | };
5959
| - borrowed value only lives until here
6060
|
61-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 64:5...
62-
--> $DIR/region-borrow-params-issue-29793-small.rs:64:5
61+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 64:10...
62+
--> $DIR/region-borrow-params-issue-29793-small.rs:64:10
6363
|
6464
LL | fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
65-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
65+
| ^^
6666

6767
error[E0597]: `x` does not live long enough
6868
--> $DIR/region-borrow-params-issue-29793-small.rs:76:17
@@ -73,11 +73,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x
7373
LL | };
7474
| - borrowed value only lives until here
7575
|
76-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 75:5...
77-
--> $DIR/region-borrow-params-issue-29793-small.rs:75:5
76+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 75:10...
77+
--> $DIR/region-borrow-params-issue-29793-small.rs:75:10
7878
|
7979
LL | fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
80-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80+
| ^^
8181

8282
error[E0597]: `y` does not live long enough
8383
--> $DIR/region-borrow-params-issue-29793-small.rs:76:17
@@ -88,11 +88,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x
8888
LL | };
8989
| - borrowed value only lives until here
9090
|
91-
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 75:5...
92-
--> $DIR/region-borrow-params-issue-29793-small.rs:75:5
91+
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 75:10...
92+
--> $DIR/region-borrow-params-issue-29793-small.rs:75:10
9393
|
9494
LL | fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
95-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95+
| ^^
9696

9797
error[E0597]: `x` does not live long enough
9898
--> $DIR/region-borrow-params-issue-29793-small.rs:100:21
@@ -103,11 +103,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
103103
LL | }
104104
| - borrowed value only lives until here
105105
|
106-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 99:9...
107-
--> $DIR/region-borrow-params-issue-29793-small.rs:99:9
106+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 99:14...
107+
--> $DIR/region-borrow-params-issue-29793-small.rs:99:14
108108
|
109109
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
110-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110+
| ^^
111111

112112
error[E0597]: `y` does not live long enough
113113
--> $DIR/region-borrow-params-issue-29793-small.rs:100:21
@@ -118,11 +118,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
118118
LL | }
119119
| - borrowed value only lives until here
120120
|
121-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 99:9...
122-
--> $DIR/region-borrow-params-issue-29793-small.rs:99:9
121+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 99:14...
122+
--> $DIR/region-borrow-params-issue-29793-small.rs:99:14
123123
|
124124
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
125-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
125+
| ^^
126126

127127
error[E0597]: `x` does not live long enough
128128
--> $DIR/region-borrow-params-issue-29793-small.rs:114:21
@@ -133,11 +133,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
133133
LL | }
134134
| - borrowed value only lives until here
135135
|
136-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 113:9...
137-
--> $DIR/region-borrow-params-issue-29793-small.rs:113:9
136+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 113:14...
137+
--> $DIR/region-borrow-params-issue-29793-small.rs:113:14
138138
|
139139
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
140-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140+
| ^^
141141

142142
error[E0597]: `y` does not live long enough
143143
--> $DIR/region-borrow-params-issue-29793-small.rs:114:21
@@ -148,11 +148,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
148148
LL | }
149149
| - borrowed value only lives until here
150150
|
151-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 113:9...
152-
--> $DIR/region-borrow-params-issue-29793-small.rs:113:9
151+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 113:14...
152+
--> $DIR/region-borrow-params-issue-29793-small.rs:113:14
153153
|
154154
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
155-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
155+
| ^^
156156

157157
error[E0597]: `x` does not live long enough
158158
--> $DIR/region-borrow-params-issue-29793-small.rs:142:21
@@ -163,11 +163,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
163163
LL | }
164164
| - borrowed value only lives until here
165165
|
166-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 141:9...
167-
--> $DIR/region-borrow-params-issue-29793-small.rs:141:9
166+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 141:14...
167+
--> $DIR/region-borrow-params-issue-29793-small.rs:141:14
168168
|
169169
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
170-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170+
| ^^
171171

172172
error[E0597]: `y` does not live long enough
173173
--> $DIR/region-borrow-params-issue-29793-small.rs:142:21
@@ -178,11 +178,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
178178
LL | }
179179
| - borrowed value only lives until here
180180
|
181-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 141:9...
182-
--> $DIR/region-borrow-params-issue-29793-small.rs:141:9
181+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 141:14...
182+
--> $DIR/region-borrow-params-issue-29793-small.rs:141:14
183183
|
184184
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
185-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
185+
| ^^
186186

187187
error[E0597]: `x` does not live long enough
188188
--> $DIR/region-borrow-params-issue-29793-small.rs:157:21
@@ -193,11 +193,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
193193
LL | }
194194
| - borrowed value only lives until here
195195
|
196-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 156:9...
197-
--> $DIR/region-borrow-params-issue-29793-small.rs:156:9
196+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 156:14...
197+
--> $DIR/region-borrow-params-issue-29793-small.rs:156:14
198198
|
199199
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
200-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
200+
| ^^
201201

202202
error[E0597]: `y` does not live long enough
203203
--> $DIR/region-borrow-params-issue-29793-small.rs:157:21
@@ -208,11 +208,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
208208
LL | }
209209
| - borrowed value only lives until here
210210
|
211-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 156:9...
212-
--> $DIR/region-borrow-params-issue-29793-small.rs:156:9
211+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 156:14...
212+
--> $DIR/region-borrow-params-issue-29793-small.rs:156:14
213213
|
214214
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
215-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
215+
| ^^
216216

217217
error[E0597]: `x` does not live long enough
218218
--> $DIR/region-borrow-params-issue-29793-small.rs:185:21
@@ -223,11 +223,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
223223
LL | }
224224
| - borrowed value only lives until here
225225
|
226-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 184:9...
227-
--> $DIR/region-borrow-params-issue-29793-small.rs:184:9
226+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 184:14...
227+
--> $DIR/region-borrow-params-issue-29793-small.rs:184:14
228228
|
229229
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
230-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230+
| ^^
231231

232232
error[E0597]: `y` does not live long enough
233233
--> $DIR/region-borrow-params-issue-29793-small.rs:185:21
@@ -238,11 +238,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
238238
LL | }
239239
| - borrowed value only lives until here
240240
|
241-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 184:9...
242-
--> $DIR/region-borrow-params-issue-29793-small.rs:184:9
241+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 184:14...
242+
--> $DIR/region-borrow-params-issue-29793-small.rs:184:14
243243
|
244244
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
245-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
245+
| ^^
246246

247247
error[E0597]: `x` does not live long enough
248248
--> $DIR/region-borrow-params-issue-29793-small.rs:199:21
@@ -253,11 +253,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
253253
LL | }
254254
| - borrowed value only lives until here
255255
|
256-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 198:9...
257-
--> $DIR/region-borrow-params-issue-29793-small.rs:198:9
256+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 198:14...
257+
--> $DIR/region-borrow-params-issue-29793-small.rs:198:14
258258
|
259259
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
260-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
260+
| ^^
261261

262262
error[E0597]: `y` does not live long enough
263263
--> $DIR/region-borrow-params-issue-29793-small.rs:199:21
@@ -268,11 +268,11 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo
268268
LL | }
269269
| - borrowed value only lives until here
270270
|
271-
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 198:9...
272-
--> $DIR/region-borrow-params-issue-29793-small.rs:198:9
271+
note: borrowed value must be valid for the lifetime 'a as defined on the method body at 198:14...
272+
--> $DIR/region-borrow-params-issue-29793-small.rs:198:14
273273
|
274274
LL | fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
275-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
275+
| ^^
276276

277277
error: aborting due to 20 previous errors
278278

‎src/test/ui/static-lifetime.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0478]: lifetime bound not satisfied
44
LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound
55
| ^^^^^^^^^
66
|
7-
note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 13:1
8-
--> $DIR/static-lifetime.rs:13:1
7+
note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 13:6
8+
--> $DIR/static-lifetime.rs:13:6
99
|
1010
LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11+
| ^^
1212
= note: but lifetime parameter must outlive the static lifetime
1313

1414
error: aborting due to previous error

0 commit comments

Comments
 (0)
Please sign in to comment.