Uh oh!
There was an error while loading. Please reload this page.
Fix FileTypePartialEq implementation on Windows - #138671
Merged
Merged
Conversation
ChrisDenton
commented
Mar 18, 2025
MemberAuthor
@joshtriplett, since you won the dice roll, does this need an FCP? |
Kyuuhachi
commented
Mar 18, 2025
Contributor
Should probably fix the Hash too, because it currently breaks the |
ChrisDenton
commented
Mar 18, 2025
MemberAuthor
Good point! |
ChrisDenton
commented
Mar 18, 2025
Uh oh!
There was an error while loading. Please reload this page.
MemberAuthor
Actually this implementation would be so much simpler if I just calculated |
joshtriplett
commented
Mar 22, 2025
Member
This seems correct to me. And I think it's a bugfix, not an API change. @bors r+ |
bors
commented
Mar 22, 2025
Collaborator
bors added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 24, 2025
Rollup of 10 pull requests Successful merges: - rust-lang#137593 (fix download-llvm logic for subtree sync branches) - rust-lang#137736 (Don't attempt to export compiler-builtins symbols from rust dylibs) - rust-lang#138135 (Simplify `PartialOrd` on tuples containing primitives) - rust-lang#138321 ([bootstrap] Distribute split debuginfo if present) - rust-lang#138574 (rustdoc: be more strict about "Methods from Deref") - rust-lang#138606 (Fix missing rustfmt in msi installer - cont) - rust-lang#138671 (Fix `FileType` `PartialEq` implementation on Windows) - rust-lang#138728 (Update `compiler-builtins` to 0.1.152) - rust-lang#138783 (Cache current_dll_path output) - rust-lang#138846 (Tweaks to writeback and `Obligation -> Goal` conversion) Failed merges: - rust-lang#138755 ([rustdoc] Remove duplicated loop when computing doc cfgs) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 24, 2025
Rollup merge of rust-lang#138671 - ChrisDenton:filetype, r=joshtriplett Fix `FileType` `PartialEq` implementation on Windows Fixesrust-lang#138668 On Windows the [`FileType`](https://doc.rust-lang.org/stable/std/fs/struct.FileType.html) struct was deriving `PartialEq` which in turn means it was doing a bit-for-bit comparison on the file attributes and reparse point. This is wrong because `attributes` may contain many things unrelated to file type. `FileType` on Windows allows for four possible combinations (see also [`FileTypeExt`](https://doc.rust-lang.org/stable/std/os/windows/fs/trait.FileTypeExt.html)): `file`, `dir`, `symlink_file` and `symlink_dir`. So the new implementation makes sure both symlink and directory information match (and only those things). This could be considered just a bug fix but it is a behaviour change so someone from libs-api might want to FCP this (or might not)...
github-actionsBot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Apr 2, 2025
Fix `FileType` `PartialEq` implementation on Windows Fixesrust-lang#138668 On Windows the [`FileType`](https://doc.rust-lang.org/stable/std/fs/struct.FileType.html) struct was deriving `PartialEq` which in turn means it was doing a bit-for-bit comparison on the file attributes and reparse point. This is wrong because `attributes` may contain many things unrelated to file type. `FileType` on Windows allows for four possible combinations (see also [`FileTypeExt`](https://doc.rust-lang.org/stable/std/os/windows/fs/trait.FileTypeExt.html)): `file`, `dir`, `symlink_file` and `symlink_dir`. So the new implementation makes sure both symlink and directory information match (and only those things). This could be considered just a bug fix but it is a behaviour change so someone from libs-api might want to FCP this (or might not)...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#138668
On Windows the
FileTypestruct was derivingPartialEqwhich in turn means it was doing a bit-for-bit comparison on the file attributes and reparse point. This is wrong becauseattributesmay contain many things unrelated to file type.FileTypeon Windows allows for four possible combinations (see alsoFileTypeExt):file,dir,symlink_fileandsymlink_dir. So the new implementation makes sure both symlink and directory information match (and only those things).This could be considered just a bug fix but it is a behaviour change so someone from libs-api might want to FCP this (or might not)...