From f5e005f0ca0b6fbc427315fa7e6943f4b738e12d Mon Sep 17 00:00:00 2001 From: David Wood Date: Tue, 26 Jul 2022 11:42:27 +0100 Subject: session: disable internal lints for rustdoc If an internal lint uses `typeck_results` or similar queries then that can result in rustdoc checking code that it shouldn't (e.g. from other platforms) and emit compilation errors. Signed-off-by: David Wood --- compiler/rustc_session/src/session.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/rustc_session/src') diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 854cad79a20..ac4a6b6da6f 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -589,6 +589,14 @@ impl Session { pub fn time_passes(&self) -> bool { self.opts.unstable_opts.time_passes || self.opts.unstable_opts.time } + + /// Returns `true` if internal lints should be added to the lint store - i.e. if + /// `-Zunstable-options` is provided and this isn't rustdoc (internal lints can trigger errors + /// to be emitted under rustdoc). + pub fn enable_internal_lints(&self) -> bool { + self.unstable_options() && !self.opts.actually_rustdoc + } + pub fn instrument_mcount(&self) -> bool { self.opts.unstable_opts.instrument_mcount } -- cgit 1.4.1-3-g733a5