Commit c733a02
committed
Remove a fourth
The old code was very hard to understand, involving an
`emit_without_consuming` call *and* a `delay_as_bug_without_consuming`
call.
With slight changes both calls can be avoided. Not creating the error
until later is crucial, as is the early return in the `if recovered`
block.
It took me some time to come up with this reworking -- it went through
intermediate states much further from the original code than this final
version -- and it's isn't obvious at a glance that it is equivalent. But
I think it is, and the unchanged test behaviour is good supporting
evidence.
The commit also changes `check_trailing_angle_brackets` to return
`Option<ErrorGuaranteed>`. This provides a stricter proof that it
emitted an error message than asserting `dcx.has_errors().is_some()`,
which would succeed if any error had previously been emitted anywhere.DiagnosticBuilder::emit_without_consuming call.1 parent 1b6c8e7 commit c733a02
2 files changed
+21
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
1049 | 1049 | | |
1050 | 1050 | | |
1051 | 1051 | | |
1052 | | - | |
| 1052 | + | |
1053 | 1053 | | |
1054 | | - | |
| 1054 | + | |
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
| |||
1086 | 1086 | | |
1087 | 1087 | | |
1088 | 1088 | | |
1089 | | - | |
| 1089 | + | |
1090 | 1090 | | |
1091 | 1091 | | |
1092 | 1092 | | |
| |||
1124 | 1124 | | |
1125 | 1125 | | |
1126 | 1126 | | |
1127 | | - | |
| 1127 | + | |
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
| |||
1139 | 1139 | | |
1140 | 1140 | | |
1141 | 1141 | | |
1142 | | - | |
1143 | | - | |
| 1142 | + | |
1144 | 1143 | | |
1145 | | - | |
| 1144 | + | |
1146 | 1145 | | |
1147 | 1146 | | |
1148 | 1147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1793 | 1793 | | |
1794 | 1794 | | |
1795 | 1795 | | |
1796 | | - | |
1797 | | - | |
1798 | | - | |
1799 | | - | |
| 1796 | + | |
| 1797 | + | |
1800 | 1798 | | |
1801 | 1799 | | |
1802 | | - | |
1803 | 1800 | | |
1804 | 1801 | | |
1805 | | - | |
| 1802 | + | |
1806 | 1803 | | |
1807 | 1804 | | |
1808 | 1805 | | |
1809 | | - | |
| 1806 | + | |
1810 | 1807 | | |
1811 | 1808 | | |
1812 | 1809 | | |
1813 | | - | |
1814 | | - | |
1815 | | - | |
1816 | | - | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
1817 | 1814 | | |
1818 | 1815 | | |
1819 | 1816 | | |
1820 | 1817 | | |
| 1818 | + | |
| 1819 | + | |
1821 | 1820 | | |
1822 | 1821 | | |
1823 | 1822 | | |
1824 | 1823 | | |
1825 | | - | |
1826 | | - | |
| 1824 | + | |
| 1825 | + | |
1827 | 1826 | | |
1828 | 1827 | | |
1829 | 1828 | | |
1830 | 1829 | | |
1831 | 1830 | | |
1832 | 1831 | | |
1833 | | - | |
1834 | | - | |
1835 | | - | |
1836 | | - | |
1837 | | - | |
1838 | | - | |
1839 | | - | |
1840 | | - | |
1841 | | - | |
| 1832 | + | |
1842 | 1833 | | |
1843 | 1834 | | |
1844 | 1835 | | |
| |||
0 commit comments