Skip to content

Commit e8fcc8e

Browse files
committed
Remove useless TRACK_DIAGNOSTIC calls.
There are two calls to `TRACK_DIAGNOSTIC` in `DiagCtxtInner::emit_diagnostic` for cases where we don't emit anything and the closure does nothing. The only effect these calls have is to add a diagnostic to `ImplicitCtxt::diagnostics`, which then gets added to `QuerySideEffects::diagnostics`, which eventually gets handled by `DepGraphData::emit_side_effects`, which calls `emit_diagnostic` on the diagnostic, and again `emit_diagnostic` doesn't emit anything. It's a big, complicate no-op. This commit removes it.
1 parent 4e3eed4 commit e8fcc8e

File tree

1 file changed

+1
-5
lines changed
  • compiler/rustc_errors/src

1 file changed

+1
-5
lines changed

compiler/rustc_errors/src/lib.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1300,19 +1300,15 @@ impl DiagCtxtInner {
13001300
}
13011301

13021302
if diagnostic.level == Warning && !self.flags.can_emit_warnings {
1303-
if diagnostic.has_future_breakage() {
1304-
(*TRACK_DIAGNOSTIC)(diagnostic, &mut |_| {});
1305-
}
13061303
return None;
13071304
}
13081305

13091306
if matches!(diagnostic.level, Expect(_) | Allow) {
1310-
(*TRACK_DIAGNOSTIC)(diagnostic, &mut |_| {});
13111307
return None;
13121308
}
13131309

13141310
let mut guaranteed = None;
1315-
(*TRACK_DIAGNOSTIC)(diagnostic, &mut |mut diagnostic| {
1311+
TRACK_DIAGNOSTIC(diagnostic, &mut |mut diagnostic| {
13161312
if let Some(code) = diagnostic.code {
13171313
self.emitted_diagnostic_codes.insert(code);
13181314
}

0 commit comments

Comments
 (0)