@@ -33,7 +33,7 @@ use rustc_feature::find_gated_cfg;
33
33
use rustc_fluent_macro:: fluent_messages;
34
34
use rustc_interface:: util:: { self , collect_crate_types, get_codegen_backend} ;
35
35
use rustc_interface:: { interface, Queries } ;
36
- use rustc_lint:: { unerased_lint_store, LintStore } ;
36
+ use rustc_lint:: unerased_lint_store;
37
37
use rustc_metadata:: locator;
38
38
use rustc_session:: config:: { nightly_options, CG_OPTIONS , Z_OPTIONS } ;
39
39
use rustc_session:: config:: { ErrorOutputType , Input , OutFileName , OutputType , TrimmedDefPaths } ;
@@ -356,16 +356,7 @@ fn run_compiler(
356
356
let handler = EarlyErrorHandler :: new( sopts. error_format) ;
357
357
358
358
if sopts. describe_lints {
359
- let mut lint_store =
360
- rustc_lint:: new_lint_store( compiler. session( ) . enable_internal_lints( ) ) ;
361
- let registered_lints =
362
- if let Some ( register_lints) = compiler. register_lints( ) {
363
- register_lints( compiler. session( ) , & mut lint_store) ;
364
- true
365
- } else {
366
- false
367
- } ;
368
- describe_lints( compiler. session( ) , & lint_store, registered_lints) ;
359
+ describe_lints( compiler. session( ) ) ;
369
360
return ;
370
361
}
371
362
let should_stop = print_crate_info(
@@ -442,9 +433,7 @@ fn run_compiler(
442
433
}
443
434
444
435
if sess. opts. describe_lints {
445
- queries
446
- . global_ctxt( ) ?
447
- . enter( |tcx| describe_lints( sess, unerased_lint_store( tcx) , true ) ) ;
436
+ describe_lints( sess) ;
448
437
return early_exit( ) ;
449
438
}
450
439
@@ -991,7 +980,7 @@ the command line flag directly.
991
980
}
992
981
993
982
/// Write to stdout lint command options, together with a list of all available lints
994
- pub fn describe_lints( sess: & Session , lint_store : & LintStore , loaded_lints : bool ) {
983
+ pub fn describe_lints( sess: & Session ) {
995
984
safe_println!(
996
985
"
997
986
Available lint options:
@@ -1017,6 +1006,7 @@ Available lint options:
1017
1006
lints
1018
1007
}
1019
1008
1009
+ let lint_store = unerased_lint_store( sess) ;
1020
1010
let ( loaded, builtin) : ( Vec <_>, _) =
1021
1011
lint_store. get_lints( ) . iter( ) . cloned( ) . partition( |& lint| lint. is_loaded) ;
1022
1012
let loaded = sort_lints( sess, loaded) ;
@@ -1094,7 +1084,7 @@ Available lint options:
1094
1084
1095
1085
print_lint_groups( builtin_groups, true ) ;
1096
1086
1097
- match ( loaded_lints , loaded. len( ) , loaded_groups. len( ) ) {
1087
+ match ( sess . registered_lints , loaded. len( ) , loaded_groups. len( ) ) {
1098
1088
( false , 0 , _) | ( false , _, 0 ) => {
1099
1089
safe_println!( "Lint tools like Clippy can load additional lints and lint groups." ) ;
1100
1090
}
0 commit comments