]> git.lizzy.rs Git - rust.git/commitdiff
use full path for E0761
authorhi-rustin <rustin.liu@gmail.com>
Mon, 3 May 2021 10:57:48 +0000 (18:57 +0800)
committerhi-rustin <rustin.liu@gmail.com>
Mon, 3 May 2021 10:57:48 +0000 (18:57 +0800)
compiler/rustc_expand/src/module.rs
src/test/ui/modules_and_files_visibility/mod_file_disambig.stderr

index fd25b8f0440ca7b4f76dcb7d8ef9892edf4edee6..993522d01d86744bec64592c31f698d58a0e7ae2 100644 (file)
@@ -37,7 +37,7 @@ pub enum ModError<'a> {
     CircularInclusion(Vec<PathBuf>),
     ModInBlock(Option<Ident>),
     FileNotFound(Ident, PathBuf),
-    MultipleCandidates(Ident, String, String),
+    MultipleCandidates(Ident, PathBuf, PathBuf),
     ParserError(DiagnosticBuilder<'a>),
 }
 
@@ -220,9 +220,7 @@ pub fn default_submod_path<'a>(
             dir_ownership: DirOwnership::Owned { relative: None },
         }),
         (false, false) => Err(ModError::FileNotFound(ident, default_path)),
-        (true, true) => {
-            Err(ModError::MultipleCandidates(ident, default_path_str, secondary_path_str))
-        }
+        (true, true) => Err(ModError::MultipleCandidates(ident, default_path, secondary_path)),
     }
 }
 
@@ -264,15 +262,15 @@ fn report(self, sess: &Session, span: Span) {
                 ));
                 err
             }
-            ModError::MultipleCandidates(ident, default_path_short, secondary_path_short) => {
+            ModError::MultipleCandidates(ident, default_path, secondary_path) => {
                 let mut err = struct_span_err!(
                     diag,
                     span,
                     E0761,
                     "file for module `{}` found at both \"{}\" and \"{}\"",
                     ident,
-                    default_path_short,
-                    secondary_path_short,
+                    default_path.display(),
+                    secondary_path.display(),
                 );
                 err.help("delete or rename one of them to remove the ambiguity");
                 err
index 804947d38d9ca4822fedf5c2d44e6cd6bc579e29..a2c99396987ef4766437cd0cec1573de64916f98 100644 (file)
@@ -1,4 +1,4 @@
-error[E0761]: file for module `mod_file_disambig_aux` found at both "mod_file_disambig_aux.rs" and "mod_file_disambig_aux/mod.rs"
+error[E0761]: file for module `mod_file_disambig_aux` found at both "$DIR/mod_file_disambig_aux.rs" and "$DIR/mod_file_disambig_aux/mod.rs"
   --> $DIR/mod_file_disambig.rs:1:1
    |
 LL | mod mod_file_disambig_aux;