Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5. println!("{:?}", {
  6. use std::fs::OpenOptions; use std::io::Write; use std::os::unix::fs::OpenOptions; let f = OpenOptions::new().write(true).truncate(true).create(true).mode(0x755).open("foo").unwrap(); f.write(&[0]).unwrap();
  7. });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12. Compiling playground v0.0.1 (/playground)
  13. error[E0603]: struct `OpenOptions` is private
  14. --> src/main.rs:6:78
  15. |
  16. 6 | use std::fs::OpenOptions; use std::io::Write; use std::os::unix::fs::OpenOptions; let f = OpenOptions::new().write(true).truncate(true).create(true).mode(0x755).open("foo").unwrap(); f.write(&[0]).unwrap();
  17. | ^^^^^^^^^^^
  18.  
  19. warning: unused import: `std::os::unix::fs::OpenOptions`
  20. --> src/main.rs:6:59
  21. |
  22. 6 | use std::fs::OpenOptions; use std::io::Write; use std::os::unix::fs::OpenOptions; let f = OpenOptions::new().write(true).truncate(true).create(true).mode(0x755).open("foo").unwrap(); f.write(&[0]).unwrap();
  23. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  24. |
  25. = note: #[warn(unused_imports)] on by default
  26.  
  27. error[E0599]: no method named `mode` found for type `&mut std::fs::OpenOptions` in the current scope
  28. --> src/main.rs:6:158
  29. |
  30. 6 | use std::fs::OpenOptions; use std::io::Write; use std::os::unix::fs::OpenOptions; let f = OpenOptions::new().write(true).truncate(true).create(true).mode(0x755).open("foo").unwrap(); f.write(&[0]).unwrap();
  31. | ^^^^
  32. |
  33. = help: items from traits can only be used if the trait is in scope
  34. help: the following trait is implemented but not in scope, perhaps add a `use` for it:
  35. |
  36. 4 | use std::os::unix::fs::OpenOptionsExt;
  37. |
  38.  
  39. warning: unused import: `std::io::Write`
  40. --> src/main.rs:6:39
  41. |
  42. 6 | use std::fs::OpenOptions; use std::io::Write; use std::os::unix::fs::OpenOptions; let f = OpenOptions::new().write(true).truncate(true).create(true).mode(0x755).open("foo").unwrap(); f.write(&[0]).unwrap();
  43. | ^^^^^^^^^^^^^^
  44.  
  45. error: aborting due to 2 previous errors
  46.  
  47. Some errors occurred: E0599, E0603.
  48. For more information about an error, try `rustc --explain E0599`.
  49. error: Could not compile `playground`.
  50.  
  51. To learn more, run the command again with --verbose.
  52.  
  53. */
  54.  
  55. /* ~~~~=== stdout ===~~~~
  56.  
  57. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement