Commit 966f947
authored
fix(frontmatter): Improve error quality (#15972)
### What does this PR try to resolve?
The wording for our errors was indirect and things weren't as clear
without more context.
### How to test and review this PR?
### Notes
Example of rustc's versions of these errors:
1
> ```
> error: unclosed frontmatter
> --> $DIR/frontmatter-whitespace-2.rs:1:1
> |
> LL | / ---cargo
> ... |
> LL | |
> | |_^
> |
> note: frontmatter opening here was not closed
> --> $DIR/frontmatter-whitespace-2.rs:1:1
> |
> LL | ---cargo
> | ^^^
> ```
2
> ```
> error: extra characters after frontmatter close are not allowed
> --> $DIR/extra-after-end.rs:2:1
> |
> LL | ---cargo
> | ^^^^^^^^
> ```
3
> ```
> error: frontmatter close does not match the opening
> --> $DIR/mismatch-1.rs:1:1
> |
> LL | ---cargo
> | ^--
> | |
> | _the opening here has 3 dashes...
> | |
> LL | |
> LL | | ----
> | |_---^
> | |
> | ...while the close has 4 dashes
> ```File tree
18 files changed
+151
-80
lines changed- src/cargo/util
- toml
- tests/testsuite/script/rustc_fixtures
18 files changed
+151
-80
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
| 75 | + | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
106 | 108 | | |
107 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
108 | 112 | | |
109 | | - | |
| 113 | + | |
| 114 | + | |
110 | 115 | | |
111 | 116 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
| |||
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
131 | | - | |
132 | | - | |
133 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
134 | 144 | | |
135 | | - | |
136 | | - | |
137 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
138 | 161 | | |
139 | 162 | | |
140 | 163 | | |
| |||
153 | 176 | | |
154 | 177 | | |
155 | 178 | | |
156 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
157 | 182 | | |
158 | 183 | | |
159 | 184 | | |
| |||
270 | 295 | | |
271 | 296 | | |
272 | 297 | | |
273 | | - | |
| 298 | + | |
| 299 | + | |
274 | 300 | | |
275 | 301 | | |
276 | 302 | | |
277 | 303 | | |
278 | 304 | | |
279 | 305 | | |
280 | | - | |
| 306 | + | |
| 307 | + | |
281 | 308 | | |
282 | 309 | | |
283 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
284 | 316 | | |
285 | 317 | | |
286 | 318 | | |
287 | 319 | | |
288 | | - | |
289 | | - | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
290 | 326 | | |
291 | 327 | | |
292 | 328 | | |
| |||
584 | 620 | | |
585 | 621 | | |
586 | 622 | | |
587 | | - | |
| 623 | + | |
588 | 624 | | |
589 | 625 | | |
590 | 626 | | |
| |||
621 | 657 | | |
622 | 658 | | |
623 | 659 | | |
624 | | - | |
| 660 | + | |
625 | 661 | | |
626 | 662 | | |
627 | 663 | | |
| |||
636 | 672 | | |
637 | 673 | | |
638 | 674 | | |
639 | | - | |
| 675 | + | |
640 | 676 | | |
641 | 677 | | |
642 | 678 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | | - | |
26 | | - | |
| 26 | + | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2783 | 2783 | | |
2784 | 2784 | | |
2785 | 2785 | | |
2786 | | - | |
| 2786 | + | |
2787 | 2787 | | |
2788 | 2788 | | |
2789 | 2789 | | |
| |||
2793 | 2793 | | |
2794 | 2794 | | |
2795 | 2795 | | |
2796 | | - | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
2797 | 2802 | | |
2798 | 2803 | | |
2799 | 2804 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
Lines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments