Skip to content

Commit

Permalink
Fix escaped backslash in windows file not found message
Browse files Browse the repository at this point in the history
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 ( "\"{}\"" ).
  • Loading branch information
Phlosioneer committed Mar 29, 2018
1 parent 482a913 commit 19eedf9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ impl Error {
ref dir_path } => {
let mut err = struct_span_err!(handler, sp, E0583,
"file not found for module `{}`", mod_name);
err.help(&format!("name the file either {} or {} inside the directory {:?}",
err.help(&format!("name the file either {} or {} inside the directory \"{}\"",
default_path,
secondary_path,
dir_path));
Expand Down

0 comments on commit 19eedf9

Please sign in to comment.