Guest User

Untitled

a guest
Jun 14th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. let s = "今日は"; let n = 2; let (c, i) = s.char_indices().nth(n).unwrap(); &s[0..(i + c.len_utf8())]
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0599]: no method named `len_utf8` found for type `usize` in the current scope
  11. --> src/main.rs:5:95
  12. |
  13. 5 | let s = "今日は"; let n = 2; let (c, i) = s.char_indices().nth(n).unwrap(); &s[0..(i + c.len_utf8())]
  14. | ^^^^^^^^
  15.  
  16. error[E0369]: binary operation `+` cannot be applied to type `char`
  17. --> src/main.rs:5:88
  18. |
  19. 5 | let s = "今日は"; let n = 2; let (c, i) = s.char_indices().nth(n).unwrap(); &s[0..(i + c.len_utf8())]
  20. | ^^^^^^^^^^^^^^^^^^
  21. |
  22. = note: an implementation of `std::ops::Add` might be missing for `char`
  23.  
  24. error: aborting due to 2 previous errors
  25.  
  26. Some errors occurred: E0369, E0599.
  27. For more information about an error, try `rustc --explain E0369`.
  28. error: Could not compile `playground`.
  29.  
  30. To learn more, run the command again with --verbose.
  31.  
  32. */
  33.  
  34. /* ~~~~=== stdout ===~~~~
  35.  
  36. */
Add Comment
Please, Sign In to add comment