Invalid span when emitting a diagnostic note on the top-level module #63091
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
While I was investigating a fix for #63064, I noticed one problematic error case, where, as it turns out, the compiler emits a broken span.
This is the error I'm getting with the nightly:
The second span should extend to the whole top-level module but instead terminates at the first
{
. This is due to howSourceMap::def_span()
is defined:rust/src/libsyntax/source_map.rs
Lines 689 to 691 in 023525d
This works kind of okay for all item definitions, except for top-level modules. I did try to come up with a way to fix it up in
libsyntax
, but there's no clean way of doing it as it only deals withSpans
. I figured the place to look at would be:rust/src/librustc/ty/query/plumbing.rs
Lines 313 to 315 in 023525d
but I am not at all familiar with the new query system, so decided to file this issue.
The text was updated successfully, but these errors were encountered: