Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
skondrashov opened this issue Aug 27, 2022 · 3 comments · Fixed by #13133
Closed

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

skondrashov opened this issue Aug 27, 2022 · 3 comments · Fixed by #13133
Labels
A-diagnostics diagnostics / error reporting A-vscode vscode plugin issues C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@skondrashov
Copy link

skondrashov commented Aug 27, 2022

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.

@skondrashov skondrashov changed the title Excess positional arguments in format string cause some errors to be silent Excess placeholders in format string cause some errors to be silent Aug 27, 2022
@jonas-schievink
Copy link
Contributor

Last time this happened, it was because we were emitting the diagnostics with an empty message string. Maybe that logic has regressed?

@jonas-schievink jonas-schievink added A-vscode vscode plugin issues S-actionable Someone could pick this issue up and work on it right now A-diagnostics diagnostics / error reporting C-bug Category: bug labels Aug 27, 2022
@flodiebold
Copy link
Member

The errors show up fine for me in Emacs.

@Veykril
Copy link
Member

Veykril commented Aug 28, 2022

Ye seems like #13016 #13017 doesn't fully work, there are still some cases where VSCode just throws, guess we'll have to move the workaround back into the server and given VSCode doesn't consider this a bug it will have to stay there ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics diagnostics / error reporting A-vscode vscode plugin issues C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants