Commit 2c2c7f1
committed
Remove
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.Handler::emit_diag_at_span.1 parent b0d5b44 commit 2c2c7f1
1 file changed
+9
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
975 | 975 | | |
976 | 976 | | |
977 | 977 | | |
978 | | - | |
979 | | - | |
| 978 | + | |
980 | 979 | | |
981 | 980 | | |
982 | 981 | | |
| |||
987 | 986 | | |
988 | 987 | | |
989 | 988 | | |
990 | | - | |
991 | | - | |
| 989 | + | |
992 | 990 | | |
993 | 991 | | |
994 | 992 | | |
| |||
998 | 996 | | |
999 | 997 | | |
1000 | 998 | | |
1001 | | - | |
| 999 | + | |
1002 | 1000 | | |
1003 | 1001 | | |
1004 | 1002 | | |
| |||
1009 | 1007 | | |
1010 | 1008 | | |
1011 | 1009 | | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
| 1010 | + | |
1017 | 1011 | | |
1018 | 1012 | | |
1019 | 1013 | | |
1020 | 1014 | | |
1021 | 1015 | | |
1022 | | - | |
| 1016 | + | |
1023 | 1017 | | |
1024 | 1018 | | |
1025 | 1019 | | |
| |||
1030 | 1024 | | |
1031 | 1025 | | |
1032 | 1026 | | |
1033 | | - | |
| 1027 | + | |
1034 | 1028 | | |
1035 | 1029 | | |
1036 | 1030 | | |
| |||
1078 | 1072 | | |
1079 | 1073 | | |
1080 | 1074 | | |
1081 | | - | |
| 1075 | + | |
1082 | 1076 | | |
1083 | 1077 | | |
1084 | 1078 | | |
1085 | 1079 | | |
1086 | 1080 | | |
1087 | | - | |
| 1081 | + | |
1088 | 1082 | | |
1089 | 1083 | | |
1090 | 1084 | | |
1091 | 1085 | | |
1092 | 1086 | | |
1093 | 1087 | | |
1094 | | - | |
| 1088 | + | |
1095 | 1089 | | |
1096 | 1090 | | |
1097 | 1091 | | |
| |||
1337 | 1331 | | |
1338 | 1332 | | |
1339 | 1333 | | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
1347 | | - | |
1348 | 1334 | | |
1349 | 1335 | | |
1350 | 1336 | | |
| |||
0 commit comments