Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[repr(transparent)] in sys::windows::os_str::Slice #96577

Closed
JanBeh opened this issue Apr 30, 2022 · 2 comments · Fixed by #96802
Closed

#[repr(transparent)] in sys::windows::os_str::Slice #96577

JanBeh opened this issue Apr 30, 2022 · 2 comments · Fixed by #96802
Assignees

Comments

@JanBeh
Copy link
Contributor

JanBeh commented Apr 30, 2022

I noticed that the sys::windows::os_str::Slice type is not repr(transparent) while sys::unix::os_str::Slice is. However, they are required to have a transparent representation.

While the standard library may(?) assume they will properly transmute, it might be better to add #[repr(transparent)] to sys::windows::os_str::Slice. Possibly this affects other systems as well.

See also this thread/post on URLO.

@ChrisDenton
Copy link
Member

Note that making the Unix version transparent was a relatively recent change (May of last year). The reason given was:

Because Buf and Slice now no longer live in a publicly exported module they can be marked as pub and repr(transparent) as normal.

@gimbling-away
Copy link
Contributor

@rustbot claim

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 a pull request may close this issue.

3 participants