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

Make unsafe_op_in_unsafe_fn auto-migrated in 2024 edition #119823

Closed
tmandry opened this issue Jan 10, 2024 · 1 comment · Fixed by #119948
Closed

Make unsafe_op_in_unsafe_fn auto-migrated in 2024 edition #119823

tmandry opened this issue Jan 10, 2024 · 1 comment · Fixed by #119948
Assignees
Labels
A-edition-2024 Area: The 2024 edition A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. E-help-wanted Call for participation: Help is requested to fix this issue. F-unsafe-block-in-unsafe-fn RFC #2585

Comments

@tmandry
Copy link
Member

tmandry commented Jan 10, 2024

There are two things to do:

  1. Change the Applicability to MachineApplicable.
  2. Implement a system to add the lint to the rust-2024-compatibility lint group. Currently only FutureIncompatibilityReason::EditionError or FutureIncompatibilityReason::EditionSemanticsChange can do that. It sounds like that is not what you want to do (make it a hard error), so there will need to be new code to handle this scenario.

Though I don't think that all edition lints ought to be marked future-incompatible (based on what I understand that designation to mean: you get lints for all your dependencies too).

That's not the only reason for future-incompatible lints. There are different categories, such as warning in dependencies (for soundness fixes), and for edition migrations (which don't warn in dependencies, only in the cargo fix --edition automatic migration). I opened #117927 to try to document it a little more clearly.

Unfortunately the current system doesn't support the use case it sounds like you want (where it is only a warning in the new edition). It should be a relatively simple case of introducing something that will add the lint to the rust-2024-compatibility lint group.

As I recall, in previous editions we've had a "run this lint group through fix to prepare for the edition" that this would be included in,

Yea, that's the problem I'm trying to bring up. This lint currently is not in the rust-2024-compatibility lint group which is required for handling that.

Originally posted by @ehuss in #112038 (comment)

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 10, 2024
@tmandry tmandry added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. E-help-wanted Call for participation: Help is requested to fix this issue. C-bug Category: This is a bug. F-unsafe-block-in-unsafe-fn RFC #2585 A-edition-2024 Area: The 2024 edition and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 10, 2024
@asquared31415
Copy link
Contributor

@rustbot claim

TaKO8Ki added a commit to TaKO8Ki/rust that referenced this issue Jan 21, 2024
…fn_fix, r=TaKO8Ki

Make `unsafe_op_in_unsafe_fn` migrated in edition 2024

fixes rust-lang#119823
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 22, 2024
…fn_fix, r=TaKO8Ki

Make `unsafe_op_in_unsafe_fn` migrated in edition 2024

fixes rust-lang#119823
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 22, 2024
…fn_fix, r=TaKO8Ki

Make `unsafe_op_in_unsafe_fn` migrated in edition 2024

fixes rust-lang#119823
@bors bors closed this as completed in 34bab29 Jan 22, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 22, 2024
Rollup merge of rust-lang#119948 - asquared31415:unsafe_op_in_unsafe_fn_fix, r=TaKO8Ki

Make `unsafe_op_in_unsafe_fn` migrated in edition 2024

fixes rust-lang#119823
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2024 Area: The 2024 edition A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. E-help-wanted Call for participation: Help is requested to fix this issue. F-unsafe-block-in-unsafe-fn RFC #2585
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants