-
Notifications
You must be signed in to change notification settings - Fork 13.4k
negative trait bounds give nonsense error #125297
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Thank you for your report. Since |
To elaborate, we don't guarantee anything when internal features are “misused” in the broadest of senses of the word. This includes diagnostics. |
However, if you're just curious about what's going on: Your code should in fact not compile since a negative trait bound The "fix" for your code would be the following: Playground (namely turning the positive |
I presume these are the steps taken by the trait solver (simplified):
|
I tried this code:
I expected to see this happen: the code should build successfully.
Instead, this happened: nonsense compiler error
also note that if
new()
is not available due to any trait bounds, the compiler will recommend callingnew()
.Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: