mirror of https://github.com/rust-lang/book
15 lines
630 B
Plaintext
15 lines
630 B
Plaintext
$ cargo run
|
|
Compiling chapter10 v0.1.0 (file:///projects/chapter10)
|
|
error[E0597]: `string2` does not live long enough
|
|
--> src/main.rs:6:44
|
|
|
|
|
6 | result = longest(string1.as_str(), string2.as_str());
|
|
| ^^^^^^^ borrowed value does not live long enough
|
|
7 | }
|
|
| - `string2` dropped here while still borrowed
|
|
8 | println!("The longest string is {}", result);
|
|
| ------ borrow later used here
|
|
|
|
For more information about this error, try `rustc --explain E0597`.
|
|
error: could not compile `chapter10` due to previous error
|