From 6f09deaa32ba8a4f26a46c28ffecbb3efc3d165e Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Thu, 31 Mar 2016 04:44:04 +0000 Subject: [PATCH] Fix suggestions --- src/librustc_resolve/resolve_imports.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 2f7de8c4aa4..2aa8925fb54 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -537,8 +537,14 @@ fn resolve_import(&mut self, directive: &'b ImportDirective<'b>) -> ResolveResul match (&value_result, &type_result) { (&Indeterminate, _) | (_, &Indeterminate) => return Indeterminate, (&Failed(_), &Failed(_)) => { - let children = target_module.resolutions.borrow(); - let names = children.keys().map(|&(ref name, _)| name); + let resolutions = target_module.resolutions.borrow(); + let names = resolutions.iter().filter_map(|(&(ref name, _), resolution)| { + match *resolution.borrow() { + NameResolution { binding: Some(_), .. } => Some(name), + NameResolution { single_imports: SingleImports::None, .. } => None, + _ => Some(name), + } + }); let lev_suggestion = match find_best_match_for_name(names, &source.as_str(), None) { Some(name) => format!(". Did you mean to use `{}`?", name), None => "".to_owned(),