Skip to content

Commit 19eedf9

Browse files
committed
Fix escaped backslash in windows file not found message
When a module is declared, but no matching file exists, rustc gives an error like 'help: name the file either foo.rs or foo/mod.rs inside the directory "src/bar"'. However, at on windows, the backslash was double-escaped when naming the directory. It did this because the string was printed in debug mode ( "{:?}" ) to surround it with quotes. However, it should just be printed like any other directory in an error message and surrounded by escaped quotes, rather than relying on the debug print to add quotes ( "\"{}\"" ).
1 parent 482a913 commit 19eedf9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ impl Error {
460460
ref dir_path } => {
461461
let mut err = struct_span_err!(handler, sp, E0583,
462462
"file not found for module `{}`", mod_name);
463-
err.help(&format!("name the file either {} or {} inside the directory {:?}",
463+
err.help(&format!("name the file either {} or {} inside the directory \"{}\"",
464464
default_path,
465465
secondary_path,
466466
dir_path));

0 commit comments

Comments
 (0)