Skip to content

Is there any reason to allow 'import name;' #1116

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

Closed
marijnh opened this issue Nov 2, 2011 · 2 comments
Closed

Is there any reason to allow 'import name;' #1116

marijnh opened this issue Nov 2, 2011 · 2 comments

Comments

@marijnh
Copy link
Contributor

marijnh commented Nov 2, 2011

Where name is a single identifier without module path.

If the import can see it, it was already visible, so importing doesn't help. Thus, we can simply ignore such directives. Or we can disallow them for being bogus.

Thoughts?

@brson
Copy link
Contributor

brson commented Nov 2, 2011

The only effect I can think of is that it verifies that some identifier is in scope, so you could

``
import std::vec::*;
import filter_map;


To protect yourself against filter_map disappearing from the vec mod. Not particularly useful. I agree it could be made an error.

@marijnh
Copy link
Contributor Author

marijnh commented Nov 2, 2011

It looked as if my solution for #1114 would interact badly with this, but in fact it doesn't, so I'm in favour of just leaving it in for consistency. (import foo = bar; should definitely be allowed).

@marijnh marijnh closed this as completed Nov 2, 2011
flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 24, 2022
…nishearth

Add lint `cast_enum_constructor`

fixes: rust-lang#1116

changelog: Add lint `cast_enum_constructor`
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants