-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #10886 - lochetti:fix_10832, r=Centri3,xFrednet
Adding configuration to allow safety comment above stmt containing unsafe block Adding a new configuration, `accept-comment-above-statement`, to allow a safety comment to be placed before the statement that has the `unsafe` block. It affects the `undocumented_unsafe_blocks` lint. The default value for this configuration will be `false`. So the user has to opt-in for the change. This PR fixes #10832 --- changelog: Enhancement [`undocumented_unsafe_blocks`]: Added `accept-comment-above-statement` configuration. [#10886](#10886)
- Loading branch information
Showing
12 changed files
with
984 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
18 changes: 18 additions & 0 deletions
18
tests/ui-toml/undocumented_unsafe_blocks/auxiliary/proc_macro_unsafe.rs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//@compile-flags: --emit=link | ||
//@no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::{Delimiter, Group, Ident, TokenStream, TokenTree}; | ||
|
||
#[proc_macro] | ||
pub fn unsafe_block(input: TokenStream) -> TokenStream { | ||
let span = input.into_iter().next().unwrap().span(); | ||
TokenStream::from_iter([TokenTree::Ident(Ident::new("unsafe", span)), { | ||
let mut group = Group::new(Delimiter::Brace, TokenStream::new()); | ||
group.set_span(span); | ||
TokenTree::Group(group) | ||
}]) | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
accept-comment-above-statement = true |
Oops, something went wrong.