Skip to content

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

New issue

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

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

Already on GitHub? # to your account

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

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.

@ghost
Copy link

ghost commented May 6, 2022

@rustbot claim

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants