Mercurial > hg
changeset 49004:9dcfd1d05e6e stable
rust-hgpath: add `repr(transparent)` to `HgPath`
It's been stabilized a long time ago, so let's not rely on an implementation
detail now.
Differential Revision: https://phab.mercurial-scm.org/D12433
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 05 Apr 2022 10:55:28 +0200 |
parents | ce919b1a1063 |
children | 12adf8c695ed 5bd6bcd31dd1 |
files | rust/hg-core/src/utils/hg_path.rs |
diffstat | 1 files changed, 1 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/utils/hg_path.rs Tue Apr 05 10:55:28 2022 +0200 +++ b/rust/hg-core/src/utils/hg_path.rs Tue Apr 05 10:55:28 2022 +0200 @@ -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], }