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

Error message is confusing when changing opt levels #8234

Closed
steveklabnik opened this issue May 12, 2020 · 0 comments · Fixed by #8235
Closed

Error message is confusing when changing opt levels #8234

steveklabnik opened this issue May 12, 2020 · 0 comments · Fixed by #8235
Labels
C-bug Category: bug

Comments

@steveklabnik
Copy link
Member

I was trying out different optimization levels on a project. I started with s:

[profile.release]
opt-level = "s"

I wanted to compare it to 3, so I changed it:

[profile.release]
opt-level = "3"

This gives the error:

error: failed to parse manifest at `C:\Users\steve\tmp\oss101\Cargo.toml`

Caused by:
  must be an integer, `z`, or `s`, but found: 3 for key `profile.release.opt-level`

The error is that it's the string "3" not the integer 3, but the error message doesn't make this very clear.

@steveklabnik steveklabnik added the C-bug Category: bug label May 12, 2020
bors added a commit that referenced this issue May 12, 2020
…lexcrichton

Expand error message to explain that a string was found

With `opt-level = "3"` this previously said:

    must be an integer, `z`, or `s`, but found: 3 for ...

The error message doesn't make that super clear.
This should now be a bit more clear.

Fixes #8234

---

We could even include a bit more saying that `"3"` should become 3 (either unconditionally or after trying to parse `"3"` into an integer?

cc @steveklabnik
@bors bors closed this as completed in 09084a3 May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant