about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-06-27 16:44:39 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-06-28 11:12:43 -0700
commit3005162f98c1b9a4d57f6a7b3d5c3fe55de01c21 (patch)
tree4e2e7dec716fb4b89a49aeeb2fefcddc8127d875
parent5436a5c55ac6b08bd0bb729b7da55915e6e78fe6 (diff)
downloadrust-3005162f98c1b9a4d57f6a7b3d5c3fe55de01c21.tar.gz
rust-3005162f98c1b9a4d57f6a7b3d5c3fe55de01c21.zip
Extend support to `get_generics` for all `NodeItem`s
-rw-r--r--src/librustc/hir/map/mod.rs9
-rw-r--r--src/test/ui/associated-const-impl-wrong-lifetime.stderr6
-rw-r--r--src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr4
-rw-r--r--src/test/ui/error-codes/E0478.stderr12
-rw-r--r--src/test/ui/issue-27942.stderr12
-rw-r--r--src/test/ui/issue-37884.stderr6
-rw-r--r--src/test/ui/nll/issue-47470.stderr6
-rw-r--r--src/test/ui/nll/trait-associated-constant.stderr24
-rw-r--r--src/test/ui/region-borrow-params-issue-29793-small.nll.stderr96
-rw-r--r--src/test/ui/static-lifetime.stderr6
10 files changed, 94 insertions, 87 deletions
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index 33cae96dd07..dbf99cf30e5 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -671,7 +671,14 @@ impl<'hir> Map<'hir> {
                 NodeTraitItem(ref trait_item) => Some(&trait_item.generics),
                 NodeItem(ref item) => {
                     match item.node {
-                        ItemFn(_, _, ref generics, _) => Some(generics),
+                        ItemFn(_, _, ref generics, _) |
+                        ItemTy(_, ref generics) |
+                        ItemEnum(_, ref generics) |
+                        ItemStruct(_, ref generics) |
+                        ItemUnion(_, ref generics) |
+                        ItemTrait(_, _, ref generics, ..) |
+                        ItemTraitAlias(ref generics, _) |
+                        ItemImpl(_, _, _, ref generics, ..) => Some(generics),
                         _ => None,
                     }
                 }
diff --git a/src/test/ui/associated-const-impl-wrong-lifetime.stderr b/src/test/ui/associated-const-impl-wrong-lifetime.stderr
index d800f4c727d..f8375899e3e 100644
--- a/src/test/ui/associated-const-impl-wrong-lifetime.stderr
+++ b/src/test/ui/associated-const-impl-wrong-lifetime.stderr
@@ -6,11 +6,11 @@ LL |     const NAME: &'a str = "unit";
    |
    = note: expected type `&'static str`
               found type `&'a str`
-note: the lifetime 'a as defined on the impl at 17:1...
-  --> $DIR/associated-const-impl-wrong-lifetime.rs:17:1
+note: the lifetime 'a as defined on the impl at 17:6...
+  --> $DIR/associated-const-impl-wrong-lifetime.rs:17:6
    |
 LL | impl<'a> Foo for &'a () {
-   | ^^^^^^^^^^^^^^^^^^^^^^^
+   |      ^^
    = note: ...does not necessarily outlive the static lifetime
 
 error: aborting due to previous error
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 deab39b9924..86dad34586d 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
@@ -55,7 +55,7 @@ LL |     fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0195]: lifetime parameters or bounds on method `wrong_bound2` do not match the trait declaration
-  --> $DIR/regions-bound-missing-bound-in-impl.rs:51:5
+  --> $DIR/regions-bound-missing-bound-in-impl.rs:52:5
    |
 LL |     fn wrong_bound2<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>);
    |                    ---------------- lifetimes in impl do not match this method in trait
@@ -64,7 +64,7 @@ LL |     fn wrong_bound2(self, b: Inv, c: Inv, d: Inv) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait
 
 error[E0276]: impl has stricter requirements than trait
-  --> $DIR/regions-bound-missing-bound-in-impl.rs:58:5
+  --> $DIR/regions-bound-missing-bound-in-impl.rs:59:5
    |
 LL |     fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>);
    |     ------------------------------------------------------- definition of `another_bound` from trait
diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr
index 44d8151303f..0e778908058 100644
--- a/src/test/ui/error-codes/E0478.stderr
+++ b/src/test/ui/error-codes/E0478.stderr
@@ -4,16 +4,16 @@ error[E0478]: lifetime bound not satisfied
 LL |     child: Box<Wedding<'kiss> + 'SnowWhite>, //~ ERROR E0478
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 13:1
-  --> $DIR/E0478.rs:13:1
+note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 13:22
+  --> $DIR/E0478.rs:13:22
    |
 LL | struct Prince<'kiss, 'SnowWhite> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: but lifetime parameter must outlive the lifetime 'kiss as defined on the struct at 13:1
-  --> $DIR/E0478.rs:13:1
+   |                      ^^^^^^^^^^
+note: but lifetime parameter must outlive the lifetime 'kiss as defined on the struct at 13:15
+  --> $DIR/E0478.rs:13:15
    |
 LL | struct Prince<'kiss, 'SnowWhite> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |               ^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issue-27942.stderr b/src/test/ui/issue-27942.stderr
index 879eda0f856..5e2ecbb05ae 100644
--- a/src/test/ui/issue-27942.stderr
+++ b/src/test/ui/issue-27942.stderr
@@ -11,11 +11,11 @@ note: the anonymous lifetime #1 defined on the method body at 15:5...
    |
 LL |     fn select(&self) -> BufferViewHandle<R>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...does not necessarily outlive the lifetime 'a as defined on the trait at 13:1
-  --> $DIR/issue-27942.rs:13:1
+note: ...does not necessarily outlive the lifetime 'a as defined on the trait at 13:18
+  --> $DIR/issue-27942.rs:13:18
    |
 LL | pub trait Buffer<'a, R: Resources<'a>> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                  ^^
 
 error[E0308]: mismatched types
   --> $DIR/issue-27942.rs:15:5
@@ -25,11 +25,11 @@ LL |     fn select(&self) -> BufferViewHandle<R>;
    |
    = note: expected type `Resources<'_>`
               found type `Resources<'a>`
-note: the lifetime 'a as defined on the trait at 13:1...
-  --> $DIR/issue-27942.rs:13:1
+note: the lifetime 'a as defined on the trait at 13:18...
+  --> $DIR/issue-27942.rs:13:18
    |
 LL | pub trait Buffer<'a, R: Resources<'a>> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                  ^^
 note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 15:5
   --> $DIR/issue-27942.rs:15:5
    |
diff --git a/src/test/ui/issue-37884.stderr b/src/test/ui/issue-37884.stderr
index 73fbb2d3203..f01b623aced 100644
--- a/src/test/ui/issue-37884.stderr
+++ b/src/test/ui/issue-37884.stderr
@@ -21,11 +21,11 @@ LL | |     {
 LL | |         Some(&mut self.0)
 LL | |     }
    | |_____^
-note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:1
-  --> $DIR/issue-37884.rs:13:1
+note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:6
+  --> $DIR/issue-37884.rs:13:6
    |
 LL | impl<'a, T: 'a> Iterator for RepeatMut<'a, T> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |      ^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/issue-47470.stderr b/src/test/ui/nll/issue-47470.stderr
index f84a68d85b9..a89e186540a 100644
--- a/src/test/ui/nll/issue-47470.stderr
+++ b/src/test/ui/nll/issue-47470.stderr
@@ -6,11 +6,11 @@ LL |         &local //~ ERROR `local` does not live long enough
 LL |     }
    |     - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the impl at 23:1...
-  --> $DIR/issue-47470.rs:23:1
+note: borrowed value must be valid for the lifetime 'a as defined on the impl at 23:6...
+  --> $DIR/issue-47470.rs:23:6
    |
 LL | impl<'a> Bar for Foo<'a> {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^
+   |      ^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/nll/trait-associated-constant.stderr b/src/test/ui/nll/trait-associated-constant.stderr
index 2c3fd091f9a..07972ecced3 100644
--- a/src/test/ui/nll/trait-associated-constant.stderr
+++ b/src/test/ui/nll/trait-associated-constant.stderr
@@ -6,16 +6,16 @@ LL |     const AC: Option<&'c str> = None;
    |
    = note: expected type `std::option::Option<&'b str>`
               found type `std::option::Option<&'c str>`
-note: the lifetime 'c as defined on the impl at 30:1...
-  --> $DIR/trait-associated-constant.rs:30:1
+note: the lifetime 'c as defined on the impl at 30:18...
+  --> $DIR/trait-associated-constant.rs:30:18
    |
 LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 30:1
-  --> $DIR/trait-associated-constant.rs:30:1
+   |                  ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 30:14
+  --> $DIR/trait-associated-constant.rs:30:14
    |
 LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0308]: mismatched types
   --> $DIR/trait-associated-constant.rs:38:5
