提交 a1d40c81 编写于 作者: N Nick Cameron

save-analysis: skip generated content in patterns

上级 dc309d79
...@@ -937,7 +937,7 @@ fn process_method_call(&mut self, ...@@ -937,7 +937,7 @@ fn process_method_call(&mut self,
fn process_pat(&mut self, p:&ast::Pat) { fn process_pat(&mut self, p:&ast::Pat) {
if generated_code(p.span) { if generated_code(p.span) {
return return;
} }
match p.node { match p.node {
...@@ -963,6 +963,10 @@ fn process_pat(&mut self, p:&ast::Pat) { ...@@ -963,6 +963,10 @@ fn process_pat(&mut self, p:&ast::Pat) {
if let Some(struct_def) = struct_def { if let Some(struct_def) = struct_def {
let struct_fields = self.tcx.lookup_struct_fields(struct_def); let struct_fields = self.tcx.lookup_struct_fields(struct_def);
for &Spanned { node: ref field, span } in fields { for &Spanned { node: ref field, span } in fields {
if generated_code(span) {
continue;
}
let sub_span = self.span.span_for_first_ident(span); let sub_span = self.span.span_for_first_ident(span);
for f in &struct_fields { for f in &struct_fields {
if f.name == field.ident.name { if f.name == field.ident.name {
...@@ -974,7 +978,7 @@ fn process_pat(&mut self, p:&ast::Pat) { ...@@ -974,7 +978,7 @@ fn process_pat(&mut self, p:&ast::Pat) {
break; break;
} }
} }
self.visit_pat(&*field.pat); self.visit_pat(&field.pat);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册