mirror of https://github.com/rust-lang/rust.git
Remove `-Zno-interleave-lints`.
Because it complicates lint implementation greatly.
This commit is contained in:
parent
33faf01690
commit
67cfe2cfbb
|
@ -245,10 +245,8 @@ fn run_compiler(
|
|||
interface::run_compiler(config, |compiler| {
|
||||
let sopts = &compiler.session().opts;
|
||||
if sopts.describe_lints {
|
||||
let mut lint_store = rustc_lint::new_lint_store(
|
||||
sopts.unstable_opts.no_interleave_lints,
|
||||
compiler.session().enable_internal_lints(),
|
||||
);
|
||||
let mut lint_store =
|
||||
rustc_lint::new_lint_store(compiler.session().enable_internal_lints());
|
||||
let registered_lints =
|
||||
if let Some(register_lints) = compiler.register_lints() {
|
||||
register_lints(compiler.session(), &mut lint_store);
|
||||
|
|
|
@ -207,10 +207,7 @@ pub fn register_plugins<'a>(
|
|||
});
|
||||
}
|
||||
|
||||
let mut lint_store = rustc_lint::new_lint_store(
|
||||
sess.opts.unstable_opts.no_interleave_lints,
|
||||
sess.enable_internal_lints(),
|
||||
);
|
||||
let mut lint_store = rustc_lint::new_lint_store(sess.enable_internal_lints());
|
||||
register_lints(sess, &mut lint_store);
|
||||
|
||||
let registrars =
|
||||
|
|
|
@ -666,7 +666,6 @@ fn test_unstable_options_tracking_hash() {
|
|||
untracked!(mir_pretty_relative_line_numbers, true);
|
||||
untracked!(nll_facts, true);
|
||||
untracked!(no_analysis, true);
|
||||
untracked!(no_interleave_lints, true);
|
||||
untracked!(no_leak_check, true);
|
||||
untracked!(no_parallel_llvm, true);
|
||||
untracked!(parse_only, true);
|
||||
|
|
|
@ -25,8 +25,6 @@ use rustc_session::Session;
|
|||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::slice;
|
||||
|
||||
macro_rules! run_early_pass { ($cx:expr, $f:ident, $($args:expr),*) => ({
|
||||
$cx.pass.$f(&$cx.context, $($args),*);
|
||||
}) }
|
||||
|
@ -403,43 +401,26 @@ pub fn check_ast_node<'a>(
|
|||
let mut passes: Vec<_> = passes.iter().map(|p| (p)()).collect();
|
||||
let mut buffered = lint_buffer.unwrap_or_default();
|
||||
|
||||
if sess.opts.unstable_opts.no_interleave_lints {
|
||||
for (i, pass) in passes.iter_mut().enumerate() {
|
||||
buffered =
|
||||
sess.prof.verbose_generic_activity_with_arg("run_lint", pass.name()).run(|| {
|
||||
early_lint_node(
|
||||
sess,
|
||||
!pre_expansion && i == 0,
|
||||
lint_store,
|
||||
registered_tools,
|
||||
buffered,
|
||||
EarlyLintPassObjects { lints: slice::from_mut(pass) },
|
||||
check_node,
|
||||
)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
buffered = early_lint_node(
|
||||
sess,
|
||||
!pre_expansion,
|
||||
lint_store,
|
||||
registered_tools,
|
||||
buffered,
|
||||
builtin_lints,
|
||||
check_node,
|
||||
);
|
||||
|
||||
if !passes.is_empty() {
|
||||
buffered = early_lint_node(
|
||||
sess,
|
||||
!pre_expansion,
|
||||
false,
|
||||
lint_store,
|
||||
registered_tools,
|
||||
buffered,
|
||||
builtin_lints,
|
||||
EarlyLintPassObjects { lints: &mut passes[..] },
|
||||
check_node,
|
||||
);
|
||||
|
||||
if !passes.is_empty() {
|
||||
buffered = early_lint_node(
|
||||
sess,
|
||||
false,
|
||||
lint_store,
|
||||
registered_tools,
|
||||
buffered,
|
||||
EarlyLintPassObjects { lints: &mut passes[..] },
|
||||
check_node,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// All of the buffered lints should have been emitted at this point.
|
||||
|
|
|
@ -28,7 +28,6 @@ use rustc_span::Span;
|
|||
|
||||
use std::any::Any;
|
||||
use std::cell::Cell;
|
||||
use std::slice;
|
||||
|
||||
/// Extract the `LintStore` from the query context.
|
||||
/// This function exists because we've erased `LintStore` as `dyn Any` in the context.
|
||||
|
@ -364,11 +363,6 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx>>(
|
|||
module_def_id: LocalDefId,
|
||||
builtin_lints: T,
|
||||
) {
|
||||
if tcx.sess.opts.unstable_opts.no_interleave_lints {
|
||||
// These passes runs in late_lint_crate with -Z no_interleave_lints
|
||||
return;
|
||||
}
|
||||
|
||||
late_lint_mod_pass(tcx, module_def_id, builtin_lints);
|
||||
|
||||
let mut passes: Vec<_> =
|
||||
|
@ -411,33 +405,11 @@ fn late_lint_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, builtin_lints
|
|||
let mut passes =
|
||||
unerased_lint_store(tcx).late_passes.iter().map(|p| (p)(tcx)).collect::<Vec<_>>();
|
||||
|
||||
if !tcx.sess.opts.unstable_opts.no_interleave_lints {
|
||||
if !passes.is_empty() {
|
||||
late_lint_pass_crate(tcx, LateLintPassObjects { lints: &mut passes[..] });
|
||||
}
|
||||
|
||||
late_lint_pass_crate(tcx, builtin_lints);
|
||||
} else {
|
||||
for pass in &mut passes {
|
||||
tcx.sess.prof.verbose_generic_activity_with_arg("run_late_lint", pass.name()).run(
|
||||
|| {
|
||||
late_lint_pass_crate(tcx, LateLintPassObjects { lints: slice::from_mut(pass) });
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
let mut passes: Vec<_> =
|
||||
unerased_lint_store(tcx).late_module_passes.iter().map(|pass| (pass)(tcx)).collect();
|
||||
|
||||
for pass in &mut passes {
|
||||
tcx.sess
|
||||
.prof
|
||||
.verbose_generic_activity_with_arg("run_late_module_lint", pass.name())
|
||||
.run(|| {
|
||||
late_lint_pass_crate(tcx, LateLintPassObjects { lints: slice::from_mut(pass) });
|
||||
});
|
||||
}
|
||||
if !passes.is_empty() {
|
||||
late_lint_pass_crate(tcx, LateLintPassObjects { lints: &mut passes[..] });
|
||||
}
|
||||
|
||||
late_lint_pass_crate(tcx, builtin_lints);
|
||||
}
|
||||
|
||||
/// Performs lint checking on a crate.
|
||||
|
|
|
@ -249,10 +249,10 @@ late_lint_passes!(declare_combined_late_pass, [pub BuiltinCombinedLateLintPass])
|
|||
|
||||
late_lint_mod_passes!(declare_combined_late_pass, [BuiltinCombinedModuleLateLintPass]);
|
||||
|
||||
pub fn new_lint_store(no_interleave_lints: bool, internal_lints: bool) -> LintStore {
|
||||
pub fn new_lint_store(internal_lints: bool) -> LintStore {
|
||||
let mut lint_store = LintStore::new();
|
||||
|
||||
register_builtins(&mut lint_store, no_interleave_lints);
|
||||
register_builtins(&mut lint_store);
|
||||
if internal_lints {
|
||||
register_internals(&mut lint_store);
|
||||
}
|
||||
|
@ -263,54 +263,17 @@ pub fn new_lint_store(no_interleave_lints: bool, internal_lints: bool) -> LintSt
|
|||
/// Tell the `LintStore` about all the built-in lints (the ones
|
||||
/// defined in this crate and the ones defined in
|
||||
/// `rustc_session::lint::builtin`).
|
||||
fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
|
||||
fn register_builtins(store: &mut LintStore) {
|
||||
macro_rules! add_lint_group {
|
||||
($name:expr, $($lint:ident),*) => (
|
||||
store.register_group(false, $name, None, vec![$(LintId::of($lint)),*]);
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! register_early_pass {
|
||||
($method:ident, $ty:ident, $constructor:expr) => {
|
||||
store.register_lints(&$ty::get_lints());
|
||||
store.$method(|| Box::new($constructor));
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! register_late_pass {
|
||||
($method:ident, $ty:ident, $constructor:expr) => {
|
||||
store.register_lints(&$ty::get_lints());
|
||||
store.$method(|_| Box::new($constructor));
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! register_early_passes {
|
||||
($method:ident, [$($passes:ident: $constructor:expr,)*]) => (
|
||||
$(
|
||||
register_early_pass!($method, $passes, $constructor);
|
||||
)*
|
||||
)
|
||||
}
|
||||
|
||||
macro_rules! register_late_passes {
|
||||
($method:ident, [$($passes:ident: $constructor:expr,)*]) => (
|
||||
$(
|
||||
register_late_pass!($method, $passes, $constructor);
|
||||
)*
|
||||
)
|
||||
}
|
||||
|
||||
if no_interleave_lints {
|
||||
pre_expansion_lint_passes!(register_early_passes, register_pre_expansion_pass);
|
||||
early_lint_passes!(register_early_passes, register_early_pass);
|
||||
late_lint_passes!(register_late_passes, register_late_pass);
|
||||
late_lint_mod_passes!(register_late_passes, register_late_mod_pass);
|
||||
} else {
|
||||
store.register_lints(&BuiltinCombinedPreExpansionLintPass::get_lints());
|
||||
store.register_lints(&BuiltinCombinedEarlyLintPass::get_lints());
|
||||
store.register_lints(&BuiltinCombinedModuleLateLintPass::get_lints());
|
||||
store.register_lints(&BuiltinCombinedLateLintPass::get_lints());
|
||||
}
|
||||
store.register_lints(&BuiltinCombinedPreExpansionLintPass::get_lints());
|
||||
store.register_lints(&BuiltinCombinedEarlyLintPass::get_lints());
|
||||
store.register_lints(&BuiltinCombinedModuleLateLintPass::get_lints());
|
||||
store.register_lints(&BuiltinCombinedLateLintPass::get_lints());
|
||||
|
||||
add_lint_group!(
|
||||
"nonstandard_style",
|
||||
|
|
|
@ -1414,8 +1414,6 @@ options! {
|
|||
"run all passes except codegen; no output"),
|
||||
no_generate_arange_section: bool = (false, parse_no_flag, [TRACKED],
|
||||
"omit DWARF address ranges that give faster lookups"),
|
||||
no_interleave_lints: bool = (false, parse_no_flag, [UNTRACKED],
|
||||
"execute lints separately; allows benchmarking individual lints"),
|
||||
no_leak_check: bool = (false, parse_no_flag, [UNTRACKED],
|
||||
"disable the 'leak check' for subtyping; unsound, but useful for tests"),
|
||||
no_link: bool = (false, parse_no_flag, [TRACKED],
|
||||
|
|
|
@ -781,10 +781,7 @@ fn main_args(at_args: &[String]) -> MainResult {
|
|||
let sess = compiler.session();
|
||||
|
||||
if sess.opts.describe_lints {
|
||||
let mut lint_store = rustc_lint::new_lint_store(
|
||||
sess.opts.unstable_opts.no_interleave_lints,
|
||||
sess.enable_internal_lints(),
|
||||
);
|
||||
let mut lint_store = rustc_lint::new_lint_store(sess.enable_internal_lints());
|
||||
let registered_lints = if let Some(register_lints) = compiler.register_lints() {
|
||||
register_lints(sess, &mut lint_store);
|
||||
true
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
-Z no-analysis=val -- parse and expand the source, but run no analysis
|
||||
-Z no-codegen=val -- run all passes except codegen; no output
|
||||
-Z no-generate-arange-section=val -- omit DWARF address ranges that give faster lookups
|
||||
-Z no-interleave-lints=val -- execute lints separately; allows benchmarking individual lints
|
||||
-Z no-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests
|
||||
-Z no-link=val -- compile without linking
|
||||
-Z no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
error: unknown lint: `nonex_lint_top_level`
|
||||
--> $DIR/issue-97094.rs:14:26
|
||||
|
|
||||
LL | #![cfg_attr(all(), allow(nonex_lint_top_level))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-97094.rs:10:9
|
||||
|
|
||||
LL | #![deny(warnings)]
|
||||
| ^^^^^^^^
|
||||
= note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]`
|
||||
|
||||
error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
||||
--> $DIR/issue-97094.rs:16:26
|
||||
|
|
||||
LL | #![cfg_attr(all(), allow(bare_trait_object))]
|
||||
| ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects`
|
||||
|
|
||||
= note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]`
|
||||
|
||||
error: unknown lint: `nonex_lint_mod`
|
||||
--> $DIR/issue-97094.rs:19:25
|
||||
|
|
||||
LL | #[cfg_attr(all(), allow(nonex_lint_mod))]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unknown lint: `nonex_lint_mod_inner`
|
||||
--> $DIR/issue-97094.rs:22:30
|
||||
|
|
||||
LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unknown lint: `nonex_lint_fn`
|
||||
--> $DIR/issue-97094.rs:26:25
|
||||
|
|
||||
LL | #[cfg_attr(all(), allow(nonex_lint_fn))]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: unknown lint: `nonex_lint_in_macro`
|
||||
--> $DIR/issue-97094.rs:37:29
|
||||
|
|
||||
LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unknown lint: `nonex_lint_fn`
|
||||
--> $DIR/issue-97094.rs:56:13
|
||||
|
|
||||
LL | #[allow(nonex_lint_fn)]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
|
@ -1,12 +1,3 @@
|
|||
// revisions: interleaved nointerleaved
|
||||
// [nointerleaved]compile-flags: -Z no-interleave-lints
|
||||
|
||||
// This test has two revisions because the logic change
|
||||
// needed to make this test pass had to be adjusted
|
||||
// for no-interleave-lints. Should the debug option
|
||||
// be removed one day, please don't remove this
|
||||
// test entirely, just remove the revision from it.
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
// Ensure that unknown lints inside cfg-attr's are linted for
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
error: unknown lint: `nonex_lint_top_level`
|
||||
--> $DIR/issue-97094.rs:14:26
|
||||
--> $DIR/issue-97094.rs:5:26
|
||||
|
|
||||
LL | #![cfg_attr(all(), allow(nonex_lint_top_level))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-97094.rs:10:9
|
||||
--> $DIR/issue-97094.rs:1:9
|
||||
|
|
||||
LL | #![deny(warnings)]
|
||||
| ^^^^^^^^
|
||||
= note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]`
|
||||
|
||||
error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
||||
--> $DIR/issue-97094.rs:16:26
|
||||
--> $DIR/issue-97094.rs:7:26
|
||||
|
|
||||
LL | #![cfg_attr(all(), allow(bare_trait_object))]
|
||||
| ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects`
|
||||
|
@ -20,31 +20,31 @@ LL | #![cfg_attr(all(), allow(bare_trait_object))]
|
|||
= note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]`
|
||||
|
||||
error: unknown lint: `nonex_lint_mod`
|
||||
--> $DIR/issue-97094.rs:19:25
|
||||
--> $DIR/issue-97094.rs:10:25
|
||||
|
|
||||
LL | #[cfg_attr(all(), allow(nonex_lint_mod))]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: unknown lint: `nonex_lint_mod_inner`
|
||||
--> $DIR/issue-97094.rs:22:30
|
||||
--> $DIR/issue-97094.rs:13:30
|
||||
|
|
||||
LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unknown lint: `nonex_lint_fn`
|
||||
--> $DIR/issue-97094.rs:26:25
|
||||
--> $DIR/issue-97094.rs:17:25
|
||||
|
|
||||
LL | #[cfg_attr(all(), allow(nonex_lint_fn))]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: unknown lint: `nonex_lint_in_macro`
|
||||
--> $DIR/issue-97094.rs:37:29
|
||||
--> $DIR/issue-97094.rs:28:29
|
||||
|
|
||||
LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unknown lint: `nonex_lint_fn`
|
||||
--> $DIR/issue-97094.rs:56:13
|
||||
--> $DIR/issue-97094.rs:47:13
|
||||
|
|
||||
LL | #[allow(nonex_lint_fn)]
|
||||
| ^^^^^^^^^^^^^
|
Loading…
Reference in New Issue