| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Batch of improvements to errors for new error format
This is a batch of improvements to existing errors to help get the most out of the new error format.
* Added labels to primary spans (^^^) for a set of errors that didn't currently have them
* Highlight the source blue under the secondary notes for better readability
* Move some of the "Note:" into secondary spans+labels
* Fix span_label to take &mut instead, which makes it work the same as other methods in that set
|
|
Better handling of tab in error
cc #33240.
|
|
|
|
|
|
|
|
Add accessor methods to DiagnosticBuilder
|
|
degrade gracefully with empty spans
In https://github.com/rust-lang/rust/pull/32756, we solved the final test failure, but digging more into it the handling of that scenario could be better. The error was caused by an empty span supplied by the parser representing EOF. This patch checks that we cope more gracefully with such spans:
r? @jonathandturner
|
|
|
|
|
|
|
|
|
|
|
|
also handle more rendered-lines
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
as a result, simplify elision code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There is now a CoreEmitter that everything desugars to, but without
losing any information. Also remove RenderSpan::FileLine. This lets the
rustc_driver tests build.
|
|
The Yellow text is very hard to read with a white background.
|
|
|
|
Major changes:
- Remove old snippet rendering code and use the new stuff.
- Introduce `span_label` method to add a label
- Remove EndSpan mode and replace with a fn to get the last
character of a span.
- Stop using `Option<MultiSpan>` and just use an empty `MultiSpan`
- and probably a bunch of other stuff :)
|
|
Each Span now carries a `is_primary` boolean along with an optional
label. If there are multiple labels for a span, it will appear multiple
times.
|
|
MultiSpan model is now:
- set of primary spans
- set of span+label pairs
Primary spans render with `^^^`, secondary spans with `---`.
Labels are placed next to the `^^^` or `---` marker as appropriate.
|
|
|
|
Also add a comment or two to pacify the merciless self-critic, who hates
a closure without a comment.
|
|
This uncovered a lot of bugs in compiletest and also some shortcomings
of our existing JSON output. We had to add information to the JSON
output, such as suggested text and macro backtraces. We also had to fix
various bugs in the existing tests.
Joint work with jntrnr.
|
|
|
|
|
|
This works by adding a boolean flag, `continue_after_error`, to
`syntax::errors::Handler` that can be imperatively set to `true` or
`false` via a new `fn set_continue_after_error`.
The flag starts off true (since we generally try to recover from
compiler errors, and `Handler` is shared across all phases).
Then, during the `phase_1_parse_input`, we consult the setting of the
`-Z continue-parse-after-error` debug flag to determine whether we
should leave the flag set to `true` or should change it to `false`.
----
(We might consider adding a debugflag to do such aborts in other
places where we are currently attempting recovery, such as resolve,
but I think the parser is the really important case to handle in the
face of #31994 and the parser bugs of varying degrees that were
injected by parse error recovery.)
|
|
|
|
|
|
Automated conversion using the untry tool [1] and the following command:
```
$ find -name '*.rs' -type f | xargs untry
```
at the root of the Rust repo.
[1]: https://github.com/japaric/untry
|
|
A span spanning only a single character would render like `^~`
instead of just `^`.
|
|
|
|
|
|
|
|
|
|
|
|
This allows to render multiple spans on one line,
or to splice multiple replacements into a code suggestion.
|