Skip to content

Doc: static mut is unsafe too #14488

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

Merged
merged 1 commit into from
May 29, 2014
Merged

Doc: static mut is unsafe too #14488

merged 1 commit into from
May 29, 2014

Conversation

SimonSapin
Copy link
Contributor

According to the corresponding section, accessing a mutable static variable requires unsafe too, and I believe it counts as as language level feature. Add it to the relevant list in the Unsafety section.

According to the corresponding section, accessing a mutable static variable requires `unsafe` too, and I believe it counts as as language level feature. Add it to the relevant list in the Unsafety section.
bors added a commit that referenced this pull request May 29, 2014
According to the corresponding section, accessing a mutable static variable requires `unsafe` too, and I believe it counts as as language level feature. Add it to the relevant list in the Unsafety section.
@bors bors closed this May 29, 2014
@bors bors merged commit 17697c7 into rust-lang:master May 29, 2014
@SimonSapin SimonSapin deleted the patch-11 branch July 30, 2014 08:12
flip1995 pushed a commit to flip1995/rust that referenced this pull request Apr 3, 2025
rust-lang#14501)

Fixes rust-lang#14488

Context: the `macro_metavars_in_unsafe` lint looks for unsafe blocks
with a macro span that then contain expressions with a root context span
(which means that it is a macro with an unsafe block expanding a
metavariable inside). In order to avoid emitting a warning for every
single macro invocation, it will deduplicate the unsafe blocks by the
span in the macro.

This leads to the linked issue where because of the deduplicating and
removing unsafe blocks that all belong to the same unsafe block in the
macro, only one of the unsafe blocks will actually have its lint
expectation fulfilled. This PR fixes that by manually fulfilling all of
the unsafe blocks from all expansions before deduplicating them.

changelog: [`macro_metavars_in_unsafe`]: fix unfulfilled `#[expect]` if
macro is invoked multiple times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants