Patchwork D12433: rust-hgpath: add `repr(transparent)` to `HgPath`

login
register
mail settings
Submitter phabricator
Date April 4, 2022, 3:30 p.m.
Message ID <differential-rev-PHID-DREV-gafidraafzlencbebmno-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50778/
State New
Headers show

Comments

phabricator - April 4, 2022, 3:30 p.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It's been stabilized a long time ago, so let's not rely on an implementation
  detail now.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, 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
@@ -144,15 +144,8 @@ 
 /// On Unix, it's just byte-to-byte conversion. On Windows, it has to be
 /// decoded from MBCS to WTF-8. If WindowsUTF8Plan is implemented, the source
 /// character encoding will be determined on a per-repository basis.
-//
-// FIXME: (adapted from a comment in the stdlib)
-// `HgPath::new()` current implementation relies on `Slice` being
-// layout-compatible with `[u8]`.
-// When attribute privacy is implemented, `Slice` should be annotated as
-// `#[repr(transparent)]`.
-// Anyway, `Slice` representation and layout are considered implementation
-// detail, are not documented and must not be relied upon.
 #[derive(Eq, Ord, PartialEq, PartialOrd, Hash)]
+#[repr(transparent)]
 pub struct HgPath {
     inner: [u8],
 }