Skip to content

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

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

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-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.
    on Jan 13, 2018
  2. added 2 commits that reference this issue on Jan 16, 2018
    c91a3c2
    83b8946
  3. added 2 commits that reference this issue on Jan 17, 2018
    2454799
    4cb8789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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