diff --git a/libs/toml-rs b/libs/toml-rs index ed88ef0b8..b663d6ae9 160000 --- a/libs/toml-rs +++ b/libs/toml-rs @@ -1 +1 @@ -Subproject commit ed88ef0b8151277cc6a876f2daaeb1c63420717b +Subproject commit b663d6ae99294a0825f4e1b11c5b3110d56bc65f diff --git a/src/cargo/core/source.rs b/src/cargo/core/source.rs index 4e4f3c568..8636acf30 100644 --- a/src/cargo/core/source.rs +++ b/src/cargo/core/source.rs @@ -87,7 +87,12 @@ impl SourceId { // Pass absolute path pub fn for_path(path: &Path) -> SourceId { // TODO: use proper path -> URL - let url = format!("file://{}", path.display()); + let url = if cfg!(windows) { + let path = path.display().to_str(); + format!("file://{}", path.as_slice().replace("\\", "/")) + } else { + format!("file://{}", path.display()) + }; SourceId::new(PathKind, url::from_str(url.as_slice()).unwrap()) } @@ -119,7 +124,11 @@ impl SourceId { match self.kind { GitKind(..) => box GitSource::new(self, config) as Box, PathKind => { - let path = Path::new(self.url.path.as_slice()); + let mut path = self.url.path.clone(); + if cfg!(windows) { + path = path.replace("/", "\\"); + } + let path = Path::new(path); box PathSource::new(&path, self) as Box }, RegistryKind => unimplemented!() diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 69eac3c8c..e5fd43ee8 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -37,7 +37,7 @@ pub fn parse(toml: &str, file: &str) -> CargoResult { for error in parser.errors.iter() { let (loline, locol) = parser.to_linecol(error.lo); let (hiline, hicol) = parser.to_linecol(error.hi); - error_str.push_str(format!("{}:{}:{}{} {}", + error_str.push_str(format!("{}:{}:{}{} {}\n", file, loline + 1, locol + 1, if loline != hiline || locol != hicol { diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 28a7d0225..57bd17dac 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -62,7 +62,7 @@ test!(cargo_compile_with_invalid_manifest2 { execs() .with_status(101) .with_stderr("could not parse input TOML\n\ - Cargo.toml:3:19-3:20 expected a value\n")) + Cargo.toml:3:19-3:20 expected a value\n\n")) }) test!(cargo_compile_without_manifest {