diff options
| author | bors <bors@rust-lang.org> | 2023-09-03 14:44:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-03 14:44:09 +0000 |
| commit | 2a1af898b2cb535a45cefe67acf9d023eff16b27 (patch) | |
| tree | 59bee16098d1eaaa121d4e80716fe0e69993b14b /compiler | |
| parent | 49523e336055d4b6f229655ffeb8535d63e46388 (diff) | |
| parent | 38a2d5f43569e86cc164e264f1049858d363b7e2 (diff) | |
| download | rust-2a1af898b2cb535a45cefe67acf9d023eff16b27.tar.gz rust-2a1af898b2cb535a45cefe67acf9d023eff16b27.zip | |
Auto merge of #115510 - GuillaumeGomez:rollup-wh719bn, r=GuillaumeGomez
Rollup of 3 pull requests Successful merges: - #115478 (Emit unused doc comment warnings for pat and expr fields) - #115490 (rustdoc: update comment in search.js for #107629) - #115503 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/mod.rs | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 4b6917fdfdd..de228bdb850 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1001,8 +1001,22 @@ impl EarlyLintPass for UnusedDocComment { warn_if_doc(cx, arm_span, "match arms", &arm.attrs); } + fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &ast::Pat) { + if let ast::PatKind::Struct(_, _, fields, _) = &pat.kind { + for field in fields { + warn_if_doc(cx, field.span, "pattern fields", &field.attrs); + } + } + } + fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) { warn_if_doc(cx, expr.span, "expressions", &expr.attrs); + + if let ExprKind::Struct(s) = &expr.kind { + for field in &s.fields { + warn_if_doc(cx, field.span, "expression fields", &field.attrs); + } + } } fn check_generic_param(&mut self, cx: &EarlyContext<'_>, param: &ast::GenericParam) { diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index c08fe54c39c..7736183027f 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -555,8 +555,8 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { subpattern: pattern, ascription: Ascription { annotation, - /// Note that use `Contravariant` here. See the - /// `variance` field documentation for details. + // Note that use `Contravariant` here. See the + // `variance` field documentation for details. variance: ty::Variance::Contravariant, }, }, |
