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

fs: always try to get file type in fs::read_dir #5804

Closed
wants to merge 1 commit into from
Closed

fs: always try to get file type in fs::read_dir #5804

wants to merge 1 commit into from

Conversation

icedrocket
Copy link
Contributor

@icedrocket icedrocket commented Jun 19, 2023

The current implementation of fs::read_dir pre-stores the file type, except for a few operating systems that are known to require an extra call to get the file type. The cfg attributes we use to check such operating systems comes from the std implementation, but this was recently updated and no longer matches.

I think I'd rather just delete those cfg attributes, because when we read a directory, we also read the file type, except in very few cases.

@Darksonn
Copy link
Contributor

but this was recently updated and no longer matches.

We must still support older compilers, so if these methods are not available there, then we cannot remove the cfgs yet.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-fs Module: tokio/fs labels Jun 19, 2023
@icedrocket
Copy link
Contributor Author

icedrocket commented Jun 19, 2023

but this was recently updated and no longer matches.

We must still support older compilers, so if these methods are not available there, then we cannot remove the cfgs yet.

The std implementation I linked to in my description is just the part that decides whether to make an extra call. Targets that support std should be fine, as they support DirEntry::file_type.

@icedrocket
Copy link
Contributor Author

Superseded by #5806.

@icedrocket icedrocket closed this Jun 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-fs Module: tokio/fs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants