From 353d6373ff77853f3399dde04e35ef4e86b8ca00 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Sat, 25 Sep 2021 00:22:59 +0900 Subject: [PATCH] change the order of path suggestions --- compiler/rustc_resolve/src/diagnostics.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 0b1687d1bd8..7e79de102ae 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1707,6 +1707,12 @@ crate fn show_candidates( candidates.iter().map(|c| path_names_to_string(&c.path)).collect(); path_strings.sort(); + let core_path_strings = + path_strings.iter().filter(|p| p.starts_with("core::")).cloned().collect::>(); + if !core_path_strings.is_empty() { + path_strings.retain(|p| !p.starts_with("core::")); + } + path_strings.extend(core_path_strings); path_strings.dedup(); let (determiner, kind) = if candidates.len() == 1 {