Skip to content

Commit 380d53f

Browse files
committed
Check namespace before computing the Levenshtein distance
1 parent f93bd00 commit 380d53f

File tree

1 file changed

+4
-1
lines changed
  • compiler/rustc_typeck/src/check/method

1 file changed

+4
-1
lines changed

compiler/rustc_typeck/src/check/method/probe.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1904,8 +1904,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
19041904
.associated_items(def_id)
19051905
.in_definition_order()
19061906
.filter(|x| {
1907+
if x.kind.namespace() != Namespace::ValueNS {
1908+
return false;
1909+
}
19071910
let dist = lev_distance(name.as_str(), x.name.as_str());
1908-
x.kind.namespace() == Namespace::ValueNS && dist > 0 && dist <= max_dist
1911+
dist > 0 && dist <= max_dist
19091912
})
19101913
.copied()
19111914
.collect()

0 commit comments

Comments
 (0)