# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 2023-03-07 12:39:31 # Node ID 0cc19a53cef4f58f707a18e095d2321b1a3e81fc # Parent 5069a89a936e0ee2bd299829b786e71de05d3a5b rust: fix building on macOS (issue6801) The VFS change is copied over from Cargo, and likely to apply to other platforms as well. The dirstate change is essentially a replay of 440972d2175d, which was reverted in e98fd81bb151, part of !383, to silence some clippy warnings. diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs b/rust/hg-core/src/dirstate_tree/on_disk.rs --- a/rust/hg-core/src/dirstate_tree/on_disk.rs +++ b/rust/hg-core/src/dirstate_tree/on_disk.rs @@ -415,9 +415,9 @@ impl Node { fn synthesize_unix_mode(&self) -> u32 { let file_type = if self.flags().contains(Flags::MODE_IS_SYMLINK) { - libc::S_IFLNK + libc::S_IFLNK as u32 } else { - libc::S_IFREG + libc::S_IFREG as u32 }; let permissions = if self.flags().contains(Flags::MODE_EXEC_PERM) { 0o755 diff --git a/rust/hg-core/src/vfs.rs b/rust/hg-core/src/vfs.rs --- a/rust/hg-core/src/vfs.rs +++ b/rust/hg-core/src/vfs.rs @@ -193,3 +193,13 @@ pub(crate) fn is_on_nfs_mount(path: impl r == 0 && buf.f_type as u32 == libc::NFS_SUPER_MAGIC as u32 } } + +/// Similar to what Cargo does; although detecting NFS (or non-local +/// file systems) _should_ be possible on other operating systems, +/// we'll just assume that mmap() works there, for now; after all, +/// _some_ functionality is better than a compile error, i.e. none at +/// all +#[cfg(not(target_os = "linux"))] +pub(crate) fn is_on_nfs_mount(_path: impl AsRef) -> bool { + false +}