Open
Description
Hi. I was using a crate which had a struct with a number of associated items and I was trying to save typing in an error handling function. But:
12 | use rocket::http::Status::*;
| ^^^^^^ `Status` is a struct, not a module
I looked in the Reference and I wasn't able to find any discussion of this. In particular, I would expect it to be documented in the explanation of Use declarations under Items.
After considerably more digging, I found:
- associated constants can't be
use
d #24915, a closed issue where the resolution was that this is not expected to work - https://internals.rust-lang.org/t/importing-associated-constants/6610/5, a discussion about how to maybe implement this (although it seems unlikely that that approach could work for the glob import I was trying...)
It seems that this situation is likely to persist. Maybe the error message could be improved? Something like
hint: importing associated items is not supported; you must use a path from to the parent type each time
could help the user by letting them know they can't avoid the extra typing.
I will also file an issue against the Reference. Thanks for your attention.