about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/module.rs
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2021-05-05 16:00:18 +0800
committerDeadbeef <fee1-dead-beef@protonmail.com>2021-05-06 09:40:05 +0800
commit4617b03316dc5816387a748f0f2e1196be28db23 (patch)
treef16f8ba3ff21291d5d1b380e511a6240e27919db /compiler/rustc_expand/src/module.rs
parent45ccf910703fe7afee30cf223ed046ed2d2afb91 (diff)
downloadrust-4617b03316dc5816387a748f0f2e1196be28db23.tar.gz
rust-4617b03316dc5816387a748f0f2e1196be28db23.zip
E0583: Include secondary path in error message
Diffstat (limited to 'compiler/rustc_expand/src/module.rs')
-rw-r--r--compiler/rustc_expand/src/module.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs
index 993522d01d8..4d777049f0d 100644
--- a/compiler/rustc_expand/src/module.rs
+++ b/compiler/rustc_expand/src/module.rs
@@ -36,7 +36,7 @@ crate struct ParsedExternalMod {
 pub enum ModError<'a> {
     CircularInclusion(Vec<PathBuf>),
     ModInBlock(Option<Ident>),
-    FileNotFound(Ident, PathBuf),
+    FileNotFound(Ident, PathBuf, PathBuf),
     MultipleCandidates(Ident, PathBuf, PathBuf),
     ParserError(DiagnosticBuilder<'a>),
 }
@@ -219,7 +219,7 @@ pub fn default_submod_path<'a>(
             file_path: secondary_path,
             dir_ownership: DirOwnership::Owned { relative: None },
         }),
-        (false, false) => Err(ModError::FileNotFound(ident, default_path)),
+        (false, false) => Err(ModError::FileNotFound(ident, default_path, secondary_path)),
         (true, true) => Err(ModError::MultipleCandidates(ident, default_path, secondary_path)),
     }
 }
@@ -247,7 +247,7 @@ impl ModError<'_> {
                 }
                 err
             }
-            ModError::FileNotFound(ident, default_path) => {
+            ModError::FileNotFound(ident, default_path, secondary_path) => {
                 let mut err = struct_span_err!(
                     diag,
                     span,
@@ -256,9 +256,10 @@ impl ModError<'_> {
                     ident,
                 );
                 err.help(&format!(
-                    "to create the module `{}`, create file \"{}\"",
+                    "to create the module `{}`, create file \"{}\" or \"{}\"",
                     ident,
                     default_path.display(),
+                    secondary_path.display(),
                 ));
                 err
             }