Skip to content

stray "not covered" diagnostic in JSON output #64769

Closed
@ehuss

Description

@ehuss

Since #64271, the E0005 error has begun emitting a strange "not covered" span in the JSON output. This does not appear in the normal "human" rendered output.

Sample code:

#![allow(unused)]

fn main() {
    let x = Some(1);
    let Some(y) = x;
}

With --error-format=json, this includes the following span which looks broken to me:

   {
    "byte_end": 0,
    "byte_start": 0,
    "column_end": 1,
    "column_start": 1,
    "expansion": null,
    "file_name": "src/main.rs",
    "is_primary": false,
    "label": "not covered",
    "line_end": 1,
    "line_start": 1,
    "suggested_replacement": null,
    "suggestion_applicability": null,
    "text": [
      {
        "highlight_end": 1,
        "highlight_start": 1,
        "text": "#![allow(unused)]"
      }
    ]
  }

For tools that consume JSON output, this results in a strange message being displayed.

cc @Centril

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions