add lint for unsafe blocks#10599
Merged
bors merged 1 commit intorust-lang:masterfrom Nov 22, 2013
thestinger:unsafe
Merged
Conversation
bors
added a commit
that referenced
this pull request
Nov 22, 2013
This is just meant to be for containing usage of `unsafe`, much like `heap_memory`.
Contributor
There was a problem hiding this comment.
Does this mean that
macro_rules! foo ( () => { unsafe { *(0 as *int) } } )
fn main() { foo!() }doesn't get picked up? Maybe we need UserProvided, UserMacroGenerated, CompileMacroGenerated, or something.
Contributor
Author
|
@huonw: I'm pretty sure it will let you use an unsafe macro but not define one. I could be wrong, and a test should be added. I agree with the solution you propose though. |
bors
added a commit
that referenced
this pull request
Nov 22, 2013
Add a test for the case I mentioned on #10599.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Oct 15, 2021
…ark-Simulacrum Add a strange test for `unsafe_code` lint. The current behavior is a little surprising to me. I'm not sure whether people would change it, but at least let me document the current behavior with a test. I learnt about this from the [totally-speedy-transmute](https://docs.rs/totally-speedy-transmute) crate. cc rust-lang#10599 the original implementation pr.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is just meant to be for containing usage of
unsafe, much likeheap_memory.