SHARE
TWEET

Untitled

a guest Jun 19th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5.     println!("{:?}", {
  6.         Some(1u8).iter().chain(Some(2)).collect::<Vec<_>>()
  7.     });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12.    Compiling playground v0.0.1 (/playground)
  13. error[E0271]: type mismatch resolving `<std::option::Option<{integer}> as std::iter::IntoIterator>::Item == &u8`
  14.  --> src/main.rs:6:26
  15.   |
  16. 6 |         Some(1u8).iter().chain(Some(2)).collect::<Vec<_>>()
  17.   |                          ^^^^^ expected integer, found &u8
  18.   |
  19.   = note: expected type `{integer}`
  20.              found type `&u8`
  21.  
  22. error[E0599]: no method named `collect` found for type `std::iter::Chain<std::option::Iter<'_, u8>, std::option::IntoIter<{integer}>>` in the current scope
  23.  --> src/main.rs:6:41
  24.   |
  25. 6 |         Some(1u8).iter().chain(Some(2)).collect::<Vec<_>>()
  26.   |                                         ^^^^^^^
  27.   |
  28.   = note: the method `collect` exists but the following trait bounds were not satisfied:
  29.           `&mut std::iter::Chain<std::option::Iter<'_, u8>, std::option::IntoIter<{integer}>> : std::iter::Iterator`
  30.           `std::iter::Chain<std::option::Iter<'_, u8>, std::option::IntoIter<{integer}>> : std::iter::Iterator`
  31.  
  32. error: aborting due to 2 previous errors
  33.  
  34. Some errors occurred: E0271, E0599.
  35. For more information about an error, try `rustc --explain E0271`.
  36. error: Could not compile `playground`.
  37.  
  38. To learn more, run the command again with --verbose.
  39.  
  40. */
  41.  
  42. /* ~~~~=== stdout ===~~~~
  43.  
  44. */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top