Rollup merge of #81310 - tmiasko:in-pattern, r=petrochenkov
Do not mark unit variants as used when in path pattern Record that we are processing a pattern so that code responsible for handling path resolution can correctly decide whether to mark it as used or not. Closes #76788.
This commit is contained in:
commit
04ddf42218
3 changed files with 41 additions and 2 deletions
|
@ -290,6 +290,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
|
|||
}
|
||||
|
||||
fn visit_pat(&mut self, pat: &'tcx hir::Pat<'tcx>) {
|
||||
self.in_pat = true;
|
||||
match pat.kind {
|
||||
PatKind::Struct(ref path, ref fields, _) => {
|
||||
let res = self.typeck_results().qpath_res(path, pat.hir_id);
|
||||
|
@ -302,7 +303,6 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
|
|||
_ => (),
|
||||
}
|
||||
|
||||
self.in_pat = true;
|
||||
intravisit::walk_pat(self, pat);
|
||||
self.in_pat = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue