]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #55173 - estebank:suggest-static, r=oli-obk
authorPietro Albini <pietro@pietroalbini.org>
Thu, 25 Oct 2018 12:31:03 +0000 (14:31 +0200)
committerGitHub <noreply@github.com>
Thu, 25 Oct 2018 12:31:03 +0000 (14:31 +0200)
Suggest appropriate syntax on missing lifetime specifier in return type

Suggest using `'static` when a lifetime is missing in the return type
with a structured suggestion instead of a note.

Fix #55170.

1  2 
src/librustc/hir/lowering.rs
src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr

Simple merge
index bccecd60e1c9e39f38d85466c6e408bc54a68996,4319843291a2077a6aaf8051ff0026924f03b937..e56d008d2665f9e6a06b442ea89839584d026569
@@@ -17,16 -17,21 +17,15 @@@ LL | struct Baz<'a>(&'_ &'a u8); //~ ER
     |                 ^^ expected lifetime parameter
  
  error[E0106]: missing lifetime specifier
 -  --> $DIR/underscore-lifetime-binders.rs:14:10
 -   |
 -LL | impl Foo<'_> { //~ ERROR missing lifetime specifier
 -   |          ^^ expected lifetime parameter
 -
 -error[E0106]: missing lifetime specifier
 -  --> $DIR/underscore-lifetime-binders.rs:24:29
 +  --> $DIR/underscore-lifetime-binders.rs:20:29
     |
  LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here
-    |                             ^^ expected lifetime parameter
+    |                             ^^ help: consider giving it a 'static lifetime: `'static`
     |
     = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
-    = help: consider giving it a 'static lifetime
  
  error[E0106]: missing lifetime specifier
 -  --> $DIR/underscore-lifetime-binders.rs:30:35
 +  --> $DIR/underscore-lifetime-binders.rs:26:35
     |
  LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier
     |                                   ^^ expected lifetime parameter