1
Fork 0

Auto merge of #104863 - nnethercote:reduce-lint-macros, r=cjgillot

Reduce macro usage for lints

r? `@cjgillot`
This commit is contained in:
bors 2022-12-02 15:31:15 +00:00
commit e960b5e774
24 changed files with 254 additions and 550 deletions

View file

@ -245,10 +245,8 @@ fn run_compiler(
interface::run_compiler(config, |compiler| { interface::run_compiler(config, |compiler| {
let sopts = &compiler.session().opts; let sopts = &compiler.session().opts;
if sopts.describe_lints { if sopts.describe_lints {
let mut lint_store = rustc_lint::new_lint_store( let mut lint_store =
sopts.unstable_opts.no_interleave_lints, rustc_lint::new_lint_store(compiler.session().enable_internal_lints());
compiler.session().enable_internal_lints(),
);
let registered_lints = let registered_lints =
if let Some(register_lints) = compiler.register_lints() { if let Some(register_lints) = compiler.register_lints() {
register_lints(compiler.session(), &mut lint_store); register_lints(compiler.session(), &mut lint_store);

View file

@ -207,10 +207,7 @@ pub fn register_plugins<'a>(
}); });
} }
let mut lint_store = rustc_lint::new_lint_store( let mut lint_store = rustc_lint::new_lint_store(sess.enable_internal_lints());
sess.opts.unstable_opts.no_interleave_lints,
sess.enable_internal_lints(),
);
register_lints(sess, &mut lint_store); register_lints(sess, &mut lint_store);
let registrars = let registrars =

View file

@ -666,7 +666,6 @@ fn test_unstable_options_tracking_hash() {
untracked!(mir_pretty_relative_line_numbers, true); untracked!(mir_pretty_relative_line_numbers, true);
untracked!(nll_facts, true); untracked!(nll_facts, true);
untracked!(no_analysis, true); untracked!(no_analysis, true);
untracked!(no_interleave_lints, true);
untracked!(no_leak_check, true); untracked!(no_leak_check, true);
untracked!(no_parallel_llvm, true); untracked!(no_parallel_llvm, true);
untracked!(parse_only, true); untracked!(parse_only, true);

View file

@ -25,8 +25,6 @@ use rustc_session::Session;
use rustc_span::symbol::Ident; use rustc_span::symbol::Ident;
use rustc_span::Span; use rustc_span::Span;
use std::slice;
macro_rules! run_early_pass { ($cx:expr, $f:ident, $($args:expr),*) => ({ macro_rules! run_early_pass { ($cx:expr, $f:ident, $($args:expr),*) => ({
$cx.pass.$f(&$cx.context, $($args),*); $cx.pass.$f(&$cx.context, $($args),*);
}) } }) }
@ -300,20 +298,14 @@ impl LintPass for EarlyLintPassObjects<'_> {
} }
} }
macro_rules! expand_early_lint_pass_impl_methods {
([$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
$(fn $name(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) {
for obj in self.lints.iter_mut() {
obj.$name(context, $($param),*);
}
})*
)
}
macro_rules! early_lint_pass_impl { macro_rules! early_lint_pass_impl {
([], [$($methods:tt)*]) => ( ([], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
impl EarlyLintPass for EarlyLintPassObjects<'_> { impl EarlyLintPass for EarlyLintPassObjects<'_> {
expand_early_lint_pass_impl_methods!([$($methods)*]); $(fn $name(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) {
for obj in self.lints.iter_mut() {
obj.$name(context, $($param),*);
}
})*
} }
) )
} }
@ -371,87 +363,36 @@ impl<'a> EarlyCheckNode<'a> for (ast::NodeId, &'a [ast::Attribute], &'a [P<ast::
} }
} }
fn early_lint_node<'a>(
sess: &Session,
warn_about_weird_lints: bool,
lint_store: &LintStore,
registered_tools: &RegisteredTools,
buffered: LintBuffer,
pass: impl EarlyLintPass,
check_node: impl EarlyCheckNode<'a>,
) -> LintBuffer {
let mut cx = EarlyContextAndPass {
context: EarlyContext::new(
sess,
warn_about_weird_lints,
lint_store,
registered_tools,
buffered,
),
pass,
};
cx.with_lint_attrs(check_node.id(), check_node.attrs(), |cx| check_node.check(cx));
cx.context.buffered
}
pub fn check_ast_node<'a>( pub fn check_ast_node<'a>(
sess: &Session, sess: &Session,
pre_expansion: bool, pre_expansion: bool,
lint_store: &LintStore, lint_store: &LintStore,
registered_tools: &RegisteredTools, registered_tools: &RegisteredTools,
lint_buffer: Option<LintBuffer>, lint_buffer: Option<LintBuffer>,
builtin_lints: impl EarlyLintPass, builtin_lints: impl EarlyLintPass + 'static,
check_node: impl EarlyCheckNode<'a>, check_node: impl EarlyCheckNode<'a>,
) { ) {
let passes = let passes =
if pre_expansion { &lint_store.pre_expansion_passes } else { &lint_store.early_passes }; if pre_expansion { &lint_store.pre_expansion_passes } else { &lint_store.early_passes };
let mut passes: Vec<_> = passes.iter().map(|p| (p)()).collect(); let mut passes: Vec<_> = passes.iter().map(|p| (p)()).collect();
let mut buffered = lint_buffer.unwrap_or_default(); passes.push(Box::new(builtin_lints));
if sess.opts.unstable_opts.no_interleave_lints { let mut cx = EarlyContextAndPass {
for (i, pass) in passes.iter_mut().enumerate() { context: EarlyContext::new(
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, sess,
!pre_expansion, !pre_expansion,
lint_store, lint_store,
registered_tools, registered_tools,
buffered, lint_buffer.unwrap_or_default(),
builtin_lints, ),
check_node, pass: EarlyLintPassObjects { lints: &mut passes[..] },
); };
cx.with_lint_attrs(check_node.id(), check_node.attrs(), |cx| check_node.check(cx));
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. // All of the buffered lints should have been emitted at this point.
// If not, that means that we somehow buffered a lint for a node id // If not, that means that we somehow buffered a lint for a node id
// that was not lint-checked (perhaps it doesn't exist?). This is a bug. // that was not lint-checked (perhaps it doesn't exist?). This is a bug.
for (id, lints) in buffered.map { for (id, lints) in cx.context.buffered.map {
for early_lint in lints { for early_lint in lints {
sess.delay_span_bug( sess.delay_span_bug(
early_lint.span, early_lint.span,

View file

@ -28,7 +28,6 @@ use rustc_span::Span;
use std::any::Any; use std::any::Any;
use std::cell::Cell; use std::cell::Cell;
use std::slice;
/// Extract the `LintStore` from the query context. /// Extract the `LintStore` from the query context.
/// This function exists because we've erased `LintStore` as `dyn Any` in the context. /// This function exists because we've erased `LintStore` as `dyn Any` in the context.
@ -313,45 +312,42 @@ impl LintPass for LateLintPassObjects<'_, '_> {
} }
} }
macro_rules! expand_late_lint_pass_impl_methods {
([$hir:tt], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
$(fn $name(&mut self, context: &LateContext<$hir>, $($param: $arg),*) {
for obj in self.lints.iter_mut() {
obj.$name(context, $($param),*);
}
})*
)
}
macro_rules! late_lint_pass_impl { macro_rules! late_lint_pass_impl {
([], [$hir:tt], $methods:tt) => { ([], [$hir:tt], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => {
impl<$hir> LateLintPass<$hir> for LateLintPassObjects<'_, $hir> { impl<$hir> LateLintPass<$hir> for LateLintPassObjects<'_, $hir> {
expand_late_lint_pass_impl_methods!([$hir], $methods); $(fn $name(&mut self, context: &LateContext<$hir>, $($param: $arg),*) {
for obj in self.lints.iter_mut() {
obj.$name(context, $($param),*);
}
})*
} }
}; };
} }
crate::late_lint_methods!(late_lint_pass_impl, [], ['tcx]); crate::late_lint_methods!(late_lint_pass_impl, [], ['tcx]);
fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>( pub(super) fn late_lint_mod<'tcx, T: LateLintPass<'tcx> + 'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
module_def_id: LocalDefId, module_def_id: LocalDefId,
pass: T, builtin_lints: T,
) { ) {
let effective_visibilities = &tcx.effective_visibilities(());
let context = LateContext { let context = LateContext {
tcx, tcx,
enclosing_body: None, enclosing_body: None,
cached_typeck_results: Cell::new(None), cached_typeck_results: Cell::new(None),
param_env: ty::ParamEnv::empty(), param_env: ty::ParamEnv::empty(),
effective_visibilities, effective_visibilities: &tcx.effective_visibilities(()),
lint_store: unerased_lint_store(tcx), lint_store: unerased_lint_store(tcx),
last_node_with_lint_attrs: tcx.hir().local_def_id_to_hir_id(module_def_id), last_node_with_lint_attrs: tcx.hir().local_def_id_to_hir_id(module_def_id),
generics: None, generics: None,
only_module: true, only_module: true,
}; };
let mut passes: Vec<_> =
unerased_lint_store(tcx).late_module_passes.iter().map(|pass| (pass)(tcx)).collect();
passes.push(Box::new(builtin_lints));
let pass = LateLintPassObjects { lints: &mut passes[..] };
let mut cx = LateContextAndPass { context, pass }; let mut cx = LateContextAndPass { context, pass };
let (module, _span, hir_id) = tcx.hir().get_module(module_def_id); let (module, _span, hir_id) = tcx.hir().get_module(module_def_id);
@ -365,46 +361,29 @@ fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
} }
} }
pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx>>( fn late_lint_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(tcx: TyCtxt<'tcx>, builtin_lints: T) {
tcx: TyCtxt<'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<_> =
unerased_lint_store(tcx).late_module_passes.iter().map(|pass| (pass)(tcx)).collect();
if !passes.is_empty() {
late_lint_mod_pass(tcx, module_def_id, LateLintPassObjects { lints: &mut passes[..] });
}
}
fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T) {
let effective_visibilities = &tcx.effective_visibilities(());
let context = LateContext { let context = LateContext {
tcx, tcx,
enclosing_body: None, enclosing_body: None,
cached_typeck_results: Cell::new(None), cached_typeck_results: Cell::new(None),
param_env: ty::ParamEnv::empty(), param_env: ty::ParamEnv::empty(),
effective_visibilities, effective_visibilities: &tcx.effective_visibilities(()),
lint_store: unerased_lint_store(tcx), lint_store: unerased_lint_store(tcx),
last_node_with_lint_attrs: hir::CRATE_HIR_ID, last_node_with_lint_attrs: hir::CRATE_HIR_ID,
generics: None, generics: None,
only_module: false, only_module: false,
}; };
let mut passes =
unerased_lint_store(tcx).late_passes.iter().map(|p| (p)(tcx)).collect::<Vec<_>>();
passes.push(Box::new(builtin_lints));
let pass = LateLintPassObjects { lints: &mut passes[..] };
let mut cx = LateContextAndPass { context, pass }; let mut cx = LateContextAndPass { context, pass };
// Visit the whole crate. // Visit the whole crate.
cx.with_lint_attrs(hir::CRATE_HIR_ID, |cx| { cx.with_lint_attrs(hir::CRATE_HIR_ID, |cx| {
// since the root module isn't visited as an item (because it isn't an // Since the root module isn't visited as an item (because it isn't an
// item), warn for it here. // item), warn for it here.
lint_callback!(cx, check_crate,); lint_callback!(cx, check_crate,);
tcx.hir().walk_toplevel_module(cx); tcx.hir().walk_toplevel_module(cx);
@ -413,41 +392,8 @@ fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T)
}) })
} }
fn late_lint_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, builtin_lints: T) {
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) });
});
}
}
}
/// Performs lint checking on a crate. /// Performs lint checking on a crate.
pub fn check_crate<'tcx, T: LateLintPass<'tcx>>( pub fn check_crate<'tcx, T: LateLintPass<'tcx> + 'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
builtin_lints: impl FnOnce() -> T + Send, builtin_lints: impl FnOnce() -> T + Send,
) { ) {

View file

@ -127,132 +127,116 @@ fn lint_mod(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
late::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new()); late::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new());
} }
macro_rules! pre_expansion_lint_passes { early_lint_methods!(
($macro:path, $args:tt) => { declare_combined_early_lint_pass,
$macro!($args, [KeywordIdents: KeywordIdents,]); [
}; pub BuiltinCombinedPreExpansionLintPass,
} [
KeywordIdents: KeywordIdents,
]
]
);
macro_rules! early_lint_passes { early_lint_methods!(
($macro:path, $args:tt) => { declare_combined_early_lint_pass,
$macro!( [
$args, pub BuiltinCombinedEarlyLintPass,
[ [
UnusedParens: UnusedParens, UnusedParens: UnusedParens,
UnusedBraces: UnusedBraces, UnusedBraces: UnusedBraces,
UnusedImportBraces: UnusedImportBraces, UnusedImportBraces: UnusedImportBraces,
UnsafeCode: UnsafeCode, UnsafeCode: UnsafeCode,
SpecialModuleName: SpecialModuleName, SpecialModuleName: SpecialModuleName,
AnonymousParameters: AnonymousParameters, AnonymousParameters: AnonymousParameters,
EllipsisInclusiveRangePatterns: EllipsisInclusiveRangePatterns::default(), EllipsisInclusiveRangePatterns: EllipsisInclusiveRangePatterns::default(),
NonCamelCaseTypes: NonCamelCaseTypes, NonCamelCaseTypes: NonCamelCaseTypes,
DeprecatedAttr: DeprecatedAttr::new(), DeprecatedAttr: DeprecatedAttr::new(),
WhileTrue: WhileTrue, WhileTrue: WhileTrue,
NonAsciiIdents: NonAsciiIdents, NonAsciiIdents: NonAsciiIdents,
HiddenUnicodeCodepoints: HiddenUnicodeCodepoints, HiddenUnicodeCodepoints: HiddenUnicodeCodepoints,
IncompleteFeatures: IncompleteFeatures, IncompleteFeatures: IncompleteFeatures,
RedundantSemicolons: RedundantSemicolons, RedundantSemicolons: RedundantSemicolons,
UnusedDocComment: UnusedDocComment, UnusedDocComment: UnusedDocComment,
UnexpectedCfgs: UnexpectedCfgs, UnexpectedCfgs: UnexpectedCfgs,
] ]
); ]
}; );
}
macro_rules! declare_combined_early_pass {
([$name:ident], $passes:tt) => (
early_lint_methods!(declare_combined_early_lint_pass, [pub $name, $passes]);
)
}
pre_expansion_lint_passes!(declare_combined_early_pass, [BuiltinCombinedPreExpansionLintPass]);
early_lint_passes!(declare_combined_early_pass, [BuiltinCombinedEarlyLintPass]);
macro_rules! late_lint_passes {
($macro:path, $args:tt) => {
$macro!(
$args,
[
// Tracks state across modules
UnnameableTestItems: UnnameableTestItems::new(),
// Tracks attributes of parents
MissingDoc: MissingDoc::new(),
// Builds a global list of all impls of `Debug`.
// FIXME: Turn the computation of types which implement Debug into a query
// and change this to a module lint pass
MissingDebugImplementations: MissingDebugImplementations::default(),
// Keeps a global list of foreign declarations.
ClashingExternDeclarations: ClashingExternDeclarations::new(),
]
);
};
}
macro_rules! late_lint_mod_passes {
($macro:path, $args:tt) => {
$macro!(
$args,
[
ForLoopsOverFallibles: ForLoopsOverFallibles,
DerefIntoDynSupertrait: DerefIntoDynSupertrait,
HardwiredLints: HardwiredLints,
ImproperCTypesDeclarations: ImproperCTypesDeclarations,
ImproperCTypesDefinitions: ImproperCTypesDefinitions,
VariantSizeDifferences: VariantSizeDifferences,
BoxPointers: BoxPointers,
PathStatements: PathStatements,
LetUnderscore: LetUnderscore,
// Depends on referenced function signatures in expressions
UnusedResults: UnusedResults,
NonUpperCaseGlobals: NonUpperCaseGlobals,
NonShorthandFieldPatterns: NonShorthandFieldPatterns,
UnusedAllocation: UnusedAllocation,
// Depends on types used in type definitions
MissingCopyImplementations: MissingCopyImplementations,
// Depends on referenced function signatures in expressions
MutableTransmutes: MutableTransmutes,
TypeAliasBounds: TypeAliasBounds,
TrivialConstraints: TrivialConstraints,
TypeLimits: TypeLimits::new(),
NonSnakeCase: NonSnakeCase,
InvalidNoMangleItems: InvalidNoMangleItems,
// Depends on effective visibilities
UnreachablePub: UnreachablePub,
ExplicitOutlivesRequirements: ExplicitOutlivesRequirements,
InvalidValue: InvalidValue,
DerefNullPtr: DerefNullPtr,
// May Depend on constants elsewhere
UnusedBrokenConst: UnusedBrokenConst,
UnstableFeatures: UnstableFeatures,
ArrayIntoIter: ArrayIntoIter::default(),
DropTraitConstraints: DropTraitConstraints,
TemporaryCStringAsPtr: TemporaryCStringAsPtr,
NonPanicFmt: NonPanicFmt,
NoopMethodCall: NoopMethodCall,
EnumIntrinsicsNonEnums: EnumIntrinsicsNonEnums,
InvalidAtomicOrdering: InvalidAtomicOrdering,
NamedAsmLabels: NamedAsmLabels,
OpaqueHiddenInferredBound: OpaqueHiddenInferredBound,
]
);
};
}
macro_rules! declare_combined_late_pass {
([$v:vis $name:ident], $passes:tt) => (
late_lint_methods!(declare_combined_late_lint_pass, [$v $name, $passes], ['tcx]);
)
}
// FIXME: Make a separate lint type which do not require typeck tables // FIXME: Make a separate lint type which do not require typeck tables
late_lint_passes!(declare_combined_late_pass, [pub BuiltinCombinedLateLintPass]); late_lint_methods!(
declare_combined_late_lint_pass,
[
pub BuiltinCombinedLateLintPass,
[
// Tracks state across modules
UnnameableTestItems: UnnameableTestItems::new(),
// Tracks attributes of parents
MissingDoc: MissingDoc::new(),
// Builds a global list of all impls of `Debug`.
// FIXME: Turn the computation of types which implement Debug into a query
// and change this to a module lint pass
MissingDebugImplementations: MissingDebugImplementations::default(),
// Keeps a global list of foreign declarations.
ClashingExternDeclarations: ClashingExternDeclarations::new(),
]
],
['tcx]
);
late_lint_mod_passes!(declare_combined_late_pass, [BuiltinCombinedModuleLateLintPass]); late_lint_methods!(
declare_combined_late_lint_pass,
[
BuiltinCombinedModuleLateLintPass,
[
ForLoopsOverFallibles: ForLoopsOverFallibles,
DerefIntoDynSupertrait: DerefIntoDynSupertrait,
HardwiredLints: HardwiredLints,
ImproperCTypesDeclarations: ImproperCTypesDeclarations,
ImproperCTypesDefinitions: ImproperCTypesDefinitions,
VariantSizeDifferences: VariantSizeDifferences,
BoxPointers: BoxPointers,
PathStatements: PathStatements,
LetUnderscore: LetUnderscore,
// Depends on referenced function signatures in expressions
UnusedResults: UnusedResults,
NonUpperCaseGlobals: NonUpperCaseGlobals,
NonShorthandFieldPatterns: NonShorthandFieldPatterns,
UnusedAllocation: UnusedAllocation,
// Depends on types used in type definitions
MissingCopyImplementations: MissingCopyImplementations,
// Depends on referenced function signatures in expressions
MutableTransmutes: MutableTransmutes,
TypeAliasBounds: TypeAliasBounds,
TrivialConstraints: TrivialConstraints,
TypeLimits: TypeLimits::new(),
NonSnakeCase: NonSnakeCase,
InvalidNoMangleItems: InvalidNoMangleItems,
// Depends on effective visibilities
UnreachablePub: UnreachablePub,
ExplicitOutlivesRequirements: ExplicitOutlivesRequirements,
InvalidValue: InvalidValue,
DerefNullPtr: DerefNullPtr,
// May Depend on constants elsewhere
UnusedBrokenConst: UnusedBrokenConst,
UnstableFeatures: UnstableFeatures,
ArrayIntoIter: ArrayIntoIter::default(),
DropTraitConstraints: DropTraitConstraints,
TemporaryCStringAsPtr: TemporaryCStringAsPtr,
NonPanicFmt: NonPanicFmt,
NoopMethodCall: NoopMethodCall,
EnumIntrinsicsNonEnums: EnumIntrinsicsNonEnums,
InvalidAtomicOrdering: InvalidAtomicOrdering,
NamedAsmLabels: NamedAsmLabels,
OpaqueHiddenInferredBound: OpaqueHiddenInferredBound,
]
],
['tcx]
);
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(); let mut lint_store = LintStore::new();
register_builtins(&mut lint_store, no_interleave_lints); register_builtins(&mut lint_store);
if internal_lints { if internal_lints {
register_internals(&mut lint_store); register_internals(&mut lint_store);
} }
@ -263,54 +247,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 /// Tell the `LintStore` about all the built-in lints (the ones
/// defined in this crate and the ones defined in /// defined in this crate and the ones defined in
/// `rustc_session::lint::builtin`). /// `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 { macro_rules! add_lint_group {
($name:expr, $($lint:ident),*) => ( ($name:expr, $($lint:ident),*) => (
store.register_group(false, $name, None, vec![$(LintId::of($lint)),*]); store.register_group(false, $name, None, vec![$(LintId::of($lint)),*]);
) )
} }
macro_rules! register_early_pass { store.register_lints(&BuiltinCombinedPreExpansionLintPass::get_lints());
($method:ident, $ty:ident, $constructor:expr) => { store.register_lints(&BuiltinCombinedEarlyLintPass::get_lints());
store.register_lints(&$ty::get_lints()); store.register_lints(&BuiltinCombinedModuleLateLintPass::get_lints());
store.$method(|| Box::new($constructor)); store.register_lints(&BuiltinCombinedLateLintPass::get_lints());
};
}
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());
}
add_lint_group!( add_lint_group!(
"nonstandard_style", "nonstandard_style",

View file

@ -1,7 +1,6 @@
use crate::context::{EarlyContext, LateContext}; use crate::context::{EarlyContext, LateContext};
use rustc_ast as ast; use rustc_ast as ast;
use rustc_data_structures::sync;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_session::lint::builtin::HardwiredLints; use rustc_session::lint::builtin::HardwiredLints;
use rustc_session::lint::LintPass; use rustc_session::lint::LintPass;
@ -66,16 +65,10 @@ macro_rules! late_lint_methods {
// FIXME: eliminate the duplication with `Visitor`. But this also // FIXME: eliminate the duplication with `Visitor`. But this also
// contains a few lint-specific methods with no equivalent in `Visitor`. // contains a few lint-specific methods with no equivalent in `Visitor`.
macro_rules! expand_lint_pass_methods {
($context:ty, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
$(#[inline(always)] fn $name(&mut self, _: $context, $(_: $arg),*) {})*
)
}
macro_rules! declare_late_lint_pass { macro_rules! declare_late_lint_pass {
([], [$hir:tt], [$($methods:tt)*]) => ( ([], [$hir:tt], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
pub trait LateLintPass<$hir>: LintPass { pub trait LateLintPass<$hir>: LintPass {
expand_lint_pass_methods!(&LateContext<$hir>, [$($methods)*]); $(#[inline(always)] fn $name(&mut self, _: &LateContext<$hir>, $(_: $arg),*) {})*
} }
) )
} }
@ -175,16 +168,10 @@ macro_rules! early_lint_methods {
) )
} }
macro_rules! expand_early_lint_pass_methods {
($context:ty, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
$(#[inline(always)] fn $name(&mut self, _: $context, $(_: $arg),*) {})*
)
}
macro_rules! declare_early_lint_pass { macro_rules! declare_early_lint_pass {
([], [$($methods:tt)*]) => ( ([], [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => (
pub trait EarlyLintPass: LintPass { pub trait EarlyLintPass: LintPass {
expand_early_lint_pass_methods!(&EarlyContext<'_>, [$($methods)*]); $(#[inline(always)] fn $name(&mut self, _: &EarlyContext<'_>, $(_: $arg),*) {})*
} }
) )
} }
@ -243,5 +230,5 @@ macro_rules! declare_combined_early_lint_pass {
} }
/// A lint pass boxed up as a trait object. /// A lint pass boxed up as a trait object.
pub type EarlyLintPassObject = Box<dyn EarlyLintPass + sync::Send + 'static>; pub type EarlyLintPassObject = Box<dyn EarlyLintPass + 'static>;
pub type LateLintPassObject<'tcx> = Box<dyn LateLintPass<'tcx> + sync::Send + 'tcx>; pub type LateLintPassObject<'tcx> = Box<dyn LateLintPass<'tcx> + 'tcx>;

View file

@ -1414,8 +1414,6 @@ options! {
"run all passes except codegen; no output"), "run all passes except codegen; no output"),
no_generate_arange_section: bool = (false, parse_no_flag, [TRACKED], no_generate_arange_section: bool = (false, parse_no_flag, [TRACKED],
"omit DWARF address ranges that give faster lookups"), "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], no_leak_check: bool = (false, parse_no_flag, [UNTRACKED],
"disable the 'leak check' for subtyping; unsound, but useful for tests"), "disable the 'leak check' for subtyping; unsound, but useful for tests"),
no_link: bool = (false, parse_no_flag, [TRACKED], no_link: bool = (false, parse_no_flag, [TRACKED],

View file

@ -781,10 +781,7 @@ fn main_args(at_args: &[String]) -> MainResult {
let sess = compiler.session(); let sess = compiler.session();
if sess.opts.describe_lints { if sess.opts.describe_lints {
let mut lint_store = rustc_lint::new_lint_store( let mut lint_store = rustc_lint::new_lint_store(sess.enable_internal_lints());
sess.opts.unstable_opts.no_interleave_lints,
sess.enable_internal_lints(),
);
let registered_lints = if let Some(register_lints) = compiler.register_lints() { let registered_lints = if let Some(register_lints) = compiler.register_lints() {
register_lints(sess, &mut lint_store); register_lints(sess, &mut lint_store);
true true

View file

@ -90,7 +90,6 @@
-Z no-analysis=val -- parse and expand the source, but run no analysis -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-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-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-leak-check=val -- disable the 'leak check' for subtyping; unsound, but useful for tests
-Z no-link=val -- compile without linking -Z no-link=val -- compile without linking
-Z no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO) -Z no-parallel-llvm=val -- run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)

View file

@ -1,11 +1,3 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> <crate attribute>:1:1
|
LL | plugin(lint_plugin_test)
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
warning: item is named 'lintme' warning: item is named 'lintme'
--> $DIR/lint-plugin-cmdline-load.rs:8:1 --> $DIR/lint-plugin-cmdline-load.rs:8:1
| |
@ -14,5 +6,13 @@ LL | fn lintme() { }
| |
= note: `#[warn(test_lint)]` on by default = note: `#[warn(test_lint)]` on by default
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> <crate attribute>:1:1
|
LL | plugin(lint_plugin_test)
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
warning: 2 warnings emitted warning: 2 warnings emitted

View file

@ -1,11 +1,3 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin-deny-attr.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: item is named 'lintme' error: item is named 'lintme'
--> $DIR/lint-plugin-deny-attr.rs:9:1 --> $DIR/lint-plugin-deny-attr.rs:9:1
| |
@ -18,5 +10,13 @@ note: the lint level is defined here
LL | #![deny(test_lint)] LL | #![deny(test_lint)]
| ^^^^^^^^^ | ^^^^^^^^^
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin-deny-attr.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: aborting due to previous error; 1 warning emitted error: aborting due to previous error; 1 warning emitted

View file

@ -1,11 +1,3 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin-deny-cmdline.rs:6:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: item is named 'lintme' error: item is named 'lintme'
--> $DIR/lint-plugin-deny-cmdline.rs:9:1 --> $DIR/lint-plugin-deny-cmdline.rs:9:1
| |
@ -14,5 +6,13 @@ LL | fn lintme() { }
| |
= note: requested on the command line with `-D test-lint` = note: requested on the command line with `-D test-lint`
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin-deny-cmdline.rs:6:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: aborting due to previous error; 1 warning emitted error: aborting due to previous error; 1 warning emitted

View file

@ -11,7 +11,6 @@ fn lintme() {} //~ ERROR item is named 'lintme'
#[allow(test_lint)] #[allow(test_lint)]
//~^ ERROR allow(test_lint) incompatible //~^ ERROR allow(test_lint) incompatible
//~| ERROR allow(test_lint) incompatible //~| ERROR allow(test_lint) incompatible
//~| ERROR allow(test_lint) incompatible
pub fn main() { pub fn main() {
lintme(); lintme();
} }

View file

@ -7,23 +7,6 @@ LL | #![forbid(test_lint)]
LL | #[allow(test_lint)] LL | #[allow(test_lint)]
| ^^^^^^^^^ overruled by previous forbid | ^^^^^^^^^ overruled by previous forbid
error[E0453]: allow(test_lint) incompatible with previous forbid
--> $DIR/lint-plugin-forbid-attrs.rs:11:9
|
LL | #![forbid(test_lint)]
| --------- `forbid` level set here
...
LL | #[allow(test_lint)]
| ^^^^^^^^^ overruled by previous forbid
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin-forbid-attrs.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: item is named 'lintme' error: item is named 'lintme'
--> $DIR/lint-plugin-forbid-attrs.rs:9:1 --> $DIR/lint-plugin-forbid-attrs.rs:9:1
| |
@ -45,6 +28,14 @@ LL | #![forbid(test_lint)]
LL | #[allow(test_lint)] LL | #[allow(test_lint)]
| ^^^^^^^^^ overruled by previous forbid | ^^^^^^^^^ overruled by previous forbid
error: aborting due to 4 previous errors; 1 warning emitted warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin-forbid-attrs.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0453`. For more information about this error, try `rustc --explain E0453`.

View file

@ -9,7 +9,7 @@ fn lintme() { } //~ ERROR item is named 'lintme'
#[allow(test_lint)] //~ ERROR allow(test_lint) incompatible #[allow(test_lint)] //~ ERROR allow(test_lint) incompatible
//~| ERROR allow(test_lint) incompatible //~| ERROR allow(test_lint) incompatible
//~| ERROR allow(test_lint)
pub fn main() { pub fn main() {
lintme(); lintme();
} }

View file

@ -6,22 +6,6 @@ LL | #[allow(test_lint)]
| |
= note: `forbid` lint level was set on command line = note: `forbid` lint level was set on command line
error[E0453]: allow(test_lint) incompatible with previous forbid
--> $DIR/lint-plugin-forbid-cmdline.rs:10:9
|
LL | #[allow(test_lint)]
| ^^^^^^^^^ overruled by previous forbid
|
= note: `forbid` lint level was set on command line
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin-forbid-cmdline.rs:6:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: item is named 'lintme' error: item is named 'lintme'
--> $DIR/lint-plugin-forbid-cmdline.rs:8:1 --> $DIR/lint-plugin-forbid-cmdline.rs:8:1
| |
@ -38,6 +22,14 @@ LL | #[allow(test_lint)]
| |
= note: `forbid` lint level was set on command line = note: `forbid` lint level was set on command line
error: aborting due to 4 previous errors; 1 warning emitted warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin-forbid-cmdline.rs:6:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
error: aborting due to 3 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0453`. For more information about this error, try `rustc --explain E0453`.

View file

@ -1,11 +1,3 @@
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
warning: item is named 'lintme' warning: item is named 'lintme'
--> $DIR/lint-plugin.rs:8:1 --> $DIR/lint-plugin.rs:8:1
| |
@ -14,5 +6,13 @@ LL | fn lintme() { }
| |
= note: `#[warn(test_lint)]` on by default = note: `#[warn(test_lint)]` on by default
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-plugin.rs:5:1
|
LL | #![plugin(lint_plugin_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
warning: 2 warnings emitted warning: 2 warnings emitted

View file

@ -6,18 +6,6 @@ warning: lint name `test_lint` is deprecated and does not have an effect anymore
| |
= note: requested on the command line with `-A test_lint` = note: requested on the command line with `-A test_lint`
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-tool-cmdline-allow.rs:7:1
|
LL | #![plugin(lint_tool_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint
|
= note: requested on the command line with `-A test_lint`
warning: item is named 'lintme' warning: item is named 'lintme'
--> $DIR/lint-tool-cmdline-allow.rs:9:1 --> $DIR/lint-tool-cmdline-allow.rs:9:1
| |
@ -26,9 +14,17 @@ LL | fn lintme() {}
| |
= note: `#[warn(clippy::test_lint)]` on by default = note: `#[warn(clippy::test_lint)]` on by default
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
--> $DIR/lint-tool-cmdline-allow.rs:7:1
|
LL | #![plugin(lint_tool_test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
= note: `#[warn(deprecated)]` on by default
warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint
| |
= note: requested on the command line with `-A test_lint` = note: requested on the command line with `-A test_lint`
warning: 6 warnings emitted warning: 5 warnings emitted

View file

@ -10,12 +10,10 @@
//~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future
//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future
//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future
//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future
#![deny(clippy_group)] #![deny(clippy_group)]
//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
fn lintme() { } //~ ERROR item is named 'lintme' fn lintme() { } //~ ERROR item is named 'lintme'
@ -32,7 +30,6 @@ pub fn main() {
//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future //~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future
//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future //~| WARNING lint name `test_group` is deprecated and may not have an effect in the future
//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future //~| WARNING lint name `test_group` is deprecated and may not have an effect in the future
//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future
#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist`
fn hello() { fn hello() {
fn lintmetoo() { } fn lintmetoo() { }

View file

@ -7,13 +7,13 @@ LL | #![cfg_attr(foo, warn(test_lint))]
= note: `#[warn(renamed_and_removed_lints)]` on by default = note: `#[warn(renamed_and_removed_lints)]` on by default
warning: lint name `clippy_group` is deprecated and may not have an effect in the future. warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:14:9 --> $DIR/lint-tool-test.rs:13:9
| |
LL | #![deny(clippy_group)] LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^ help: change it to: `clippy::group` | ^^^^^^^^^^^^ help: change it to: `clippy::group`
warning: lint name `test_group` is deprecated and may not have an effect in the future. warning: lint name `test_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:31:9 --> $DIR/lint-tool-test.rs:29:9
| |
LL | #[allow(test_group)] LL | #[allow(test_group)]
| ^^^^^^^^^^ help: change it to: `clippy::test_group` | ^^^^^^^^^^ help: change it to: `clippy::test_group`
@ -25,19 +25,40 @@ LL | #![cfg_attr(foo, warn(test_lint))]
| ^^^^^^^^^ help: change it to: `clippy::test_lint` | ^^^^^^^^^ help: change it to: `clippy::test_lint`
warning: lint name `clippy_group` is deprecated and may not have an effect in the future. warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:14:9 --> $DIR/lint-tool-test.rs:13:9
| |
LL | #![deny(clippy_group)] LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^ help: change it to: `clippy::group` | ^^^^^^^^^^^^ help: change it to: `clippy::group`
error: item is named 'lintme'
--> $DIR/lint-tool-test.rs:18:1
|
LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-tool-test.rs:13:9
|
LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^
= note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]`
error: item is named 'lintmetoo'
--> $DIR/lint-tool-test.rs:26:5
|
LL | fn lintmetoo() { }
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]`
warning: lint name `test_group` is deprecated and may not have an effect in the future. warning: lint name `test_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:31:9 --> $DIR/lint-tool-test.rs:29:9
| |
LL | #[allow(test_group)] LL | #[allow(test_group)]
| ^^^^^^^^^^ help: change it to: `clippy::test_group` | ^^^^^^^^^^ help: change it to: `clippy::test_group`
warning: unknown lint: `this_lint_does_not_exist` warning: unknown lint: `this_lint_does_not_exist`
--> $DIR/lint-tool-test.rs:36:8 --> $DIR/lint-tool-test.rs:33:8
| |
LL | #[deny(this_lint_does_not_exist)] LL | #[deny(this_lint_does_not_exist)]
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
@ -59,55 +80,16 @@ LL | #![cfg_attr(foo, warn(test_lint))]
| ^^^^^^^^^ help: change it to: `clippy::test_lint` | ^^^^^^^^^ help: change it to: `clippy::test_lint`
warning: lint name `clippy_group` is deprecated and may not have an effect in the future. warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:14:9 --> $DIR/lint-tool-test.rs:13:9
|
LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^ help: change it to: `clippy::group`
error: item is named 'lintme'
--> $DIR/lint-tool-test.rs:20:1
|
LL | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-tool-test.rs:14:9
|
LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^
= note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]`
error: item is named 'lintmetoo'
--> $DIR/lint-tool-test.rs:28:5
|
LL | fn lintmetoo() { }
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]`
warning: lint name `test_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:31:9
|
LL | #[allow(test_group)]
| ^^^^^^^^^^ help: change it to: `clippy::test_group`
warning: lint name `test_lint` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:9:23
|
LL | #![cfg_attr(foo, warn(test_lint))]
| ^^^^^^^^^ help: change it to: `clippy::test_lint`
warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:14:9
| |
LL | #![deny(clippy_group)] LL | #![deny(clippy_group)]
| ^^^^^^^^^^^^ help: change it to: `clippy::group` | ^^^^^^^^^^^^ help: change it to: `clippy::group`
warning: lint name `test_group` is deprecated and may not have an effect in the future. warning: lint name `test_group` is deprecated and may not have an effect in the future.
--> $DIR/lint-tool-test.rs:31:9 --> $DIR/lint-tool-test.rs:29:9
| |
LL | #[allow(test_group)] LL | #[allow(test_group)]
| ^^^^^^^^^^ help: change it to: `clippy::test_group` | ^^^^^^^^^^ help: change it to: `clippy::test_group`
error: aborting due to 2 previous errors; 14 warnings emitted error: aborting due to 2 previous errors; 11 warnings emitted

View file

@ -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

View file

@ -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)] #![deny(warnings)]
// Ensure that unknown lints inside cfg-attr's are linted for // Ensure that unknown lints inside cfg-attr's are linted for

View file

@ -1,18 +1,18 @@
error: unknown lint: `nonex_lint_top_level` 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))] LL | #![cfg_attr(all(), allow(nonex_lint_top_level))]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/issue-97094.rs:10:9 --> $DIR/issue-97094.rs:1:9
| |
LL | #![deny(warnings)] LL | #![deny(warnings)]
| ^^^^^^^^ | ^^^^^^^^
= note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]` = note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]`
error: lint `bare_trait_object` has been renamed to `bare_trait_objects` 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))] LL | #![cfg_attr(all(), allow(bare_trait_object))]
| ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` | ^^^^^^^^^^^^^^^^^ 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)]` = note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]`
error: unknown lint: `nonex_lint_mod` 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))] LL | #[cfg_attr(all(), allow(nonex_lint_mod))]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
error: unknown lint: `nonex_lint_mod_inner` 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))] LL | #![cfg_attr(all(), allow(nonex_lint_mod_inner))]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: unknown lint: `nonex_lint_fn` 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))] LL | #[cfg_attr(all(), allow(nonex_lint_fn))]
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: unknown lint: `nonex_lint_in_macro` 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))] LL | #[cfg_attr(all(), allow(nonex_lint_in_macro))]
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
error: unknown lint: `nonex_lint_fn` error: unknown lint: `nonex_lint_fn`
--> $DIR/issue-97094.rs:56:13 --> $DIR/issue-97094.rs:47:13
| |
LL | #[allow(nonex_lint_fn)] LL | #[allow(nonex_lint_fn)]
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^