about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2021-09-25 00:22:59 +0900
committerTakayuki Maeda <takoyaki0316@gmail.com>2021-09-25 00:22:59 +0900
commit353d6373ff77853f3399dde04e35ef4e86b8ca00 (patch)
tree45d8e092a7cefbc3fa12390f5f3ae596de59535c
parentcfff31bc833070a00578bd6178160aeed56f28ba (diff)
downloadrust-353d6373ff77853f3399dde04e35ef4e86b8ca00.tar.gz
rust-353d6373ff77853f3399dde04e35ef4e86b8ca00.zip
change the order of path suggestions
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs6
1 files changed, 6 insertions, 0 deletions
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::<Vec<String>>();
+    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 {