This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Error applying replacements from module files #92
Labels
Comments
Yes indeed, this was tracked in https://github.com/rust-lang/rust/issues/35164apparently fixed in rust-lang/rust#42973 a year ago, and this looks like it's still there. Looks like byte indices are actually legit and something else is wrong here? |
Yeah, I'm stupid. We get two suggestions for this specific case:
This should of course not overlap! We can remove the JSON{
"message": {
"children": [
{
"children": [],
"code": null,
"level": "note",
"message": "#[warn(unused_variables)] on by default",
"rendered": null,
"spans": []
},
{
"children": [],
"code": null,
"level": "help",
"message": "consider using `_i` instead",
"rendered": null,
"spans": [
{
"byte_end": 3828,
"byte_start": 3823,
"column_end": 14,
"column_start": 9,
"expansion": null,
"file_name": "cargo-fix/src/cli.rs",
"is_primary": true,
"label": null,
"line_end": 110,
"line_start": 110,
"suggested_replacement": "_i",
"text": [
{
"highlight_end": 14,
"highlight_start": 9,
"text": " let mut i = 42;"
}
]
}
]
}
],
"code": {
"code": "unused_variables",
"explanation": null
},
"level": "warning",
"message": "unused variable: `i`",
"rendered": "warning: unused variable: `i`\n --> cargo-fix/src/cli.rs:110:9\n |\n110 | let mut i = 42;\n | ^^^^^ help: consider using `_i` instead\n |\n = note: #[warn(unused_variables)] on by default\n\n",
"spans": [
{
"byte_end": 3828,
"byte_start": 3823,
"column_end": 14,
"column_start": 9,
"expansion": null,
"file_name": "cargo-fix/src/cli.rs",
"is_primary": true,
"label": null,
"line_end": 110,
"line_start": 110,
"suggested_replacement": null,
"text": [
{
"highlight_end": 14,
"highlight_start": 9,
"text": " let mut i = 42;"
}
]
}
]
},
"package_id": "cargo-fix 0.2.0 (path+file:///Users/pascal/Projekte/rustfix/cargo-fix)",
"reason": "compiler-message",
"target": {
"crate_types": [
"bin"
],
"kind": [
"bin"
],
"name": "cargo-fix",
"src_path": "/Users/pascal/Projekte/rustfix/cargo-fix/src/main.rs"
}
}
{
"message": {
"children": [
{
"children": [],
"code": null,
"level": "note",
"message": "#[warn(unused_mut)] on by default",
"rendered": null,
"spans": []
},
{
"children": [],
"code": null,
"level": "help",
"message": "remove this `mut`",
"rendered": null,
"spans": [
{
"byte_end": 3827,
"byte_start": 3823,
"column_end": 13,
"column_start": 9,
"expansion": null,
"file_name": "cargo-fix/src/cli.rs",
"is_primary": true,
"label": null,
"line_end": 110,
"line_start": 110,
"suggested_replacement": "",
"text": [
{
"highlight_end": 13,
"highlight_start": 9,
"text": " let mut i = 42;"
}
]
}
]
}
],
"code": {
"code": "unused_mut",
"explanation": null
},
"level": "warning",
"message": "variable does not need to be mutable",
"rendered": "warning: variable does not need to be mutable\n --> cargo-fix/src/cli.rs:110:9\n |\n110 | let mut i = 42;\n | ----^\n | |\n | help: remove this `mut`\n |\n = note: #[warn(unused_mut)] on by default\n\n",
"spans": [
{
"byte_end": 3828,
"byte_start": 3823,
"column_end": 14,
"column_start": 9,
"expansion": null,
"file_name": "cargo-fix/src/cli.rs",
"is_primary": true,
"label": null,
"line_end": 110,
"line_start": 110,
"suggested_replacement": null,
"text": [
{
"highlight_end": 14,
"highlight_start": 9,
"text": " let mut i = 42;"
}
]
}
]
},
"package_id": "cargo-fix 0.2.0 (path+file:///Users/pascal/Projekte/rustfix/cargo-fix)",
"reason": "compiler-message",
"target": {
"crate_types": [
"bin"
],
"kind": [
"bin"
],
"name": "cargo-fix",
"src_path": "/Users/pascal/Projekte/rustfix/cargo-fix/src/main.rs"
}
} |
Long story short this is actually rust-lang/rust#50472 and I should get some sleep. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It seems I have reintroduced a bug with regard to byte indices in module files.
Simple example: This change to rustfix itself
leads to this output
That range looks an awful lot like the index in the whole crate's source, not in
cli.rs
. I'm pretty sure there is such a property in the compiler's json output, though, and I'm just not using it correctly.The text was updated successfully, but these errors were encountered: