]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/builtin.rs
Auto merge of #44435 - alexcrichton:in-scope, r=michaelwoerister
[rust.git] / src / librustc_lint / builtin.rs
index 73a2966590da684403a5eee8086100df7cd6917a..f3bf37c11a5468866b6feb2cdedabdb7bf2b280f 100644 (file)
@@ -913,7 +913,10 @@ fn expr_refers_to_this_fn(cx: &LateContext, fn_id: ast::NodeId, id: ast::NodeId)
                     } else {
                         return false;
                     };
-                    def.def_id() == cx.tcx.hir.local_def_id(fn_id)
+                    match def {
+                        Def::Local(..) | Def::Upvar(..) => false,
+                        _ => def.def_id() == cx.tcx.hir.local_def_id(fn_id)
+                    }
                 }
                 _ => false,
             }