about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_resolve/lib.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 2444f6acced..36053d3c4ff 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -2422,13 +2422,16 @@ impl<'a> Resolver<'a> {
                                 }
                             }
                         }
-                    } else if let Err(false) = self.resolve_path(pat_id, &path, 0, ValueNS) {
-                        resolve_error(
-                            self,
-                            path.span,
-                            ResolutionError::UnresolvedEnumVariantStructOrConst(
-                                &path.segments.last().unwrap().identifier.name.as_str())
-                        );
+                    } else {
+                        if let Err(false) = self.resolve_path(pat_id, &path, 0, ValueNS) {
+                            // No error has been reported, so we need to do this ourselves.
+                            resolve_error(
+                                self,
+                                path.span,
+                                ResolutionError::UnresolvedEnumVariantStructOrConst(
+                                    &path.segments.last().unwrap().identifier.name.as_str())
+                            );
+                        }
                         self.record_def(pattern.id, err_path_resolution());
                     }
                     visit::walk_path(self, path);