Skip to content

Red highlighting in the wrong spot in the "help: remove the extra argument" message #147070

@carols10cents

Description

@carols10cents

The one time where a screenshot is needed rather than copy-pasting the output! 🤣

Code

When I attempt to compile:

struct Thingie;

impl Thingie {
    pub(crate) fn new(
        _a: String,
        _b: String,
        _c: String,
        _d: String,
        _e: String,
        _f: String,
    ) -> Self {
        unimplemented!()
    }
}

fn main() {
    let foo = Thingie::new(
        String::from(""),
        String::from(""),
        String::from(""),
        String::from(""),
        String::from(""),
        String::from(""),
        String::from(""),
    );
}

Current output

I'm seeing this, note the "n" in "argument" that's highlighted:

Image

Desired output

I think the intention is for the whole 23 - String::from(""), line to be red?

When I change the code to:

fn main() {
    let foo = Thingie::new(
        String::from("a"),
        String::from("b"),
        String::from("c"),
        String::from("d"),
        String::from("e"),
        String::from("f"),
        String::from("g"),
    );
}

then I see this:

Image

Which is also weird? Why is the comma on the previous line red instead of the line that needs to be removed?

Other cases

I have some proprietary code that whenever I try to reduce or obfuscate it, the behavior goes away, but instead of just an "n" I'm seeing "he extra argument" in red:

Image

Rust Version

I'm seeing this behavior with stable, beta, and nightly as follows:

❯ rustc +stable --version --verbose
rustc 1.90.0 (1159e78c4 2025-09-14)
binary: rustc
commit-hash: 1159e78c4747b02ef996e55082b704c09b970588
commit-date: 2025-09-14
host: aarch64-apple-darwin
release: 1.90.0
LLVM version: 20.1.8
❯ rustc +beta --version --verbose
rustc 1.91.0-beta.3 (bb624dcb4 2025-09-20)
binary: rustc
commit-hash: bb624dcb4c8ab987e10c0808d92d76f3b84dd117
commit-date: 2025-09-20
host: aarch64-apple-darwin
release: 1.91.0-beta.3
LLVM version: 21.1.1
❯ rustc +nightly --version --verbose
rustc 1.92.0-nightly (7ac0330c6 2025-09-25)
binary: rustc
commit-hash: 7ac0330c6d684d86d6f86fabe601a3defdc3b234
commit-date: 2025-09-25
host: aarch64-apple-darwin
release: 1.92.0-nightly
LLVM version: 21.1.2

Other info

I'm on macos Sequoia 15.7 using iTerm2 3.6.2 and zsh. Happy to provide more env info or try eliminating various causes!

Also note that this isn't reproducible in the playground because the playground has its own highlighting system and doesn't use the terminal's highlighting at all 😭

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.T-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