-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
unsafe_op_in_unsafe_fn suggestion overlaps when used in a macro #123304
Copy link
Copy link
Closed
Labels
A-edition-2024Area: The 2024 editionArea: The 2024 editionC-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-edition-2024Area: The 2024 editionArea: The 2024 editionC-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The following example triggers the
unsafe_op_in_unsafe_fnlint twice in the same position:This causes
cargo fixto apply both suggestions which ends up with:which triggers the
unused_unsafelint.Would it be possible to avoid duplicate suggestions when used in a macro?
cc @asquared31415
I suspect this may be encountered frequently with the 2024 edition migration (crater run is pending in #122960). Although it isn't too much of a problem to repair, a frequently used macro could have many unsafe blocks, which could be confusing.