-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Global paths in use
directives can begin with super
or self
#32225
Comments
What semantic are you expecting (question for anyone who read there)? Compiler looking for top-level entity named "super" and not founds and says that you probably want to export "super". Btw if I wrote I would be prefer to fix it, if it is an error. EDIT. Sorry. I am read your issue again and understand that Both errors (possibly wrong message about error and super context that ignoring double-colons at begin) is may be solved by checking for keywords in "::foo::bar" statement. Actually next links in chain "::self::self::self" is checked by parser. |
Agreed, I think that is the best way to fix this issue.
That would be great, let me know if you have any questions! |
@rust-lang/lang, do we plan on having some sort of semantics for this, or is this just a bug? |
I think the fact that |
Hello.
Yesterday I commit my changes that fix something. The thing is that issue can be divided into two different tasks. The first
And it already solved via ad-hoc checking in global context if is_global && self.token.is_special_ident_in_modname() {
return Err(self.fatal(&format!("expected identifier, found special identifier `{}`",
self.this_token_to_string())));
} Error message probably should be replaced by more general "expected identifier, found keyword". Adding some comments and it may be pull requested. The second task is more general: wrong error message. rustc is really looking for crate or module named But in case if error message is important:
|
Fix issue: Global paths in `use` directives can begin with `super` or `self` rust-lang#32225 This PR fixes rust-lang#32225 by warning on `use ::super::...` and `use ::self::...` on `resolve`. Current changes is the most minimal and ad-hoc.
For example,
The text was updated successfully, but these errors were encountered: