-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
inconsistent and confusing error message about first argument of assert! #122159
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
No response
Rationale and extra context
The macro
assert!is documented as taking a bool as its first parameter. Therefore I suggest the error message beexpected `bool`, found `i8`in both cases.The very different error messages are very confusing, because
Result::unwrapandResult::unwrap_errare basically the same. While I understand both error messages, I do not understand why they are different.Edit: I just realized it's probably because
i8has an implementation ofstd::ops::Not. Still weird.Other cases
No response
Rust Version
Anything else?
No response