Skip to content

Actually mark RelativePath as transparent#2693

Merged
Sebastian Thiel (Byron) merged 2 commits into
GitoxideLabs:mainfrom
Manishearth:relative-path-transparent
Jul 6, 2026
Merged

Actually mark RelativePath as transparent#2693
Sebastian Thiel (Byron) merged 2 commits into
GitoxideLabs:mainfrom
Manishearth:relative-path-transparent

Conversation

@Manishearth

@Manishearth Manish Goregaokar (Manishearth) commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #2692

I went ahead and cleaned up the Result there as well, the layout of Result is not well defined.

It worked anyway because of niche optimizations, I think, but we can't rely on that here.

The GitHub Actions lint job failed while running `just clippy -D warnings -A unknown-lints --no-deps`. Clippy reported `missing-transmute-annotations` for the unsafe cast from `&BStr` to `&RelativePath` in `gix-path/src/relative_path.rs`.

This annotates the transmute with its source and target reference types, preserving the existing transparent wrapper conversion while satisfying the lint.

@Byron Sebastian Thiel (Byron) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much, I really should try not to write unsafe code!

In this particular instance, I'm pretty sure I copied it from the bstr crate - maybe that went terribly wrong, or maybe there is something there as well.

@Byron
Sebastian Thiel (Byron) merged commit 19bdf8a into GitoxideLabs:main Jul 6, 2026
32 checks passed
@Manishearth
Manish Goregaokar (Manishearth) deleted the relative-path-transparent branch July 6, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Soundness: RelativePath is treated as transparent but it isn't

3 participants