Description
Can we permit attributes on use
items? I would like the following snippet to be syntactically and semantically valid.
use crate::{alpha, beta, #[cfg(feature = "foo")] gamma};
This would be equivalent to
use crate::{alpha, beta};
#[cfg(feature = "foo")]
use crate::gamma;
This would permit me to use rustfmt's option of one import per module and have it actually be true, rather than one import per module per feature gate. Attributes such as #[allow(unused_imports)]
are plausibly useful in this position as well.
Syntactically I see no conflicts in the reference, as #
starts any attribute and is unambiguous with the start of an identifier and ::
.
This feels simple enough to not need a full RFC, which as far as I can tell is what is technically required. I had thought MCPs were for this, but that turns out to be for non-user-facing changes, and ACP deals with T-libs territory. So consider this a lang-MCP, if you will?
cc @rust-lang/lang