Skip to content

Commit 909f449

Browse files
committed
Remove kw::Extra checks that are no longer necessary.
Thanks to the introduction of `PatKind::Missing`.
1 parent 9f089e0 commit 909f449

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

Diff for: compiler/rustc_ast_lowering/src/lib.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1496,13 +1496,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14961496
fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> &'hir [Option<Ident>] {
14971497
self.arena.alloc_from_iter(decl.inputs.iter().map(|param| match param.pat.kind {
14981498
PatKind::Missing => None,
1499-
PatKind::Ident(_, ident, _) => {
1500-
if ident.name != kw::Empty {
1501-
Some(self.lower_ident(ident))
1502-
} else {
1503-
None
1504-
}
1505-
}
1499+
PatKind::Ident(_, ident, _) => Some(self.lower_ident(ident)),
15061500
PatKind::Wild => Some(Ident::new(kw::Underscore, self.lower_span(param.pat.span))),
15071501
_ => {
15081502
self.dcx().span_delayed_bug(

Diff for: compiler/rustc_passes/src/liveness.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ use rustc_middle::query::Providers;
9696
use rustc_middle::span_bug;
9797
use rustc_middle::ty::{self, RootVariableMinCaptureList, Ty, TyCtxt};
9898
use rustc_session::lint;
99-
use rustc_span::{BytePos, Span, Symbol, kw, sym};
99+
use rustc_span::{BytePos, Span, Symbol, sym};
100100
use tracing::{debug, instrument};
101101

102102
use self::LiveNodeKind::*;
@@ -1481,9 +1481,6 @@ impl<'tcx> Liveness<'_, 'tcx> {
14811481

14821482
fn should_warn(&self, var: Variable) -> Option<String> {
14831483
let name = self.ir.variable_name(var);
1484-
if name == kw::Empty {
1485-
return None;
1486-
}
14871484
let name = name.as_str();
14881485
if name.as_bytes()[0] == b'_' {
14891486
return None;

Diff for: compiler/rustc_resolve/src/late.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -3999,22 +3999,17 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
39993999
self.report_error(ident.span, error(ident));
40004000
}
40014001

4002-
// Record as bound if it's valid:
4003-
let ident_valid = ident.name != kw::Empty;
4004-
if ident_valid {
4005-
bindings.last_mut().unwrap().1.insert(ident);
4006-
}
4002+
// Record as bound.
4003+
bindings.last_mut().unwrap().1.insert(ident);
40074004

40084005
if already_bound_or {
40094006
// `Variant1(a) | Variant2(a)`, ok
40104007
// Reuse definition from the first `a`.
40114008
self.innermost_rib_bindings(ValueNS)[&ident]
40124009
} else {
4010+
// A completely fresh binding is added to the set.
40134011
let res = Res::Local(pat_id);
4014-
if ident_valid {
4015-
// A completely fresh binding add to the set if it's valid.
4016-
self.innermost_rib_bindings(ValueNS).insert(ident, res);
4017-
}
4012+
self.innermost_rib_bindings(ValueNS).insert(ident, res);
40184013
res
40194014
}
40204015
}

0 commit comments

Comments
 (0)