Patchwork D11955: rust: fix build errors on darwin

login
register
mail settings
Submitter phabricator
Date Dec. 30, 2021, 1:08 p.m.
Message ID <differential-rev-PHID-DREV-ybjrmjhtegvc4dlzehsl-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50281/
State New
Headers show

Comments

phabricator - Dec. 30, 2021, 1:08 p.m.
danchr created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm not all _that_ versed in Rust, but I think the root cause is that
  some constants are u16 rather than u32 on Darwin. I checked that the
  code still compiles on the latest Ubuntu.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11955

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/on_disk.rs

CHANGE DETAILS




To: danchr, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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
@@ -353,7 +353,7 @@ 
         } else {
             0o644
         };
-        file_type | permisions
+        (file_type | permisions).into()
     }
 
     fn assume_entry(&self) -> Result<DirstateEntry, DirstateV2ParseError> {
@@ -454,8 +454,8 @@ 
         flags.set(Flags::P1_TRACKED, p1_tracked);
         flags.set(Flags::P2_INFO, p2_info);
         let size = if let Some((m, s)) = mode_size_opt {
-            let exec_perm = m & libc::S_IXUSR != 0;
-            let is_symlink = m & libc::S_IFMT == libc::S_IFLNK;
+            let exec_perm: bool = m & (libc::S_IXUSR as u32) != 0;
+            let is_symlink: bool = m & (libc::S_IFMT as u32) != 0;
             flags.set(Flags::MODE_EXEC_PERM, exec_perm);
             flags.set(Flags::MODE_IS_SYMLINK, is_symlink);
             flags.insert(Flags::HAS_MODE_AND_SIZE);