about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-03 13:12:02 +0200
committerGitHub <noreply@github.com>2019-08-03 13:12:02 +0200
commit2fd954803983c19a8ba95f817caf080f2b521f20 (patch)
tree03a613e99ec93e4b5ca2ed667280166b0d4ebfc5 /src/librustc
parent6a38ef7abd75d28dd61bd939423468d64789b076 (diff)
parent8235b6f8c37ca531279c5da5663120ea4ec8e0b3 (diff)
downloadrust-2fd954803983c19a8ba95f817caf080f2b521f20.tar.gz
rust-2fd954803983c19a8ba95f817caf080f2b521f20.zip
Rollup merge of #63227 - jakubadamw:issue-63151, r=estebank
dead_code: Properly inspect fields in struct patterns with type relative paths

Closes #63151.
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/middle/dead.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index 1e4e3531e5f..fefb3dc076d 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -269,8 +269,9 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
 
     fn visit_pat(&mut self, pat: &'tcx hir::Pat) {
         match pat.node {
-            PatKind::Struct(hir::QPath::Resolved(_, ref path), ref fields, _) => {
-                self.handle_field_pattern_match(pat, path.res, fields);
+            PatKind::Struct(ref path, ref fields, _) => {
+                let res = self.tables.qpath_res(path, pat.hir_id);
+                self.handle_field_pattern_match(pat, res, fields);
             }
             PatKind::Path(ref qpath @ hir::QPath::TypeRelative(..)) => {
                 let res = self.tables.qpath_res(qpath, pat.hir_id);