Commit 25dd832
committed
Detect
By making it an `EscapeError` instead of a `LitError`. This makes it
more like the other errors produced during unescaping.
NOTE: this means these errors are issued earlier, before expansion,
which changes behaviour. The next commit will delay issue of this error
and others, reverting the behaviour change for this particular error.
One nice thing about this: the old approach had some code in
`report_lit_error` to calculate the span of the nul char from a range.
This code used a hardwired `+2` to account for the `c"` at the start of
a C string literal, but this should have changed to a `+3` for raw C
string literals to account for the `cr"`, which meant that the caret in
`cr"` nul error messages was one short of where it should have been. The
new approach doesn't need any of this and avoids the off-by-one error.NulInCStr error earlier.1 parent 1edec28 commit 25dd832
File tree
8 files changed
+26
-28
lines changed- compiler
- rustc_ast/src/util
- rustc_lexer/src
- rustc_parse
- src
- lexer
- rustc_session
- src
- tests/ui/rfcs/rfc-3348-c-string-literals
8 files changed
+26
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
| |||
156 | 154 | | |
157 | 155 | | |
158 | 156 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 157 | + | |
163 | 158 | | |
164 | 159 | | |
165 | 160 | | |
| |||
179 | 174 | | |
180 | 175 | | |
181 | 176 | | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 177 | + | |
186 | 178 | | |
187 | 179 | | |
188 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
125 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
126 | 134 | | |
127 | 135 | | |
128 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
129 | 140 | | |
130 | 141 | | |
131 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
| 615 | + | |
| 616 | + | |
615 | 617 | | |
616 | 618 | | |
617 | 619 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2138 | 2138 | | |
2139 | 2139 | | |
2140 | 2140 | | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
2141 | 2146 | | |
2142 | 2147 | | |
2143 | 2148 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
268 | 271 | | |
269 | 272 | | |
270 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | 332 | | |
340 | 333 | | |
341 | 334 | | |
| |||
414 | 407 | | |
415 | 408 | | |
416 | 409 | | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | 410 | | |
424 | 411 | | |
425 | 412 | | |
| |||
Binary file not shown.
0 commit comments