Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- fn foo<'a>(strings: &'a (&'a String, &'a String)) -> &'a (&'a str, &'a str) { &(&strings.0, &strings.1) } // and you can't do this.
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error[E0515]: cannot return reference to temporary value
- --> src/main.rs:6:87
- |
- 6 | fn foo<'a>(strings: &'a (&'a String, &'a String)) -> &'a (&'a str, &'a str) { &(&strings.0, &strings.1) } // and you can't do this.
- | ^------------------------
- | ||
- | |temporary value created here
- | returns a reference to data owned by the current function
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0515`.
- 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