-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
(Mostly) diagnostics involving super
are weird
#39330
Comments
An equivalent alternative to As discussed on IRC, the downside of accepting Overall, I don't have strong opinion on whether having
Agreed. To be clear, |
@jseyfried Good points. Along the lines of what you said, we can implement the std-in-prelude RFC (which I haven't written yet) with I otherwise agree with cleaning up the diagnostics around |
How I see this:
This should work. Root module is a usual module (mostly) and can be imported.
This should work too.
This should work and import an unusable name (currently
The error is now different:
The wording looks ok, but may be tweaked to mention root or something.
This is already done. The error message is
So, the action items here:
|
super
is a keyword. There can’t ever be anything namedsuper
in the root.Similarly, rustc should be reporting that
super
is a keyword and cannot be used as an identifier. I suspect the error arises from the fact that super is parsed to be the whole pattern here. Example below results in the same diagnostic, but may be easier to understand why the error is what it is:Notably you cannot have something like this either:
So in general this error message could be improved to say that
super
is a module (?) and cannot be used in a pattern this way.We over at the #rust-lang have ideas how a
use super as root
could be used to make life easier (@solson said they’ll write an RFC). In other cases resolve should probably just stop acceptingsuper
by itself and/or just resolve it to a module.The text was updated successfully, but these errors were encountered: