Rollup merge of #139035 - nnethercote:PatKind-Missing, r=oli-obk
Add new `PatKind::Missing` variants To avoid some ugly uses of `kw::Empty` when handling "missing" patterns, e.g. in bare fn tys. Helps with #137978. Details in the individual commits. r? ``@oli-obk``
This commit is contained in:
commit
82df6229b6
42 changed files with 92 additions and 66 deletions
|
@ -295,6 +295,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
|||
record_variants!(
|
||||
(self, p, p.kind, Some(p.hir_id), hir, Pat, PatKind),
|
||||
[
|
||||
Missing,
|
||||
Wild,
|
||||
Binding,
|
||||
Struct,
|
||||
|
@ -597,6 +598,7 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
|
|||
record_variants!(
|
||||
(self, p, p.kind, None, ast, Pat, PatKind),
|
||||
[
|
||||
Missing,
|
||||
Wild,
|
||||
Ident,
|
||||
Struct,
|
||||
|
|
|
@ -96,7 +96,7 @@ use rustc_middle::query::Providers;
|
|||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::{self, RootVariableMinCaptureList, Ty, TyCtxt};
|
||||
use rustc_session::lint;
|
||||
use rustc_span::{BytePos, Span, Symbol, kw, sym};
|
||||
use rustc_span::{BytePos, Span, Symbol, sym};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use self::LiveNodeKind::*;
|
||||
|
@ -1481,9 +1481,6 @@ impl<'tcx> Liveness<'_, 'tcx> {
|
|||
|
||||
fn should_warn(&self, var: Variable) -> Option<String> {
|
||||
let name = self.ir.variable_name(var);
|
||||
if name == kw::Empty {
|
||||
return None;
|
||||
}
|
||||
let name = name.as_str();
|
||||
if name.as_bytes()[0] == b'_' {
|
||||
return None;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue