Patchwork D8246: hg-core: add a compilation error if trying to compile outside of Linux

login
register
mail settings
Submitter phabricator
Date March 6, 2020, 10:19 a.m.
Message ID <differential-rev-PHID-DREV-uf57zsb7muhsvpecrgqf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45537/
State Superseded
Headers show

Comments

phabricator - March 6, 2020, 10:19 a.m.
Alphare created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  For now, we can only provide support for Linux in `hg-core`, so we have to be
  explicit about it in case anyone wonders why their Dirstate is suddenly broken,
  or why the crate does not compile (on Windows for example).

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  rust/hg-core/src/lib.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-devel
phabricator - March 10, 2020, 4:42 p.m.
pulkit added a comment.


  Forgot to mention, I tried to apply this patch on default and it failed. Now I see it's targeted for stable. Since most of the rust code is experimental/not much used, it should be fine to have this on default branch. Any reason why this is targeted for stable?

REPOSITORY
  rHG Mercurial

BRANCH
  stable

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8246/new/

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

To: Alphare, #hg-reviewers, pulkit
Cc: mercurial-devel
phabricator - March 12, 2020, 8:59 p.m.
Alphare added a comment.


  In D8246#123554 <https://phab.mercurial-scm.org/D8246#123554>, @yuja wrote:
  
  >> +/// Remove this to see (potential) non-artificial compile failures. MacOS
  >> +/// *should* compile, but fail to compile tests for example as of 2020-03-06
  >
  > Un-doccommented this to silence build warning.
  
  Thanks, good catch.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8246/new/

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

To: Alphare, #hg-reviewers, pulkit
Cc: yuja, mercurial-devel

Patch

diff --git a/rust/hg-core/src/lib.rs b/rust/hg-core/src/lib.rs
--- a/rust/hg-core/src/lib.rs
+++ b/rust/hg-core/src/lib.rs
@@ -23,6 +23,14 @@ 
 pub use revlog::*;
 pub mod utils;
 
+/// Remove this to see (potential) non-artificial compile failures. MacOS
+/// *should* compile, but fail to compile tests for example as of 2020-03-06
+#[cfg(not(target_os = "linux"))]
+compile_error!(
+    "`hg-core` has only been tested on Linux and will most \
+     likely not behave correctly on other platforms."
+);
+
 use crate::utils::hg_path::HgPathBuf;
 pub use filepatterns::{
     build_single_regex, read_pattern_file, PatternSyntax, PatternTuple,