Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- let str = String::new(); let split = str.split(' '); let (a, b, c) = (split.next(), split.next(), split.next()); (a, b, c)
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0597]: `str` does not live long enough
- --> src/main.rs:6:46
- |
- 5 | println!("{:?}", {
- | ______________________-
- 6 | | let str = String::new(); let split = str.split(' '); let (a, b, c) = (split.next(), split.next(), split.next()); (a, b, c)
- | | ^^^ borrowed value does not live long enough
- 7 | | });
- | | -
- | | |
- | |_____`str` dropped here while still borrowed
- | borrow later used here
- error[E0596]: cannot borrow `split` as mutable, as it is not declared as mutable
- --> src/main.rs:6:79
- |
- 6 | let str = String::new(); let split = str.split(' '); let (a, b, c) = (split.next(), split.next(), split.next()); (a, b, c)
- | ----- ^^^^^ cannot borrow as mutable
- | |
- | help: consider changing this to be mutable: `mut split`
- error[E0596]: cannot borrow `split` as mutable, as it is not declared as mutable
- --> src/main.rs:6:93
- |
- 6 | let str = String::new(); let split = str.split(' '); let (a, b, c) = (split.next(), split.next(), split.next()); (a, b, c)
- | ----- ^^^^^ cannot borrow as mutable
- | |
- | help: consider changing this to be mutable: `mut split`
- error[E0596]: cannot borrow `split` as mutable, as it is not declared as mutable
- --> src/main.rs:6:107
- |
- 6 | let str = String::new(); let split = str.split(' '); let (a, b, c) = (split.next(), split.next(), split.next()); (a, b, c)
- | ----- help: consider changing this to be mutable: `mut split` ^^^^^ cannot borrow as mutable
- error: aborting due to 4 previous errors
- Some errors occurred: E0596, E0597.
- For more information about an error, try `rustc --explain E0596`.
- 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