-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Adding configuration to allow safety comment above stmt containing unsafe block #10886
Conversation
r? @Jarcho (rustbot has picked a reviewer for you, use r? to override) |
Alright, I'll review it in a bit :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks pretty good overall! There's just a minor typo in accept_comment_above_statement
's doc comment.
tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs
Outdated
Show resolved
Hide resolved
Hey @Centri3 thank you very much for the review. I will address your comments in the next couple days and I let you know :) |
0b58c47
to
e956267
Compare
tests/ui-toml/undocumented_unsafe_blocks/undocumented_unsafe_blocks.rs
Outdated
Show resolved
Hide resolved
@Centri3 I have just rebased from master. Let me know if you have any comments about the current state of the PR :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks!
cc @xFrednet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version LGTM! I believe, you'll need to rebased on master and run cargo collect-metadata
again due to some recent changes to that script. Then it should be ready to be merged :D
Thank you for the changes!
/// Lint: UNDOCUMENTED_UNSAFE_BLOCKS. | ||
/// | ||
/// Whether to accept a safety comment to be placed above the statement containing the `unsafe` block | ||
(accept_comment_above_statement: bool = false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A recent PR adds configuration lints in the changelog file. You'll probably have to rebase on master and run cargo collect-metadata
again
@@ -0,0 +1,534 @@ | |||
//@aux-build:proc_macro_unsafe.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small site note @Centri3, AFAIK you requested that this file is the same as the normal test file. Generally speaking, I think it's fine to have some basic tests for the lint, some don't lint examples and then the specific case, which is influenced by the config value. Having a lot of output in the .stderr
file can make it hard to distinguish the actual changes.
This is not to imply that either variant is better. This is up to the reviewer to decide and since you mainly reviewed this one, I'll follow your lead. Just so you know, it's not mandatory :)
I will take a week off, so I will only probably rebase and fix this PR after the 25th :) |
Thank you! @bors r=Centri3,xFrednet |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Adding a new configuration,
accept-comment-above-statement
, to allow a safety comment to be placed before the statement that has theunsafe
block. It affects theundocumented_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
]: Addedaccept-comment-above-statement
configuration.#10886