Skip to content

Commit b988c6f

Browse files
Merge #6715
6715: Don't diagnose `#[cfg]` in macros r=jonas-schievink a=jonas-schievink Fixes #6363 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
2 parents 070ecef + 6e1c87e commit b988c6f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/ide/src/diagnostics.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ pub(crate) fn diagnostics(
135135
res.borrow_mut().push(warning_with_fix(d, &sema));
136136
})
137137
.on::<hir::diagnostics::InactiveCode, _>(|d| {
138+
// If there's inactive code somewhere in a macro, don't propagate to the call-site.
139+
if d.display_source().file_id.expansion_info(db).is_some() {
140+
return;
141+
}
142+
138143
// Override severity and mark as unused.
139144
res.borrow_mut().push(
140145
Diagnostic::hint(sema.diagnostics_display_range(d).range, d.message())

0 commit comments

Comments
 (0)