Skip to content

Excess placeholders in format string cause some errors to be silent #13130

Closed
@skondrashov

Description

@skondrashov

rust-analyzer version: rust-analyzer version: 0.3.1178-standalone (a670ff8 2022-08-21)

rustc version: rustc 1.63.0 (4b91a6ea7 2022-08-08)

fn main() {
    format!("{}{}", undeclared);
    undeclared;
    type; // <-- red underline
}

All 3 lines in main() have an error, but only the labeled one shows up for me in VSCode. After removing the format! line, the unknown value error properly shows up for undeclared;. Moving the lines and adding different errors mostly shows that some error types consistently don't show up near the macro invocation, and others do.

Interestingly, format!("{}", two, things); displays the correct errors, so not any placeholder/argument count mismatch causes this. {:?} placeholders cause the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsdiagnostics / error reportingA-vscodevscode plugin issuesC-bugCategory: bugS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions