File tree Expand file tree Collapse file tree 5 files changed +11
-17
lines changed Expand file tree Collapse file tree 5 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ fn run_compiler(
249249 if sopts. describe_lints {
250250 let mut lint_store = rustc_lint:: new_lint_store (
251251 sopts. unstable_opts . no_interleave_lints ,
252- compiler. session ( ) . unstable_options ( ) ,
252+ compiler. session ( ) . enable_internal_lints ( ) ,
253253 ) ;
254254 let registered_lints =
255255 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>(
210210
211211 let mut lint_store = rustc_lint:: new_lint_store (
212212 sess. opts . unstable_opts . no_interleave_lints ,
213- sess. unstable_options ( ) ,
213+ sess. enable_internal_lints ( ) ,
214214 ) ;
215215 register_lints ( sess, & mut lint_store) ;
216216
Original file line number Diff line number Diff line change @@ -51,20 +51,6 @@ fn typeck_results_of_method_fn<'tcx>(
5151 cx : & LateContext < ' tcx > ,
5252 expr : & Expr < ' _ > ,
5353) -> 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-
6854 match expr. kind {
6955 ExprKind :: MethodCall ( segment, _, _)
7056 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 {
589589 pub fn time_passes ( & self ) -> bool {
590590 self . opts . unstable_opts . time_passes || self . opts . unstable_opts . time
591591 }
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+
592600 pub fn instrument_mcount ( & self ) -> bool {
593601 self . opts . unstable_opts . instrument_mcount
594602 }
Original file line number Diff line number Diff line change @@ -788,7 +788,7 @@ fn main_options(options: config::Options) -> MainResult {
788788 if sess. opts . describe_lints {
789789 let mut lint_store = rustc_lint:: new_lint_store (
790790 sess. opts . unstable_opts . no_interleave_lints ,
791- sess. unstable_options ( ) ,
791+ sess. enable_internal_lints ( ) ,
792792 ) ;
793793 let registered_lints = if let Some ( register_lints) = compiler. register_lints ( ) {
794794 register_lints ( sess, & mut lint_store) ;
You can’t perform that action at this time.
0 commit comments