Fix FileType PartialEq implementation on Windows by ChrisDenton · Pull Request #138671 · rust-lang/rust (original) (raw)

Fixes #138668

On Windows the FileType 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): 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)...