-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Bad error message trying to use Box as a tuple struct #22488
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
Seems like more of a diagnostics issue. The fix for this specific code is to replace |
Triage: this now has a different, yet still confusing, error:
|
That error is correct; but either way, the other error you get today is this, which while not ideal, is possibly the best we can do. I guess we could look for a
|
It is, but it is a common enough pattern and such a big enhancement in end user experience that I feel it'd be worth it to add it, specially when the ctor is not public. Then, the output should be:
Similar output, but not quite the same cause in #22692. |
In order to implement this there's a bit of roadblock at the moment. The verification if a struct has a given method is done in You can look for traits that have a given method ( |
Current output:
|
@estebank The error message seems pretty good... let's close this? |
@Centril I still think that we should see if any associated function would fit the bill. Definitely low priority now given the other improvements on the error. |
We still need to look for |
Suggest assoc fn `new` when trying to build tuple struct with private fields Fix rust-lang#22488.
Suggest assoc fn `new` when trying to build tuple struct with private fields Fix rust-lang#22488.
Suggest assoc fn `new` when trying to build tuple struct with private fields Fix rust-lang#22488.
Suggest assoc fn `new` when trying to build tuple struct with private fields Fix rust-lang#22488.
Could someone change the bad title? I am not good for english.
The text was updated successfully, but these errors were encountered: