Index: lib/Support/Windows/Path.inc =================================================================== --- lib/Support/Windows/Path.inc +++ lib/Support/Windows/Path.inc @@ -442,10 +442,12 @@ for (unsigned Retry = 0; Retry != 200; ++Retry) { auto EC = rename_internal(FromHandle, To, true); - if (EC == - std::error_code(ERROR_CALL_NOT_IMPLEMENTED, std::system_category())) { - // Wine doesn't support SetFileInformationByHandle in rename_internal. - // Fall back to MoveFileEx. + if ((EC == + std::error_code(ERROR_CALL_NOT_IMPLEMENTED, std::system_category())) || + (EC == + std::error_code(ERROR_NOT_SAME_DEVICE, std::system_category()))) { + // Wine doesn't support SetFileInformationByHandle in rename_internal, + // or cross-device rename requested. Fall back to MoveFileEx. SmallVector WideFrom; if (std::error_code EC2 = realPathFromHandle(FromHandle, WideFrom)) return EC2;