The existing code seems to assume that substitutions spans are disjoint,
which is not always the case.
In the example:
pub trait AAAA {}
pub trait B {}
pub trait C {}
pub type T<P: AAAA + B + C> = P;
, we get three substituions starting from ':' and ending respectively at
the end of each trait token.
With the former offset calculation, this would cause `underline_start` to
eventually become negative before being converted to `usize`...
The new version may report erroneous results for non perfectly overlapping
substitutions but I don't know if such examples exist. Alternatively, we
could detect these cases and trim out overlapping substitutions.
|
||
|---|---|---|
| .. | ||
| json | ||
| annotate_snippet_emitter_writer.rs | ||
| Cargo.toml | ||
| diagnostic.rs | ||
| diagnostic_builder.rs | ||
| emitter.rs | ||
| json.rs | ||
| lib.rs | ||
| lock.rs | ||
| registry.rs | ||
| snippet.rs | ||
| styled_buffer.rs | ||