@@ -25,16 +25,16 @@ LL |     const AC: Option<&'a str> = None;
    |
    = note: expected type `std::option::Option<&'b str>`
               found type `std::option::Option<&'a str>`
-note: the lifetime 'a as defined on the impl at 37:1...
-  --> $DIR/trait-associated-constant.rs:37:1
+note: the lifetime 'a as defined on the impl at 37:6...
+  --> $DIR/trait-associated-constant.rs:37:6
    |
 LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 37:1
-  --> $DIR/trait-associated-constant.rs:37:1
+   |      ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 37:14
+  --> $DIR/trait-associated-constant.rs:37:14
    |
 LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/region-borrow-params-issue-29793-small.nll.stderr b/src/test/ui/region-borrow-params-issue-29793-small.nll.stderr
index 1a53c033baa..443af08e1cc 100644
--- a/src/test/ui/region-borrow-params-issue-29793-small.nll.stderr
+++ b/src/test/ui/region-borrow-params-issue-29793-small.nll.stderr
@@ -43,11 +43,11 @@ LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x
 LL |     };
    |     - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 64:5...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:64:5
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 64:10...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:64:10
    |
 LL |     fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |          ^^
 
 error[E0597]: `y` does not live long enough
   --> $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
 LL |     };
    |     - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 64:5...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:64:5
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 64:10...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:64:10
    |
 LL |     fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |          ^^
 
 error[E0597]: `x` does not live long enough
   --> $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
 LL |     };
    |     - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 75:5...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:75:5
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 75:10...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:75:10
    |
 LL |     fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |          ^^
 
 error[E0597]: `y` does not live long enough
   --> $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
 LL |     };
    |     - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the function body at 75:5...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:75:5
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 75:10...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:75:10
    |
 LL |     fn g<'a>(x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |          ^^
 
 error[E0597]: `x` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 99:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:99:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 99:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:99:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `y` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 99:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:99:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 99:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:99:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `x` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 113:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:113:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 113:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:113:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `y` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 113:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:113:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 113:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:113:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `x` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 141:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:141:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 141:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:141:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `y` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 141:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:141:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 141:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:141:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `x` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 156:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:156:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 156:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:156:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `y` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 156:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:156:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 156:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:156:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `x` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 184:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:184:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 184:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:184:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `y` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 184:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:184:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 184:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:184:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `x` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 198:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:198:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 198:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:198:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error[E0597]: `y` does not live long enough
   --> $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
 LL |         }
    |         - borrowed value only lives until here
    |
-note: borrowed value must be valid for the lifetime 'a as defined on the method body at 198:9...
-  --> $DIR/region-borrow-params-issue-29793-small.rs:198:9
+note: borrowed value must be valid for the lifetime 'a as defined on the method body at 198:14...
+  --> $DIR/region-borrow-params-issue-29793-small.rs:198:14
    |
 LL |         fn g<'a>(&self, x: usize, y:usize) -> Box<Fn(bool) -> usize + 'a> {
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |              ^^
 
 error: aborting due to 20 previous errors
 
diff --git a/src/test/ui/static-lifetime.stderr b/src/test/ui/static-lifetime.stderr
index 4fe4e569df9..c38b8a96f9f 100644
--- a/src/test/ui/static-lifetime.stderr
+++ b/src/test/ui/static-lifetime.stderr
@@ -4,11 +4,11 @@ error[E0478]: lifetime bound not satisfied
 LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound
    |                    ^^^^^^^^^
    |
-note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 13:1
-  --> $DIR/static-lifetime.rs:13:1
+note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 13:6
+  --> $DIR/static-lifetime.rs:13:6
    |
 LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |      ^^
    = note: but lifetime parameter must outlive the static lifetime
 
 error: aborting due to previous error