mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Do not report warnings from proc macros, ever
This commit is contained in:
parent
26bc01dae3
commit
33c7e81e90
2 changed files with 13 additions and 0 deletions
|
@ -542,7 +542,13 @@ fn handle_diag_from_macros(
|
|||
sema.db.lookup_intern_syntax_context(span.ctx).outer_expn.is_some_and(|expansion| {
|
||||
let macro_call =
|
||||
sema.db.lookup_intern_macro_call(expansion.as_macro_file().macro_call_id);
|
||||
// We don't want to show diagnostics for non-local macros at all, but proc macros authors
|
||||
// seem to rely on being able to emit non-warning-free code, so we don't want to show warnings
|
||||
// for them even when the proc macro comes from the same workspace (in rustc that's not a
|
||||
// problem because it doesn't have the concept of workspaces, and proc macros always reside
|
||||
// in a different crate).
|
||||
!Crate::from(macro_call.def.krate).origin(sema.db).is_local()
|
||||
|| !macro_call.def.kind.is_declarative()
|
||||
})
|
||||
}) {
|
||||
// Disable suggestions for external macros, they'll change library code and it's just bad.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue