-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
"TRUE" does not parse into boolean #101870
Comments
It looks like Rust properly parses "true" and "false" in lowercase to a boolean but not the capitalized "TRUE" or "FALSE". This is documented here: |
It's not clearly documented what exactly is and is not supposed to be parsed, but I think that the current behaviour of only parsing For comparison, here's what a few other languages do:
|
I opened #102094 which should fix this issue. |
…ng-docs, r=scottmcm Add missing documentation for `bool::from_str` Fixes rust-lang#101870.
…ng-docs, r=scottmcm Add missing documentation for `bool::from_str` Fixes rust-lang#101870.
Summary of the issue
When taking input into my program, I ran into a situation where the user would pass "TRUE" into a field that I was attempting to use the .parse() method into a boolean:
when I split this specific line of code into a fresh rust project:
I got the output:
thread 'main' panicked at 'NOPE: ParseBoolError', src/main.rs:20:34
What I expect to happen
I would expect rust to see the string value "TRUE" and read that as a boolean with the value
true
What actually happens
I am getting an error return with
MyErrorType
The text was updated successfully, but these errors were encountered: