about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/std_example.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-09 17:01:03 +0000
committerbors <bors@rust-lang.org>2024-03-09 17:01:03 +0000
commitc173ea64b7c3ff289098569de04217e34454c59f (patch)
tree2a7a42b7a1beb937b8b8741bec41322d640189f1 /compiler/rustc_codegen_gcc/example/std_example.rs
parentb2f9c4cbc746710950b4e49d04fc372119eec0a0 (diff)
parentced8bc5b8f105745d199da526ab262d17995d503 (diff)
downloadrust-c173ea64b7c3ff289098569de04217e34454c59f.tar.gz
rust-c173ea64b7c3ff289098569de04217e34454c59f.zip
Auto merge of #12446 - y21:check_fn_span_lint, r=xFrednet
use `span_lint_hir` instead of `span_lint` in more lints

Decided to grep for `check_(fn|block)` and look where `span_lint` is used, since some lints lint will then emit a lint on a statement or expression in that function, which would use the wrong lint level attributes

The `LintContext` keeps track of the last entered HIR node that had any attributes, and uses those (and its parents) for figuring out the lint level when a lint is emitted

However, this only works when we actually emit a lint at the same node as the `check_*` function we are in.
If we're in `check_fn` and we emit a lint on a statement within that function, then there is no way to allow the lint only for that one statement (if `span_lint` is used). It would only count allow attributes on the function

changelog: [`needless_return`]: [`useless_let_if_seq`]: [`mut_mut`]: [`read_zero_byte_vec`]: [`unused_io_amount`]: [`unused_peekable`]: now respects `#[allow]` attributes on the affected statement instead of only on the enclosing block or function
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions