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
|
@ -4009,22 +4009,17 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
|
|||
self.report_error(ident.span, error(ident));
|
||||
}
|
||||
|
||||
// Record as bound if it's valid:
|
||||
let ident_valid = ident.name != kw::Empty;
|
||||
if ident_valid {
|
||||
bindings.last_mut().unwrap().1.insert(ident);
|
||||
}
|
||||
// Record as bound.
|
||||
bindings.last_mut().unwrap().1.insert(ident);
|
||||
|
||||
if already_bound_or {
|
||||
// `Variant1(a) | Variant2(a)`, ok
|
||||
// Reuse definition from the first `a`.
|
||||
self.innermost_rib_bindings(ValueNS)[&ident]
|
||||
} else {
|
||||
// A completely fresh binding is added to the set.
|
||||
let res = Res::Local(pat_id);
|
||||
if ident_valid {
|
||||
// A completely fresh binding add to the set if it's valid.
|
||||
self.innermost_rib_bindings(ValueNS).insert(ident, res);
|
||||
}
|
||||
self.innermost_rib_bindings(ValueNS).insert(ident, res);
|
||||
res
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue