about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-12-13 17:15:58 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-12-15 09:48:00 +1100
commit2c2c7f13a65f22969adf52a8040fb1bed842fb94 (patch)
tree009f03f5c49712f561ec0da0d216305c8b44aef2 /compiler/rustc_codegen_gcc
parentb0d5b442e952eb7b51361d4a3a6d11aff10d1cc0 (diff)
downloadrust-2c2c7f13a65f22969adf52a8040fb1bed842fb94.tar.gz
rust-2c2c7f13a65f22969adf52a8040fb1bed842fb94.zip
Remove `Handler::emit_diag_at_span`.
Compare `Handler::warn` and `Handler::span_warn`. Conceptually they are
almost identical. But their implementations are weirdly different.

`warn`:
- calls `DiagnosticBuilder::<()>::new(self, Warning(None), msg)`, then `emit()`
- which calls `G::diagnostic_builder_emit_producing_guarantee(self)`
- which calls `handler.emit_diagnostic(&mut db.inner.diagnostic)`

`span_warn`:
- calls `self.emit_diag_at_span(Diagnostic::new(Warning(None), msg), span)`
- which calls `self.emit_diagnostic(diag.set_span(sp))`

I.e. they both end up at `emit_diagnostic`, but take very different
routes to get there.

This commit changes `span_*` and similar ones to not use
`emit_diag_at_span`. Instead they just call `struct_span_*` + `emit`.

Some nice side-effects of this:
- `span_fatal` and `span_fatal_with_code` don't need
  `FatalError.raise()`, because `emit` does that.
- `span_err` and `span_err_with_code` doesn't need `unwrap`.
- `struct_span_note`'s `span` arg type is changed from `Span` to
  `impl Into<MultiSpan>` like all the other functions.
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions