Add listing of lints (eg via -W help) to rustdoc

This commit is contained in:
Alan Egerton
2021-04-06 02:09:43 +01:00
parent d322385321
commit 4d23c8e9a1
5 changed files with 43 additions and 4 deletions

View File

@@ -74,7 +74,7 @@ use std::default::Default;
use std::env;
use std::process;
use rustc_driver::abort_on_err;
use rustc_driver::{abort_on_err, describe_lints};
use rustc_errors::ErrorReported;
use rustc_interface::interface;
use rustc_middle::ty::TyCtxt;
@@ -705,6 +705,12 @@ fn main_options(options: config::Options) -> MainResult {
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.