diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-06-27 13:16:47 -0400 |
|---|---|---|
| committer | gaurikholkar <f2013002@goa.bits-pilani.ac.in> | 2017-06-29 06:37:18 -0700 |
| commit | 95409016f8e84a47715526a89929cd22a2f25c16 (patch) | |
| tree | b32493bc82d379db6ff16beb33757d8d6c7d1a1c | |
| parent | aebc4e007493c623aaf69ef04d1a649b74fd5bfb (diff) | |
| download | rust-95409016f8e84a47715526a89929cd22a2f25c16.tar.gz rust-95409016f8e84a47715526a89929cd22a2f25c16.zip | |
remove `fn main() { }` from extended errors
| -rw-r--r-- | src/librustc/diagnostics.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index aa62cab7c3d..035640b9710 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -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 @@ -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 () { } ``` "##, |
