Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- fn foo<A, B>(a: A) -> Option<&B> where for<'b> A: IntoIterator<Item=&'b B> { a.into_iter().last() } let vec = vec![0, 1, 2, 3]; foo(&vec);
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (file:///playground)
- error[E0106]: missing lifetime specifier
- --> src/main.rs:6:38
- |
- 6 | fn foo<A, B>(a: A) -> Option<&B> where for<'b> A: IntoIterator<Item=&'b B> { a.into_iter().last() } let vec = vec![0, 1, 2, 3]; foo(&vec);
- | ^ expected lifetime parameter
- |
- = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments
- = help: consider giving it an explicit bounded or 'static lifetime
- error[E0582]: binding for associated type `Item` references lifetime `'b`, which does not appear in the trait input types
- --> src/main.rs:6:72
- |
- 6 | fn foo<A, B>(a: A) -> Option<&B> where for<'b> A: IntoIterator<Item=&'b B> { a.into_iter().last() } let vec = vec![0, 1, 2, 3]; foo(&vec);
- | ^^^^^^^^^^
- error: aborting due to 2 previous errors
- Some errors occurred: E0106, E0582.
- For more information about an error, try `rustc --explain E0106`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Add Comment
Please, Sign In to add comment