diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 42c31a6e47ea..ea74dffd9fd6 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -3212,6 +3212,18 @@ impl<'a> Resolver<'a> { let name = path[path.len() - 1].node.name; // Make sure error reporting is deterministic. names.sort_by_key(|name| name.as_str()); + + + // Ugly code, just to see if using case insensitive comparison will help + let exact_match = names.iter().find(|x| x.as_str().to_uppercase() == name.as_str().to_uppercase()); + // do not use Levenstein, just return the value we found (if any) + if exact_match.is_some() { + return match exact_match { + Some(found) => Some(found.clone()), + _ => None, + } + } + match find_best_match_for_name(names.iter(), &name.as_str(), None) { Some(found) if found != name => Some(found), _ => None, diff --git a/src/test/ui/issue46332.rs b/src/test/ui/issue46332.rs new file mode 100644 index 000000000000..79de1600ae2d --- /dev/null +++ b/src/test/ui/issue46332.rs @@ -0,0 +1,14 @@ +// Original problem is Levenstein distance. + +fn TyUint() { + println!("TyUint"); +} + +fn TyInt() { + println!("TyInt"); +} + + +fn main() { + TyUInt(); +}