Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- let a = [1u8, 2, 3]; &a[3..]
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0597]: `a` does not live long enough
- --> src/main.rs:6:31
- |
- 5 | println!("{:?}", {
- | ______________________-
- 6 | | let a = [1u8, 2, 3]; &a[3..]
- | | ^ borrowed value does not live long enough
- 7 | | });
- | | -
- | | |
- | |_____`a` dropped here while still borrowed
- | 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 ===~~~~
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement