Skip to content

Commit 60c9f56

Browse files
committed
Rollup merge of #21981 - pnkfelix:improve-compile-test-malformed-option-handling, r=huonw
improve `compiletest` error message when path option missing. I often run `compiletest` by hand by cut-and-pasting from what `make` runs, (which I observe via `remake --trace`), but then I need to tweak it (cut out options) and its useful to be told when I have removed an option that is actually required, such as `--android-cross-path=path`.)
2 parents 05e45d0 + 1e8e7dc commit 60c9f56

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/compiletest/compiletest.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ pub fn parse_config(args: Vec<String> ) -> Config {
118118
}
119119

120120
fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
121-
Path::new(m.opt_str(nm).unwrap())
121+
match m.opt_str(nm) {
122+
Some(s) => Path::new(s),
123+
None => panic!("no option (=path) found for {}", nm),
124+
}
122125
}
123126

124127
let filter = if !matches.free.is_empty() {

0 commit comments

Comments
 (0)