Created
September 22, 2019 13:26
-
-
Save rust-play/86e29ba09024fe31426a2741e3d7f658 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct A { | |
a : i32, | |
} | |
impl A { | |
fn bind_lifetime_mut(&mut self) -> &i32 { | |
return &self.a; | |
} | |
fn legal(&mut self) -> &i32 { | |
self.bind_lifetime_mut(); | |
return self.bind_lifetime_mut(); | |
} | |
fn not_legal(&mut self) -> &i32 { | |
let test_ret = self.bind_lifetime_mut(); | |
if *test_ret == 1 { | |
return test_ret; | |
} | |
return self.bind_lifetime_mut() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment