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

There is a missing safety comment in bevy_render #9393

Closed
nicopap opened this issue Aug 9, 2023 · 1 comment
Closed

There is a missing safety comment in bevy_render #9393

nicopap opened this issue Aug 9, 2023 · 1 comment
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Docs An addition or correction to our documentation P-Unsound A bug that results in undefined compiler behavior

Comments

@nicopap
Copy link
Contributor

nicopap commented Aug 9, 2023

How can Bevy's documentation be improved?

bevy_render::view::window has a fairly large unsafe block with no safety comment.

let surface = render_instance
.create_surface(&window.handle.get_handle())
.expect("Failed to create wgpu surface");

The unsafe operation is render_instance.create_surface(…) (https://docs.rs/wgpu/latest/wgpu/struct.Instance.html#method.create_surface).

  • The unsafe block could be limited to create_surface, the rest of the unsafe block doesn't uphold any invariants related to create_surface
  • There should be a safety comment explaining why the RawWindowHandle passed to create_surface are valid. (to be fair, this seems particularly tricky, since I don't see any definition of "valid" in the wgpu doc)
@nicopap nicopap added C-Docs An addition or correction to our documentation A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in P-Unsound A bug that results in undefined compiler behavior labels Aug 9, 2023
@JaySpruce
Copy link
Contributor

Fixed by #10646

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Docs An addition or correction to our documentation P-Unsound A bug that results in undefined compiler behavior
Projects
None yet
Development

No branches or pull requests

3 participants