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

Enable the unsafe_op_in_unsafe_fn lint #11590

Open
2 of 3 tasks
tguichaoua opened this issue Jan 28, 2024 · 1 comment
Open
2 of 3 tasks

Enable the unsafe_op_in_unsafe_fn lint #11590

tguichaoua opened this issue Jan 28, 2024 · 1 comment
Labels
A-ECS Entities, components, systems, and events A-Pointers Relating to Bevy pointer abstractions C-Code-Quality A section of code that is hard to understand or change

Comments

@tguichaoua
Copy link
Contributor

tguichaoua commented Jan 28, 2024

What problem does this solve or what need does it fill?

unsafe_op_in_unsafe_fn will be warn by default in rust edition 2024 (rust-lang/rust#112038).

What solution would you like?

Enable unsafe_op_in_unsafe_fn.

Additional context

I have opened a PR (#11591) that enables the lint at workspace level and fixes the lint in some crates.
Nevertheless, the clippy::undocumented-unsafe-blocks lint makes unsafe blocks require a safety comment to describe them.
The following crates require someone with enough knowledge about them to provide proper safety comments.

@tguichaoua tguichaoua added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 28, 2024
@tguichaoua tguichaoua changed the title Enable unsafe_op_in_unsafe_fn lint Enable the unsafe_op_in_unsafe_fn lint Jan 28, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 28, 2024
# Objective

- Partial fix of #11590

## Solution

- Enable `unsafe_op_in_unsafe_fn` at workspace level
- Fix the lint for most of the crates
@BD103
Copy link
Member

BD103 commented Jan 29, 2024

Linking to RFC 2585, which provides further motivation and details on the change.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change A-Pointers Relating to Bevy pointer abstractions and removed C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 30, 2024
github-merge-queue bot pushed a commit that referenced this issue Jan 30, 2024
# Objective

- Part of #11590

## Solution

Fix `unsafe_op_in_unsafe_fn` for `bevy_ptr`.
tjamaan pushed a commit to tjamaan/bevy that referenced this issue Feb 6, 2024
# Objective

- Partial fix of bevyengine#11590

## Solution

- Enable `unsafe_op_in_unsafe_fn` at workspace level
- Fix the lint for most of the crates
tjamaan pushed a commit to tjamaan/bevy that referenced this issue Feb 6, 2024
# Objective

- Part of bevyengine#11590

## Solution

Fix `unsafe_op_in_unsafe_fn` for `bevy_ptr`.
github-merge-queue bot pushed a commit that referenced this issue Feb 12, 2024
# Objective

- Part of #11590.

## Solution

- Fix `unsafe_op_in_unsafe_fn` for `bevy_dynamic_plugin`.

---

## Changelog

- Added further restrictions to the safety requirements of
`bevy_dynamic_plugin::dynamically_load_plugin`.

---

I had a few issues, specifically with the safety comment on
`dynamically_load_plugin`. There are three different unsafe functions
called within the function body, and they all need their own
justification / message.

Also, would it be unsound to call `dynamically_load_plugin` multiple
times on the same file? I feel the documentation needs to be more clear.
github-merge-queue bot pushed a commit that referenced this issue Feb 22, 2024
# Objective

- Part of #11590
- Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs

## Solution

Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an
`unsafe` block when the safety comment already exists or add a comment
like "The invariants are uphold by the caller".

---------

Co-authored-by: James Liu <contact@jamessliu.com>
ameknite pushed a commit to ameknite/bevy that referenced this issue Feb 22, 2024
…e#11861)

# Objective

- Part of bevyengine#11590
- Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs

## Solution

Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an
`unsafe` block when the safety comment already exists or add a comment
like "The invariants are uphold by the caller".

---------

Co-authored-by: James Liu <contact@jamessliu.com>
msvbg pushed a commit to msvbg/bevy that referenced this issue Feb 26, 2024
…e#11861)

# Objective

- Part of bevyengine#11590
- Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs

## Solution

Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an
`unsafe` block when the safety comment already exists or add a comment
like "The invariants are uphold by the caller".

---------

Co-authored-by: James Liu <contact@jamessliu.com>
msvbg pushed a commit to msvbg/bevy that referenced this issue Feb 26, 2024
…e#11861)

# Objective

- Part of bevyengine#11590
- Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs

## Solution

Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an
`unsafe` block when the safety comment already exists or add a comment
like "The invariants are uphold by the caller".

---------

Co-authored-by: James Liu <contact@jamessliu.com>
NiseVoid pushed a commit to NiseVoid/bevy that referenced this issue Jul 8, 2024
…e#11861)

- Part of bevyengine#11590
- Fix `unsafe_op_in_unsafe_fn` for trivial cases in bevy_ecs

Fix `unsafe_op_in_unsafe_fn` in bevy_ecs for trivial cases, i.e., add an
`unsafe` block when the safety comment already exists or add a comment
like "The invariants are uphold by the caller".

---------

Co-authored-by: James Liu <contact@jamessliu.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events A-Pointers Relating to Bevy pointer abstractions C-Code-Quality A section of code that is hard to understand or change
Projects
None yet
Development

No branches or pull requests

3 participants