Rollup merge of #98799 - jyn514:rustdoc-lint-help, r=GuillaumeGomez

Fix bug in `rustdoc -Whelp`

Previously, this printed the debugging options, not the lint options,
and only handled `-Whelp`, not `-A/-D/-F`.

This also fixes a few other misc issues:
- Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests
- Add lint headers for tool lints, not just builtin lints

https://github.com/rust-lang/rust/pull/98533#issuecomment-1172004197

r? ```@GuillaumeGomez```
This commit is contained in:
Ralf Jung
2022-07-03 16:41:57 -04:00
committed by GitHub
10 changed files with 70 additions and 423 deletions

View File

@@ -75,7 +75,7 @@ use std::env::{self, VarError};
use std::io;
use std::process;
use rustc_driver::{abort_on_err, describe_lints};
use rustc_driver::abort_on_err;
use rustc_errors::ErrorGuaranteed;
use rustc_interface::interface;
use rustc_middle::ty::TyCtxt;
@@ -770,15 +770,24 @@ fn main_options(options: config::Options) -> MainResult {
let config = core::create_config(options);
interface::create_compiler_and_run(config, |compiler| {
let sess = compiler.session();
if sess.opts.describe_lints {
let mut lint_store = rustc_lint::new_lint_store(
sess.opts.debugging_opts.no_interleave_lints,
sess.unstable_options(),
);
let registered_lints = if let Some(register_lints) = compiler.register_lints() {
register_lints(sess, &mut lint_store);
true
} else {
false
};
rustc_driver::describe_lints(sess, &lint_store, registered_lints);
return Ok(());
}
compiler.enter(|queries| {
let sess = compiler.session();
if sess.opts.describe_lints {
let (_, lint_store) = &*queries.register_plugins()?.peek();
describe_lints(sess, lint_store, true);
return Ok(());
}
// We need to hold on to the complete resolver, so we cause everything to be
// cloned for the analysis passes to use. Suboptimal, but necessary in the
// current architecture.