Skip to content

Commit

Permalink
Remove primary label for more readable output
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jun 8, 2018
1 parent 82d3a49 commit 6be16ba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
let return_sp = sub_origin.span();
let mut err = self.tcx.sess.struct_span_err(
sp,
"can't infer an appropriate lifetime",
"cannot infer an appropriate lifetime",
);
err.span_label(sp, "can't infer an appropriate lifetime");
err.span_label(
return_sp,
"this return type evaluates to the `'static` lifetime...",
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/impl-trait/static-return-lifetime-infered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ impl A {
fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
self.x.iter().map(|a| a.0)
}
//~^^^ ERROR can't infer an appropriate lifetime
//~^^ ERROR cannot infer an appropriate lifetime
fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
self.x.iter().map(|a| a.0)
}
//~^^^ ERROR can't infer an appropriate lifetime
//~^^ ERROR cannot infer an appropriate lifetime
}

fn main() {}
8 changes: 4 additions & 4 deletions src/test/ui/impl-trait/static-return-lifetime-infered.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: can't infer an appropriate lifetime
error: cannot infer an appropriate lifetime
--> $DIR/static-return-lifetime-infered.rs:17:16
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| ----------------------- this return type evaluates to the `'static` lifetime...
LL | self.x.iter().map(|a| a.0)
| ------ ^^^^ can't infer an appropriate lifetime
| ------ ^^^^
| |
| ...but this borrow...
|
Expand All @@ -20,13 +20,13 @@ help: you can add a constraint to the return type to make it last less than `'st
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: can't infer an appropriate lifetime
error: cannot infer an appropriate lifetime
--> $DIR/static-return-lifetime-infered.rs:21:16
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| ----------------------- this return type evaluates to the `'static` lifetime...
LL | self.x.iter().map(|a| a.0)
| ------ ^^^^ can't infer an appropriate lifetime
| ------ ^^^^
| |
| ...but this borrow...
|
Expand Down

0 comments on commit 6be16ba

Please sign in to comment.