File tree 5 files changed +11
-17
lines changed
5 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ fn run_compiler(
249
249
if sopts. describe_lints {
250
250
let mut lint_store = rustc_lint:: new_lint_store (
251
251
sopts. unstable_opts . no_interleave_lints ,
252
- compiler. session ( ) . unstable_options ( ) ,
252
+ compiler. session ( ) . enable_internal_lints ( ) ,
253
253
) ;
254
254
let registered_lints =
255
255
if let Some ( register_lints) = compiler. register_lints ( ) {
Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ pub fn register_plugins<'a>(
210
210
211
211
let mut lint_store = rustc_lint:: new_lint_store (
212
212
sess. opts . unstable_opts . no_interleave_lints ,
213
- sess. unstable_options ( ) ,
213
+ sess. enable_internal_lints ( ) ,
214
214
) ;
215
215
register_lints ( sess, & mut lint_store) ;
216
216
Original file line number Diff line number Diff line change @@ -51,20 +51,6 @@ fn typeck_results_of_method_fn<'tcx>(
51
51
cx : & LateContext < ' tcx > ,
52
52
expr : & Expr < ' _ > ,
53
53
) -> Option < ( Span , DefId , ty:: subst:: SubstsRef < ' tcx > ) > {
54
- // FIXME(rustdoc): Lints which use this function use typecheck results which can cause
55
- // `rustdoc` to error if there are resolution failures.
56
- //
57
- // As internal lints are currently always run if there are `unstable_options`, they are added
58
- // to the lint store of rustdoc. Internal lints are also not used via the `lint_mod` query.
59
- // Crate lints run outside of a query so rustdoc currently doesn't disable them.
60
- //
61
- // Instead of relying on this, either change crate lints to a query disabled by rustdoc, only
62
- // run internal lints if the user is explicitly opting in or figure out a different way to
63
- // avoid running lints for rustdoc.
64
- if cx. tcx . sess . opts . actually_rustdoc {
65
- return None ;
66
- }
67
-
68
54
match expr. kind {
69
55
ExprKind :: MethodCall ( segment, _, _)
70
56
if let Some ( def_id) = cx. typeck_results ( ) . type_dependent_def_id ( expr. hir_id ) =>
Original file line number Diff line number Diff line change @@ -589,6 +589,14 @@ impl Session {
589
589
pub fn time_passes ( & self ) -> bool {
590
590
self . opts . unstable_opts . time_passes || self . opts . unstable_opts . time
591
591
}
592
+
593
+ /// Returns `true` if internal lints should be added to the lint store - i.e. if
594
+ /// `-Zunstable-options` is provided and this isn't rustdoc (internal lints can trigger errors
595
+ /// to be emitted under rustdoc).
596
+ pub fn enable_internal_lints ( & self ) -> bool {
597
+ self . unstable_options ( ) && !self . opts . actually_rustdoc
598
+ }
599
+
592
600
pub fn instrument_mcount ( & self ) -> bool {
593
601
self . opts . unstable_opts . instrument_mcount
594
602
}
Original file line number Diff line number Diff line change @@ -788,7 +788,7 @@ fn main_options(options: config::Options) -> MainResult {
788
788
if sess. opts . describe_lints {
789
789
let mut lint_store = rustc_lint:: new_lint_store (
790
790
sess. opts . unstable_opts . no_interleave_lints ,
791
- sess. unstable_options ( ) ,
791
+ sess. enable_internal_lints ( ) ,
792
792
) ;
793
793
let registered_lints = if let Some ( register_lints) = compiler. register_lints ( ) {
794
794
register_lints ( sess, & mut lint_store) ;
You can’t perform that action at this time.
0 commit comments