Closed
Description
Given the following code:
pub type T = Copy;
Running rustc foo.rs --error=format=json
produces two machine-applicable suggestions. One of them is an empty span which has no effect. The relevant part of the JSON output is:
{
"message": "use `dyn`",
"code": null,
"level": "help",
"spans":
[
{
"file_name": "foo.rs",
"byte_start": 13,
"byte_end": 13,
"line_start": 1,
"line_end": 1,
"column_start": 14,
"column_end": 14,
"is_primary": true,
"text":
[
{
"text": "pub type T = Copy;",
"highlight_start": 14,
"highlight_end": 14
}
],
"label": null,
"suggested_replacement": "dyn ",
"suggestion_applicability": "MachineApplicable",
"expansion": null
},
{
"file_name": "foo.rs",
"byte_start": 17,
"byte_end": 17,
"line_start": 1,
"line_end": 1,
"column_start": 18,
"column_end": 18,
"is_primary": true,
"text":
[
{
"text": "pub type T = Copy;",
"highlight_start": 18,
"highlight_end": 18
}
],
"label": null,
"suggested_replacement": "",
"suggestion_applicability": "MachineApplicable",
"expansion": null
}
],
"children":
[],
"rendered": null
}
Notice that the second suggestion is an empty string for an empty span.
I expect this to not emit an empty span suggestion.
rustc 1.66.0-nightly (8b0c05d9a 2022-10-07)
binary: rustc
commit-hash: 8b0c05d9ad7121cdb97600f261bcd5f04c8db20d
commit-date: 2022-10-07
host: x86_64-apple-darwin
release: 1.66.0-nightly
LLVM version: 15.0.2