Skip to content

Commit

Permalink
[review comments] modify test and clean up code
Browse files Browse the repository at this point in the history
Co-Authored-By: estebank <esteban@kuber.com.ar>
  • Loading branch information
oli-obk and estebank committed Oct 22, 2018
1 parent d0bd69a commit dd91c8f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
fn suggest_lifetime(&self, db: &mut DiagnosticBuilder<'_>, span: Span, msg: &str) -> bool {
match self.tcx.sess.source_map().span_to_snippet(span) {
Ok(ref snippet) => {
let (sugg, applicability) = if &snippet[..] == "&" {
let (sugg, applicability) = if snippet == "&" {
("&'static ".to_owned(), Applicability::MachineApplicable)
} else if snippet == "'_" {
("'static".to_owned(), Applicability::MachineApplicable)
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ use std::error::Error;
fn foo() -> impl Future<Item=(), Error=Box<Error>> {
Ok(())
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
error[E0601]: `main` function not found in crate `lifetime_elision_return_type_trait`
|
= note: consider adding a `main` function to `$DIR/lifetime-elision-return-type-trait.rs`

error[E0106]: missing lifetime specifier
--> $DIR/lifetime-elision-return-type-trait.rs:8:44
|
Expand All @@ -10,7 +6,6 @@ LL | fn foo() -> impl Future<Item=(), Error=Box<Error>> {
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors occurred: E0106, E0601.
For more information about an error, try `rustc --explain E0106`.
For more information about this error, try `rustc --explain E0106`.

0 comments on commit dd91c8f

Please sign in to comment.