Open ojeda opened 3 months ago
Not sure if I can do this, but:
@rustbot label +C-bug +I-false-negative
Sorry, the main case is (I assume) a false positive (and likely all of the ones listed above):
@rustbot label -I-false-negative +I-false-positive
Assuming the most relaxed setup, i.e. the defaults (
accept-comment-above-attribute = true
andaccept-comment-above-statement = true
),undocumented_unsafe_blocks
seems to have false positives around attributes, since moving the attribute on top makes it work (i.e. it does not lint anymore) in all cases.For instance, we had this code:
Is this expected to trigger? It currently lints. Perhaps the developer is expected to put the
// SAFETY
comment insideErr
:That works (i.e. it does not lint anymore), although it may be debatable whether it looks/is better or not.
However, moving the attribute on top of the comment also makes it work (i.e. it does not lint anymore):
which is a bit surprising. It seems like that is "close enough". Should that trigger, or not?
Moreover, testing a few more variations, I found that this would also lint:
For this one, moving the comment below the attribute makes it pass too.
Below I leave a few more variations/test cases. Which ones should pass, or not? Given that all of them pass when the comment is moved below the attribute, it would seem that all of them were expected to pass (i.e. not lint).