Created
July 16, 2019 19:48
-
-
Save rust-play/ed81a8d30c7544eb7227897c49d60b5a to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains 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
#![allow(unreachable_code)] | |
fn main() { | |
println!("{:?}", { | |
{ let a = [1,2,3]; a.get(10..) } | |
}); | |
} | |
/* ~~~~=== stderr ===~~~~ | |
Compiling playground v0.0.1 (/playground) | |
error[E0597]: `a` does not live long enough | |
--> src/main.rs:6:29 | |
| | |
5 | println!("{:?}", { | |
| ______________________- | |
6 | | { let a = [1,2,3]; a.get(10..) } | |
| | ^ - `a` dropped here while still borrowed | |
| | | | |
| | borrowed value does not live long enough | |
7 | | }); | |
| |_____- borrow later used here | |
error: aborting due to previous error | |
For more information about this error, try `rustc --explain E0597`. | |
error: Could not compile `playground`. | |
To learn more, run the command again with --verbose. | |
*/ | |
/* ~~~~=== stdout ===~~~~ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment