Skip to content

Commit b2a1c8a

Browse files
committed
Don't run allowed lints for _all_ users of the compiler, not just rustc
1 parent 11f7dcc commit b2a1c8a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/librustc_driver/lib.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use rustc_serialize::json::{self, ToJson};
3535
use rustc_session::config::nightly_options;
3636
use rustc_session::config::{ErrorOutputType, Input, OutputType, PrintRequest};
3737
use rustc_session::getopts;
38-
use rustc_session::lint::{Level, Lint, LintId};
38+
use rustc_session::lint::{Lint, LintId};
3939
use rustc_session::{config, DiagnosticOutput, Session};
4040
use rustc_session::{early_error, early_warn};
4141
use rustc_span::source_map::{FileLoader, FileName};
@@ -256,12 +256,6 @@ pub fn run_compiler(
256256
};
257257

258258
callbacks.config(&mut config);
259-
// Since the warnings from these lints will never be shown, there is no need to run them at all!
260-
if let Some(Level::Allow) = config.opts.lint_cap {
261-
config.override_queries = Some(|_, providers, _| {
262-
providers.lint_mod = |_, _| {};
263-
});
264-
}
265259

266260
interface::run_compiler(config, |compiler| {
267261
let sess = compiler.session();

src/librustc_interface/interface.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,14 @@ pub struct Config {
158158
pub registry: Registry,
159159
}
160160

161-
pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R) -> R {
161+
pub fn create_compiler_and_run<R>(mut config: Config, f: impl FnOnce(&Compiler) -> R) -> R {
162+
// Since the warnings from these lints will never be shown, there is no need to run them at all!
163+
if let Some(lint::Level::Allow) = config.opts.lint_cap {
164+
config.override_queries = Some(|_, providers, _| {
165+
providers.lint_mod = |_, _| {};
166+
});
167+
}
168+
162169
let registry = &config.registry;
163170
let (sess, codegen_backend) = util::create_session(
164171
config.opts,

0 commit comments

Comments
 (0)