Patchwork D7107: rust-cross-platform: remove `unimplemented!` to get compile-time errors instead

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2019, 2:23 p.m.
Message ID <df29f5a77d1837c84acec1c0ab744ad3@localhost.localdomain>
Download mbox | patch
Permalink /patch/42402/
State Not Applicable
Headers show

Comments

phabricator - Oct. 16, 2019, 2:23 p.m.
Closed by commit rHG3f21d1c1bba5: rust-cross-platform: remove `unimplemented!` to get compile-time errors (authored by Alphare).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7107?vs=17175&id=17219

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

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

AFFECTED FILES
  rust/hg-core/src/utils/files.rs
  rust/hg-core/src/utils/hg_path.rs

CHANGE DETAILS




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

Patch

diff --git a/rust/hg-core/src/utils/hg_path.rs b/rust/hg-core/src/utils/hg_path.rs
--- a/rust/hg-core/src/utils/hg_path.rs
+++ b/rust/hg-core/src/utils/hg_path.rs
@@ -258,11 +258,8 @@ 
         use std::os::unix::ffi::OsStrExt;
         os_str = std::ffi::OsStr::from_bytes(&hg_path.as_ref().as_bytes());
     }
-    #[cfg(windows)]
-    {
-        // TODO: convert from Windows MBCS (ANSI encoding) to WTF8.
-        unimplemented!();
-    }
+    // TODO Handle other platforms
+    // TODO: convert from WTF8 to Windows MBCS (ANSI encoding).
     Ok(os_str.to_os_string())
 }
 
@@ -281,11 +278,9 @@ 
         use std::os::unix::ffi::OsStrExt;
         buf = HgPathBuf::from_bytes(&os_string.as_ref().as_bytes());
     }
-    #[cfg(windows)]
-    {
-        // TODO: convert from WTF8 to Windows MBCS (ANSI encoding).
-        unimplemented!();
-    }
+    // TODO Handle other platforms
+    // TODO: convert from WTF8 to Windows MBCS (ANSI encoding).
+
     buf.check_state()?;
     Ok(buf)
 }
@@ -300,11 +295,9 @@ 
         use std::os::unix::ffi::OsStrExt;
         buf = HgPathBuf::from_bytes(&os_str.as_bytes());
     }
-    #[cfg(windows)]
-    {
-        // TODO: convert from WTF8 to Windows MBCS (ANSI encoding).
-        unimplemented!();
-    }
+    // TODO Handle other platforms
+    // TODO: convert from WTF8 to Windows MBCS (ANSI encoding).
+
     buf.check_state()?;
     Ok(buf)
 }
diff --git a/rust/hg-core/src/utils/files.rs b/rust/hg-core/src/utils/files.rs
--- a/rust/hg-core/src/utils/files.rs
+++ b/rust/hg-core/src/utils/files.rs
@@ -21,12 +21,9 @@ 
         use std::os::unix::ffi::OsStrExt;
         os_str = std::ffi::OsStr::from_bytes(bytes);
     }
-    #[cfg(windows)]
-    {
-        // TODO: convert from Windows MBCS (ANSI encoding) to WTF8.
-        // Perhaps, the return type would have to be Result<PathBuf>.
-        unimplemented!()
-    }
+    // TODO Handle other platforms
+    // TODO: convert from WTF8 to Windows MBCS (ANSI encoding).
+    // Perhaps, the return type would have to be Result<PathBuf>.
 
     Path::new(os_str)
 }