Skip to content

rustc: avoid compiler generated unsafe blocks leaking. #12419

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
Feb 21, 2014

Conversation

huonw
Copy link
Member

@huonw huonw commented Feb 20, 2014

Previously an unsafe block created by the compiler (like those in the
formatting macros) would be "ignored" if surrounded by unsafe, that
is, the internal unsafety would be being legitimised by the external
block:

unsafe { println!("...") } =(expansion)=> unsafe { ... unsafe { ... } }

And the code in the inner block would be using the outer block, making
it considered used (and the inner one considered unused).

This patch forces the compiler to create a new unsafe context for
compiler generated blocks, so that their internal unsafety doesn't
escape to external blocks.

Fixes #12418.

Previously an `unsafe` block created by the compiler (like those in the
formatting macros) would be "ignored" if surrounded by `unsafe`, that
is, the internal unsafety would be being legitimised by the external
block:

    unsafe { println!("...") } =(expansion)=> unsafe { ... unsafe { ... } }

And the code in the inner block would be using the outer block, making
it considered used (and the inner one considered unused).

This patch forces the compiler to create a new unsafe context for
compiler generated blocks, so that their internal unsafety doesn't
escape to external blocks.

Fixes rust-lang#12418.
bors added a commit that referenced this pull request Feb 21, 2014
Previously an `unsafe` block created by the compiler (like those in the
formatting macros) would be "ignored" if surrounded by `unsafe`, that
is, the internal unsafety would be being legitimised by the external
block:

    unsafe { println!("...") } =(expansion)=> unsafe { ... unsafe { ... } }

And the code in the inner block would be using the outer block, making
it considered used (and the inner one considered unused).

This patch forces the compiler to create a new unsafe context for
compiler generated blocks, so that their internal unsafety doesn't
escape to external blocks.

Fixes #12418.
@bors bors closed this Feb 21, 2014
@bors bors merged commit 5ec1183 into rust-lang:master Feb 21, 2014
@huonw huonw deleted the compiler-unsafe branch June 27, 2014 06:48
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 7, 2024
Handle plural acronyms in `doc_markdown`

Prevent `doc_markdown` from triggering on words like `OSes` and `UXes`.

changelog: handle plural acronyms in `doc_markdown`
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.

Unsafe blocks inside compiler macros silence unused_unsafe warning
3 participants