Skip to content

Commit 29eb686

Browse files
committed
Give a better error when --theme is not a CSS file
Before: ``` error: invalid argument: "bacon.toml" ``` After: ``` error: invalid argument: "bacon.toml" | = help: arguments to --theme must be CSS files ```
1 parent a5029ac commit 29eb686

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/librustdoc/config.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,9 @@ impl Options {
439439
return Err(1);
440440
}
441441
if theme_file.extension() != Some(OsStr::new("css")) {
442-
diag.struct_err(&format!("invalid argument: \"{}\"", theme_s)).emit();
442+
diag.struct_err(&format!("invalid argument: \"{}\"", theme_s))
443+
.help("arguments to --theme must have a .css extension")
444+
.emit();
443445
return Err(1);
444446
}
445447
let (success, ret) = theme::test_theme_against(&theme_file, &paths, &diag);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// compile-flags:--theme {{src-base}}/invalid-theme-name.rs
2+
// error-pattern: invalid argument
3+
// error-pattern: must have a .css extension
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: invalid argument: "$DIR/invalid-theme-name.rs"
2+
|
3+
= help: arguments to --theme must have a .css extension
4+

src/tools/compiletest/src/runtest.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1909,8 +1909,7 @@ impl<'test> TestCx<'test> {
19091909
} else {
19101910
Command::new(&self.config.rustdoc_path.clone().expect("no rustdoc built yet"))
19111911
};
1912-
// FIXME Why is -L here?
1913-
rustc.arg(input_file); //.arg("-L").arg(&self.config.build_base);
1912+
rustc.arg(input_file);
19141913

19151914
// Use a single thread for efficiency and a deterministic error message order
19161915
rustc.arg("-Zthreads=1");

0 commit comments

Comments
 (0)