Skip to content

Off-by-one in suggested fix for typos in macro names #47418

Closed
@Vlad-Shcherbina

Description

@Vlad-Shcherbina

Consider the following program:

fn main() {
    panec!()
}

Relevant part of the rustc .\src\main.rs --error-format=json output:

"spans": [
    {
        "file_name": ".\\src\\main.rs",
        "byte_start": 16,
        "byte_end": 21,
        "line_start": 2,
        "line_end": 2,
        "column_start": 5,
        "column_end": 10,
        "is_primary": true,
        "text": [
            {
                "text": "    panec!()",
                "highlight_start": 5,
                "highlight_end": 10
            }
        ],
        "label": null,
        "suggested_replacement": "panic!",
        "expansion": null
    }
],

So it suggests to replace fragment "panec" with "panic!", which results in extra exclamation point.


> rustc --version --verbose
rustc 1.25.0-nightly (61452e506 2018-01-09)
binary: rustc
commit-hash: 61452e506f0c88861cccaeea4ced3419bdb3cbe0
commit-date: 2018-01-09
host: x86_64-pc-windows-msvc
release: 1.25.0-nightly
LLVM version: 4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-dev-toolsRelevant to the dev-tools subteam, 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