Skip to content

Commit ac2b7a2

Browse files
authored
Rollup merge of #97757 - xFrednet:rfc-2383-expect-with-force-warn, r=wesleywiser,flip1995
Support lint expectations for `--force-warn` lints (RFC 2383) Rustc has a `--force-warn` flag, which overrides lint level attributes and forces the diagnostics to always be warn. This means, that for lint expectations, the diagnostic can't be suppressed as usual. This also means that the expectation would not be fulfilled, even if a lint had been triggered in the expected scope. This PR now also tracks the expectation ID in the `ForceWarn` level. I've also made some minor adjustments, to possibly catch more bugs and make the whole implementation more robust. This will probably conflict with rust-lang/rust#97718. That PR should ideally be reviewed and merged first. The conflict itself will be trivial to fix. --- r? `@wesleywiser` cc: `@flip1995` since you've helped with the initial review and also discussed this topic with me. 🙃 Follow-up of: rust-lang/rust#87835 Issue: rust-lang/rust#85549 Yeah, and that's it.
2 parents d03a547 + 76cbc1d commit ac2b7a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/parse/session.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ mod tests {
433433
Some(ignore_list),
434434
);
435435
let span = MultiSpan::from_span(mk_sp(BytePos(0), BytePos(1)));
436-
let non_fatal_diagnostic = build_diagnostic(DiagnosticLevel::Warning, Some(span));
436+
let non_fatal_diagnostic = build_diagnostic(DiagnosticLevel::Warning(None), Some(span));
437437
emitter.emit_diagnostic(&non_fatal_diagnostic);
438438
assert_eq!(num_emitted_errors.load(Ordering::Acquire), 0);
439439
assert_eq!(can_reset_errors.load(Ordering::Acquire), true);
@@ -457,7 +457,7 @@ mod tests {
457457
None,
458458
);
459459
let span = MultiSpan::from_span(mk_sp(BytePos(0), BytePos(1)));
460-
let non_fatal_diagnostic = build_diagnostic(DiagnosticLevel::Warning, Some(span));
460+
let non_fatal_diagnostic = build_diagnostic(DiagnosticLevel::Warning(None), Some(span));
461461
emitter.emit_diagnostic(&non_fatal_diagnostic);
462462
assert_eq!(num_emitted_errors.load(Ordering::Acquire), 1);
463463
assert_eq!(can_reset_errors.load(Ordering::Acquire), false);
@@ -494,8 +494,8 @@ mod tests {
494494
);
495495
let bar_span = MultiSpan::from_span(mk_sp(BytePos(0), BytePos(1)));
496496
let foo_span = MultiSpan::from_span(mk_sp(BytePos(21), BytePos(22)));
497-
let bar_diagnostic = build_diagnostic(DiagnosticLevel::Warning, Some(bar_span));
498-
let foo_diagnostic = build_diagnostic(DiagnosticLevel::Warning, Some(foo_span));
497+
let bar_diagnostic = build_diagnostic(DiagnosticLevel::Warning(None), Some(bar_span));
498+
let foo_diagnostic = build_diagnostic(DiagnosticLevel::Warning(None), Some(foo_span));
499499
let fatal_diagnostic = build_diagnostic(DiagnosticLevel::Fatal, None);
500500
emitter.emit_diagnostic(&bar_diagnostic);
501501
emitter.emit_diagnostic(&foo_diagnostic);

0 commit comments

Comments
 (0)