diff options
| author | Evgenii Pashkin <eapashkin@gmail.com> | 2018-06-01 19:56:33 +0300 |
|---|---|---|
| committer | Evgenii Pashkin <eapashkin@gmail.com> | 2018-06-01 21:09:42 +0300 |
| commit | bd6c81aebbda2cc1dfcfa83047db81b358b01a92 (patch) | |
| tree | 90a54e1e4d616d9e2d75c98350725135d9d67dcc /src/libsyntax | |
| parent | 577a5b2703d97e5408664e409f35768944360fea (diff) | |
| download | rust-bd6c81aebbda2cc1dfcfa83047db81b358b01a92.tar.gz rust-bd6c81aebbda2cc1dfcfa83047db81b358b01a92.zip | |
Fix processing mod with multi-level path on Windows
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 28f93328e95..91bf1f6a953 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6149,7 +6149,14 @@ impl<'a> Parser<'a> { } pub fn submod_path_from_attr(attrs: &[Attribute], dir_path: &Path) -> Option<PathBuf> { - attr::first_attr_value_str_by_name(attrs, "path").map(|d| dir_path.join(&d.as_str())) + if let Some(s) = attr::first_attr_value_str_by_name(attrs, "path") { + let s = s.as_str(); + #[cfg(windows)] + let s = s.replace("/", "\\"); + Some(dir_path.join(s)) + } else { + None + } } /// Returns either a path to a module, or . |
