diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-03-31 10:27:01 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-03-31 14:55:53 -0400 |
| commit | 29eb6860a8104f01ad4bac2b5560d9d66af14a99 (patch) | |
| tree | 6ad07524c1dc0c65000378f2285fe96e05eee9ca | |
| parent | a5029ac0ab372aec515db2e718da6d7787f3d122 (diff) | |
| download | rust-29eb6860a8104f01ad4bac2b5560d9d66af14a99.tar.gz rust-29eb6860a8104f01ad4bac2b5560d9d66af14a99.zip | |
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 ```
| -rw-r--r-- | src/librustdoc/config.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/invalid-theme-name.rs | 3 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/invalid-theme-name.stderr | 4 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 3 |
4 files changed, 11 insertions, 3 deletions
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index ecb6378f31f..471ac8f6cad 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -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); diff --git a/src/test/rustdoc-ui/invalid-theme-name.rs b/src/test/rustdoc-ui/invalid-theme-name.rs new file mode 100644 index 00000000000..c22ebf02718 --- /dev/null +++ b/src/test/rustdoc-ui/invalid-theme-name.rs @@ -0,0 +1,3 @@ +// compile-flags:--theme {{src-base}}/invalid-theme-name.rs +// error-pattern: invalid argument +// error-pattern: must have a .css extension diff --git a/src/test/rustdoc-ui/invalid-theme-name.stderr b/src/test/rustdoc-ui/invalid-theme-name.stderr new file mode 100644 index 00000000000..80204442dbe --- /dev/null +++ b/src/test/rustdoc-ui/invalid-theme-name.stderr @@ -0,0 +1,4 @@ +error: invalid argument: "$DIR/invalid-theme-name.rs" + | + = help: arguments to --theme must have a .css extension + diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 7aa3d4ab09e..91d4e3a26a9 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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); // Use a single thread for efficiency and a deterministic error message order rustc.arg("-Zthreads=1"); |
