-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix FileType
PartialEq
implementation on Windows
#138671
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
Conversation
@joshtriplett, since you won the dice roll, does this need an FCP? |
Should probably fix the Hash too, because it currently breaks the |
Good point! |
Actually this implementation would be so much simpler if I just calculated |
This seems correct to me. And I think it's a bugfix, not an API change. @bors r+ |
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
Rollup merge of rust-lang#138671 - ChrisDenton:filetype, r=joshtriplett Fix `FileType` `PartialEq` implementation on Windows Fixes rust-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)...
Fix `FileType` `PartialEq` implementation on Windows Fixes rust-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)...
Fixes #138668
On Windows the
FileType
struct was derivingPartialEq
which in turn means it was doing a bit-for-bit comparison on the file attributes and reparse point. This is wrong becauseattributes
may contain many things unrelated to file type.FileType
on Windows allows for four possible combinations (see alsoFileTypeExt
):file
,dir
,symlink_file
andsymlink_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)...