Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give a better error when --theme is not a CSS file #83705

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,9 @@ impl Options {
return Err(1);
}
if theme_file.extension() != Some(OsStr::new("css")) {
diag.struct_err(&format!("invalid argument: \"{}\"", theme_s)).emit();
diag.struct_err(&format!("invalid argument: \"{}\"", theme_s))
.help("arguments to --theme must have a .css extension")
.emit();
return Err(1);
}
let (success, ret) = theme::test_theme_against(&theme_file, &paths, &diag);
Expand Down
3 changes: 3 additions & 0 deletions src/test/rustdoc-ui/invalid-theme-name.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// compile-flags:--theme {{src-base}}/invalid-theme-name.rs
// error-pattern: invalid argument
// error-pattern: must have a .css extension
4 changes: 4 additions & 0 deletions src/test/rustdoc-ui/invalid-theme-name.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
error: invalid argument: "$DIR/invalid-theme-name.rs"
|
= help: arguments to --theme must have a .css extension

3 changes: 1 addition & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1909,8 +1909,7 @@ impl<'test> TestCx<'test> {
} else {
Command::new(&self.config.rustdoc_path.clone().expect("no rustdoc built yet"))
};
// FIXME Why is -L here?
rustc.arg(input_file); //.arg("-L").arg(&self.config.build_base);
rustc.arg(input_file);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change part of this PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I noticed it while looking for {{src-base}} and it looked super outdated. It's working fine without -L so I don't think the comment is necessary.


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