Guest User

Untitled

a guest
Jun 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. use ::std::borrow::Cow; fn check<'a, T: Into<Cow<'a, Vec<i32>>>>(owned_or_borrowed: T) -> Vec<i32> { owned_or_borrowed.into().into_owned() } check(&[])
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0277]: the trait bound `std::borrow::Cow<'_, std::vec::Vec<i32>>: std::convert::From<&[_; 0]>` is not satisfied
  11. --> src/main.rs:5:150
  12. |
  13. 5 | use ::std::borrow::Cow; fn check<'a, T: Into<Cow<'a, Vec<i32>>>>(owned_or_borrowed: T) -> Vec<i32> { owned_or_borrowed.into().into_owned() } check(&[])
  14. | ^^^^^ the trait `std::convert::From<&[_; 0]>` is not implemented for `std::borrow::Cow<'_, std::vec::Vec<i32>>`
  15. |
  16. = help: the following implementations were found:
  17. <std::borrow::Cow<'a, std::path::Path> as std::convert::From<std::path::PathBuf>>
  18. <std::borrow::Cow<'a, std::path::Path> as std::convert::From<&'a std::path::Path>>
  19. <std::borrow::Cow<'a, str> as std::convert::From<std::string::String>>
  20. <std::borrow::Cow<'a, [T]> as std::convert::From<std::vec::Vec<T>>>
  21. and 2 others
  22. = note: required because of the requirements on the impl of `std::convert::Into<std::borrow::Cow<'_, std::vec::Vec<i32>>>` for `&[_; 0]`
  23. note: required by `main::check`
  24. --> src/main.rs:5:33
  25. |
  26. 5 | use ::std::borrow::Cow; fn check<'a, T: Into<Cow<'a, Vec<i32>>>>(owned_or_borrowed: T) -> Vec<i32> { owned_or_borrowed.into().into_owned() } check(&[])
  27. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  28.  
  29. error: aborting due to previous error
  30.  
  31. For more information about this error, try `rustc --explain E0277`.
  32. error: Could not compile `playground`.
  33.  
  34. To learn more, run the command again with --verbose.
  35.  
  36. */
  37.  
  38. /* ~~~~=== stdout ===~~~~
  39.  
  40. */
Add Comment
Please, Sign In to add comment