Skip to content

Commit a766d63

Browse files
authored
Rollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomez
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 ``` cc #83478
2 parents 335a3c4 + 29eb686 commit a766d63

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
@@ -484,7 +484,9 @@ impl Options {
484484
return Err(1);
485485
}
486486
if theme_file.extension() != Some(OsStr::new("css")) {
487-
diag.struct_err(&format!("invalid argument: \"{}\"", theme_s)).emit();
487+
diag.struct_err(&format!("invalid argument: \"{}\"", theme_s))
488+
.help("arguments to --theme must have a .css extension")
489+
.emit();
488490
return Err(1);
489491
}
490492
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)