Rollup merge of #134074 - GrigorenkoPV:bootstrap-io-error-more, r=jieyouxu
bootstrap: `std::io::ErrorKind::CrossesDevices` is finally stable
This commit is contained in:
commit
bd81023dd1
1 changed files with 1 additions and 4 deletions
|
@ -181,10 +181,7 @@ pub fn symlink_dir(config: &Config, original: &Path, link: &Path) -> io::Result<
|
||||||
/// copy and remove the file otherwise
|
/// copy and remove the file otherwise
|
||||||
pub fn move_file<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> {
|
pub fn move_file<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> {
|
||||||
match fs::rename(&from, &to) {
|
match fs::rename(&from, &to) {
|
||||||
// FIXME: Once `ErrorKind::CrossesDevices` is stabilized use
|
Err(e) if e.kind() == io::ErrorKind::CrossesDevices => {
|
||||||
// if e.kind() == io::ErrorKind::CrossesDevices {
|
|
||||||
#[cfg(unix)]
|
|
||||||
Err(e) if e.raw_os_error() == Some(libc::EXDEV) => {
|
|
||||||
std::fs::copy(&from, &to)?;
|
std::fs::copy(&from, &to)?;
|
||||||
std::fs::remove_file(&from)
|
std::fs::remove_file(&from)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue