Skip to content

Strange error message for incorrect format string #9931

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

Closed
bstrie opened this issue Oct 18, 2013 · 0 comments · Fixed by #9932
Closed

Strange error message for incorrect format string #9931

bstrie opened this issue Oct 18, 2013 · 0 comments · Fixed by #9932
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@bstrie
Copy link
Contributor

bstrie commented Oct 18, 2013

This program:

fn main() {
    println!("{:f.6}", 100.0);
}

...has this output:

ac.rs:2:13: 2:21 error: unterminated format string
ac.rs:2     println!("{:f.6}", 100.0);
                     ^~~~~~~~
error: aborting due to previous error

"unterminated" makes it sound as though the user hasn't used a closing quotation mark. Even if it's not possible to give a good error message here, a message like "unknown format specifier" would be more insightful.

bors added a commit that referenced this issue Oct 19, 2013
Instead of just saying "unterminated format string" and friends, instead print
information about what was expected and what was found.

Closes #9931
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant