diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-14 11:09:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-14 11:09:57 +0100 |
| commit | fce6e752ab8b5fa3830994adbbf5c4344dac88f9 (patch) | |
| tree | b80793b2c1dad04603bebe4594cdfcb1dcaf7fd3 /compiler/rustc_interface/src | |
| parent | 6694918344b724af0d5efc0b166ac34980818885 (diff) | |
| parent | 7ef605be3fa24f93194a3faf4f75d3a05ceca78a (diff) | |
| download | rust-fce6e752ab8b5fa3830994adbbf5c4344dac88f9.tar.gz rust-fce6e752ab8b5fa3830994adbbf5c4344dac88f9.zip | |
Rollup merge of #120699 - nnethercote:rm-useless-TRACK_DIAGNOSTIC-calls, r=oli-obk
Document `TRACK_DIAGNOSTIC` calls. r? ```````@cjgillot```````
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/callbacks.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_interface/src/callbacks.rs b/compiler/rustc_interface/src/callbacks.rs index f44ae705a3c..a27f73789cd 100644 --- a/compiler/rustc_interface/src/callbacks.rs +++ b/compiler/rustc_interface/src/callbacks.rs @@ -29,7 +29,7 @@ fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) { /// This is a callback from `rustc_errors` as it cannot access the implicit state /// in `rustc_middle` otherwise. It is used when diagnostic messages are /// emitted and stores them in the current query, if there is one. -fn track_diagnostic(diagnostic: DiagInner, f: &mut dyn FnMut(DiagInner)) { +fn track_diagnostic<R>(diagnostic: DiagInner, f: &mut dyn FnMut(DiagInner) -> R) -> R { tls::with_context_opt(|icx| { if let Some(icx) = icx { if let Some(diagnostics) = icx.diagnostics { @@ -38,11 +38,11 @@ fn track_diagnostic(diagnostic: DiagInner, f: &mut dyn FnMut(DiagInner)) { // Diagnostics are tracked, we can ignore the dependency. let icx = tls::ImplicitCtxt { task_deps: TaskDepsRef::Ignore, ..icx.clone() }; - return tls::enter_context(&icx, move || (*f)(diagnostic)); + tls::enter_context(&icx, move || (*f)(diagnostic)) + } else { + // In any other case, invoke diagnostics anyway. + (*f)(diagnostic) } - - // In any other case, invoke diagnostics anyway. - (*f)(diagnostic); }) } |
