Skip to content

Commit bd6c81a

Browse files
committed
Fix processing mod with multi-level path on Windows
1 parent 577a5b2 commit bd6c81a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6149,7 +6149,14 @@ impl<'a> Parser<'a> {
61496149
}
61506150

61516151
pub fn submod_path_from_attr(attrs: &[Attribute], dir_path: &Path) -> Option<PathBuf> {
6152-
attr::first_attr_value_str_by_name(attrs, "path").map(|d| dir_path.join(&d.as_str()))
6152+
if let Some(s) = attr::first_attr_value_str_by_name(attrs, "path") {
6153+
let s = s.as_str();
6154+
#[cfg(windows)]
6155+
let s = s.replace("/", "\\");
6156+
Some(dir_path.join(s))
6157+
} else {
6158+
None
6159+
}
61536160
}
61546161

61556162
/// Returns either a path to a module, or .

0 commit comments

Comments
 (0)