From 19eedf98ffa8df52f7be7c003957ef11521551f4 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Thu, 29 Mar 2018 07:03:24 -0400 Subject: [PATCH] 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 ( "\"{}\"" ). --- src/libsyntax/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 98e2528d30f2..6fde67aeb855 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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));