Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io::FileStat needs to be less platform-dependent #10130

Closed
alexcrichton opened this issue Oct 28, 2013 · 1 comment
Closed

io::FileStat needs to be less platform-dependent #10130

alexcrichton opened this issue Oct 28, 2013 · 1 comment

Comments

@alexcrichton
Copy link
Member

Right now there's a few bits of FileStat which should get massaged:

  • mode needs to fit with the general solution of file permissions used in file I/O. I'm prototyping something right now, but I"m not happy how it's turning up. Regardless, the second argument to mkdir should be the same type as this field.
  • created/modified/accessed - The documentation says that they're platform dependent. They're supposed to not be.
  • inode/device - Are these really platform independent? If so, I don't know much about them and it would be nice to have some documentation
  • is_dir/is_file - why are these explicit? What about pipes, sockets, links, etc.

Nominating for backcompat-libs 1.0 - it'd be a little embarassing to ship with this.

@alexcrichton
Copy link
Member Author

Un-nominating, parenting to a nominated metabug.

flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 8, 2024
Add new lint: `ref_as_ptr`

Fixes rust-lang#10130

Added new lint `ref_as_ptr` that checks for conversions from references to pointers and suggests using `std::ptr::from_{ref, mut}` instead.

The name is different than suggested in the issue (`as_ptr_cast`) since there were some other lints with similar names (`ptr_as_ptr`, `borrow_as_ptr`) and I wanted to follow the convention.

Note that this lint conflicts with the `borrow_as_ptr` lint in the sense that it recommends changing `&foo as *const _` to `std::ptr::from_ref(&foo)` instead of `std::ptr::addr_of!(foo)`. Personally, I think the former is more readable and, in contrast to `addr_of` macro, can be also applied to temporaries (cf. rust-lang#9884).

---

changelog: New lint: [`ref_as_ptr`]
[rust-lang#12087](rust-lang/rust-clippy#12087)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant