Emit weird lint name lints after expansion
Previously, we were emitting weird name lints (for renamed or unknown lints) before expansion, most importantly before cfg expansion. This meant that the weird name lints would not fire for lint attributes hidden inside cfg_attr. The same applied for lint level specifications of those lints. By moving the lints for the lint names to the post-expansion phase, these issues are resolved.
This commit is contained in:
parent
cd251fb48e
commit
2a8b60f915
7 changed files with 264 additions and 99 deletions
|
@ -424,10 +424,25 @@ 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.debugging_opts.no_interleave_lints {
|
||||
if sess.opts.debugging_opts.no_interleave_lints {
|
||||
for (i, pass) in passes.iter_mut().enumerate() {
|
||||
buffered =
|
||||
sess.prof.extra_verbose_generic_activity("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,
|
||||
!pre_expansion,
|
||||
lint_store,
|
||||
registered_tools,
|
||||
buffered,
|
||||
|
@ -446,21 +461,6 @@ pub fn check_ast_node<'a>(
|
|||
check_node,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
for (i, pass) in passes.iter_mut().enumerate() {
|
||||
buffered =
|
||||
sess.prof.extra_verbose_generic_activity("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,
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// All of the buffered lints should have been emitted at this point.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue