Skip to content

Commit 461f520

Browse files
committed
use full path for E0761
1 parent f758eb6 commit 461f520

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

compiler/rustc_expand/src/module.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub enum ModError<'a> {
3737
CircularInclusion(Vec<PathBuf>),
3838
ModInBlock(Option<Ident>),
3939
FileNotFound(Ident, PathBuf),
40-
MultipleCandidates(Ident, String, String),
40+
MultipleCandidates(Ident, PathBuf, PathBuf),
4141
ParserError(DiagnosticBuilder<'a>),
4242
}
4343

@@ -220,9 +220,7 @@ pub fn default_submod_path<'a>(
220220
dir_ownership: DirOwnership::Owned { relative: None },
221221
}),
222222
(false, false) => Err(ModError::FileNotFound(ident, default_path)),
223-
(true, true) => {
224-
Err(ModError::MultipleCandidates(ident, default_path_str, secondary_path_str))
225-
}
223+
(true, true) => Err(ModError::MultipleCandidates(ident, default_path, secondary_path)),
226224
}
227225
}
228226

@@ -264,15 +262,15 @@ impl ModError<'_> {
264262
));
265263
err
266264
}
267-
ModError::MultipleCandidates(ident, default_path_short, secondary_path_short) => {
265+
ModError::MultipleCandidates(ident, default_path, secondary_path) => {
268266
let mut err = struct_span_err!(
269267
diag,
270268
span,
271269
E0761,
272270
"file for module `{}` found at both \"{}\" and \"{}\"",
273271
ident,
274-
default_path_short,
275-
secondary_path_short,
272+
default_path.display(),
273+
secondary_path.display(),
276274
);
277275
err.help("delete or rename one of them to remove the ambiguity");
278276
err

src/test/ui/modules_and_files_visibility/mod_file_disambig.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0761]: file for module `mod_file_disambig_aux` found at both "mod_file_disambig_aux.rs" and "mod_file_disambig_aux/mod.rs"
1+
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"
22
--> $DIR/mod_file_disambig.rs:1:1
33
|
44
LL | mod mod_file_disambig_aux;

0 commit comments

Comments
 (0)