-
Notifications
You must be signed in to change notification settings - Fork 13k
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
associated constants can't be use
d
#24915
Comments
This isn't intended to work; associated types and methods can't be used in this way either, so this behavior is consistent with those cases, although I can see how A workaround would be to just declare a copy/alias of the constant in the scope where you wanted to const SUP: &'static str = Foo::SUP; This doesn't seem to work for associated types, though, so I should probably file a bug for that if there's not one already. |
The suggested workaround does work now, but the original issue remains. |
Do we want this? It feels sort of weird to allow |
Nominating for the lang team. I think it makes sense to discuss this, since it relates to @eddyb's (I believe) thoughts on moving the |
We can just deprecate the old modules without removing them. |
Right, but whereas right now in a module that deals with just |
This isn't something that was part of the original specification for associated constants. Folks in @rust-lang/lang generally thought this sounded plausible, but it needs an RFC written to specify it. |
This was brought up in #52556. |
https://is.gd/vYwA6X
main.rs:
rustc:
I'm not sure if this is specifically not intended, but it seems to me that it would be convenient to mirror the behaviour of enums in this way. cc @quantheory
The text was updated successfully, but these errors were encountered: