-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Papercut: Suggest Default::default()
when binding isn't initialized
#102087
Comments
@rustbot claim |
Maybe it's better to suggest |
Agree. I'm also unsure whether |
Sure, that's also nice, I think 🙂
We kinda-sorta can, right? I think it should be possible to have top-down rules such that we:
... although considering that I'm not sure on already-existing diagnostics though, maybe there exists some precedent (in which case it'd be nice to follow it). |
…sugg, r=nagisa Suggest Default::default() when binding isn't initialized Fixes rust-lang#102087
…gg, r=nagisa Suggest Default::default() when binding isn't initialized Fixes rust-lang#102087
Given the following code:
(playground link)
... the current output is:
While this message is correct, people (especially beginners) stumbling upon it sometimes still don't know what to do (e.g. they expect
let var: ty;
to automatically initializevar
toDefault::default()
, as is the case in some languages).Maybe we could extend the message to say:
... with an extra case that if
ty
isDefault
:The text was updated successfully, but these errors were encountered: