rust/src/tools
Yuki Okushi 0a26e4ba7e
Rollup merge of #78326 - Aaron1011:fix/min-stmt-lints, r=petrochenkov
Split out statement attributes changes from #78306

This is the same as PR https://github.com/rust-lang/rust/pull/78306, but `unused_doc_comments` is modified to explicitly ignore statement items (which preserves the current behavior).

This shouldn't have any user-visible effects, so it can be landed without lang team discussion.

---------
When the 'early' and 'late' visitors visit an attribute target, they
activate any lint attributes (e.g. `#[allow]`) that apply to it.
This can affect warnings emitted on sibiling attributes. For example,
the following code does not produce an `unused_attributes` for
`#[inline]`, since the sibiling `#[allow(unused_attributes)]` suppressed
the warning.

```rust
trait Foo {
    #[allow(unused_attributes)] #[inline] fn first();
    #[inline] #[allow(unused_attributes)] fn second();
}
```

However, we do not do this for statements - instead, the lint attributes
only become active when we visit the struct nested inside `StmtKind`
(e.g. `Item`).

Currently, this is difficult to observe due to another issue - the
`HasAttrs` impl for `StmtKind` ignores attributes for `StmtKind::Item`.
As a result, the `unused_doc_comments` lint will never see attributes on
item statements.

This commit makes two interrelated fixes to the handling of inert
(non-proc-macro) attributes on statements:

* The `HasAttr` impl for `StmtKind` now returns attributes for
  `StmtKind::Item`, treating it just like every other `StmtKind`
  variant. The only place relying on the old behavior was macro
  which has been updated to explicitly ignore attributes on item
  statements. This allows the `unused_doc_comments` lint to fire for
  item statements.
* The `early` and `late` lint visitors now activate lint attributes when
  invoking the callback for `Stmt`. This ensures that a lint
  attribute (e.g. `#[allow(unused_doc_comments)]`) can be applied to
  sibiling attributes on an item statement.

For now, the `unused_doc_comments` lint is explicitly disabled on item
statements, which preserves the current behavior. The exact locatiosn
where this lint should fire are being discussed in PR #78306
2020-10-25 18:43:49 +09:00
..
build-manifest Include aarch64-pc-windows-msvc in the dist manifests 2020-10-13 19:02:29 -07:00
cargo@dd83ae55c8 Update cargo 2020-10-20 16:36:46 -07:00
cargotest update tokei and ripgrep in cargotest 2020-09-27 10:58:42 +02:00
clippy Rollup merge of #78326 - Aaron1011:fix/min-stmt-lints, r=petrochenkov 2020-10-25 18:43:49 +09:00
compiletest Updates to experimental coverage counter injection 2020-10-05 08:02:58 -07:00
error_index_generator mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
expand-yaml-anchors expand-yaml-anchors: fix clippy::match_ref_pats and clippy::redundant_closure 2020-08-23 23:53:53 +02:00
linkchecker Set MDBOOK_OUTPUT__HTML__INPUT_404 on linkchecker 2020-10-18 02:30:08 +09:00
lint-docs Pass --target to lint docs 2020-09-16 17:25:39 -04:00
miri@1b3a27c429 update miri 2020-10-16 19:11:36 +02:00
remote-test-client Support configurable deny-warnings for all in-tree crates. 2020-06-25 21:17:21 -07:00
remote-test-server Support configurable deny-warnings for all in-tree crates. 2020-06-25 21:17:21 -07:00
rls@1f686d5f70 Update RLS 2020-10-12 13:10:43 +02:00
rust-analyzer@0d03fe6ef5 ⬆️ rust-analyzer 2020-09-14 16:11:06 +02:00
rust-demangler Update rustc-demangle 2020-10-21 21:05:38 +01:00
rust-installer@d66f476b4d Update rust-installer to latest version 2020-07-07 14:15:51 -07:00
rustbook Update mdBook 2020-09-23 16:18:59 -07:00
rustc-workspace-hack Add unbounded_depth to serde_json (clippy-driver) 2020-10-24 22:59:44 +02:00
rustdoc Format the world 2019-12-22 17:42:47 -05:00
rustdoc-js rustdoc: Fix doc aliases with crate filtering 2020-06-23 09:27:37 +01:00
rustdoc-themes Format the world 2019-12-22 17:42:47 -05:00
rustfmt@97d0301011 Update RLS and Rustfmt 2020-10-05 21:40:20 +02:00
tidy Rollup merge of #76607 - Mark-Simulacrum:tidy-bins, r=pnkfelix 2020-10-18 04:11:05 +09:00
tier-check Remove note about missing ios/tvos targets in platform docs. 2020-09-25 12:09:06 -07:00
unicode-table-generator unicode_table_generator: fix clippy::writeln_empty_string, clippy::useless_format, clippy:::for_kv_map 2020-08-24 00:43:50 +02:00
unstable-book-gen Replace write_fmt with write! 2020-09-20 10:35:23 +02:00
publish_toolstate.py Remove mark-i-m from rustc-dev-guide maintainers 2020-10-13 03:13:00 +09:00