diff --git a/src/compiler/rust.rs b/src/compiler/rust.rs index ef68b6c8b..771896ff1 100644 --- a/src/compiler/rust.rs +++ b/src/compiler/rust.rs @@ -1000,7 +1000,6 @@ impl IntoArg for ArgTarget { ArgData! { TooHardFlag, - TooHard(OsString), TooHardPath(PathBuf), NotCompilationFlag, NotCompilation(OsString), @@ -1045,7 +1044,7 @@ counted_array!(static ARGS: [ArgInfo; _] = [ take_arg!("--out-dir", PathBuf, CanBeSeparated('='), OutDir), take_arg!("--pretty", OsString, CanBeSeparated('='), NotCompilation), take_arg!("--print", OsString, CanBeSeparated('='), NotCompilation), - take_arg!("--remap-path-prefix", OsString, CanBeSeparated('='), TooHard), + take_arg!("--remap-path-prefix", OsString, CanBeSeparated('='), PassThrough), take_arg!("--sysroot", PathBuf, CanBeSeparated('='), TooHardPath), take_arg!("--target", ArgTarget, CanBeSeparated('='), Target), take_arg!("--unpretty", OsString, CanBeSeparated('='), NotCompilation), @@ -1088,7 +1087,7 @@ fn parse_arguments(arguments: &[OsString], cwd: &Path) -> CompilerArguments { + Some(TooHardFlag) | Some(TooHardPath(_)) => { cannot_cache!(arg.flag_str().expect("Can't be Argument::Raw/UnknownFlag",)) } Some(NotCompilationFlag) | Some(NotCompilation(_)) => { @@ -3799,6 +3798,34 @@ proc_macro false assert_eq!(h.gcno, Some("foo-a1b6419f8321841f.gcno".into())); } + #[test] + fn test_parse_remap_path_prefix() { + let h = parses!( + "--crate-name", + "foo", + "--crate-type", + "lib", + "./src/lib.rs", + "--emit=dep-info,link", + "--out-dir", + "/out", + "--remap-path-prefix", + "/home/test=~", + "--remap-path-prefix", + "/root=~" + ); + assert!(h.arguments.contains(&Argument::WithValue( + "--remap-path-prefix", + ArgData::PassThrough(OsString::from("/home/test=~")), + ArgDisposition::Separated + ))); + assert!(h.arguments.contains(&Argument::WithValue( + "--remap-path-prefix", + ArgData::PassThrough(OsString::from("/root=~")), + ArgDisposition::Separated + ))); + } + #[test] fn test_parse_target() { // Parse a --target argument that is a string (not a path to a .json file).