Guest User

Untitled

a guest
Jun 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. fn foo(a: u32) -> u32 { a } let mut m = std::collections::HashMap::new(); m.insert(0, foo); m[0](42)
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0308]: mismatched types
  11. --> src/main.rs:5:103
  12. |
  13. 5 | fn foo(a: u32) -> u32 { a } let mut m = std::collections::HashMap::new(); m.insert(0, foo); m[0](42)
  14. | ^
  15. | |
  16. | expected &{integer}, found integral variable
  17. | help: consider borrowing here: `&0`
  18. |
  19. = note: expected type `&{integer}`
  20. found type `{integer}`
  21.  
  22. error: aborting due to previous error
  23.  
  24. For more information about this error, try `rustc --explain E0308`.
  25. error: Could not compile `playground`.
  26.  
  27. To learn more, run the command again with --verbose.
  28.  
  29. */
  30.  
  31. /* ~~~~=== stdout ===~~~~
  32.  
  33. */
Add Comment
Please, Sign In to add comment