Skip to content

Commit

Permalink
remove fn main() { } from extended errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis authored and gaurikholkar committed Jun 29, 2017
1 parent aebc4e0 commit 9540901
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/librustc/diagnostics.rs
Expand Up @@ -1963,8 +1963,6 @@ fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { // explicit lifetime required
// in the type of `y`
if x > y { x } else { y }
}
fn main () { }
```
Here, the function is returning data borrowed from either x or y, but the
Expand All @@ -1975,16 +1973,14 @@ the signature match the body by changing the type of y to &'a i32, like so:
fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
if x > y { x } else { y }
}
fn main () { }
```
Alternatively, you could change the body not to return data from y:
```
fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
x
}
fn main () { }
```
"##,

Expand Down

0 comments on commit 9540901

Please sign in to comment.