-
Notifications
You must be signed in to change notification settings - Fork 933
Labels
a-imports`use` syntax`use` syntaxbugPanic, non-idempotency, invalid code, etc.Panic, non-idempotency, invalid code, etc.only-with-optionrequires a non-default option value to reproducerequires a non-default option value to reproduce
Description
I have a project with a module that re-exports other definitions as follows:
mod defs {
#[cfg(feature = "std")]
pub use std::vec;
#[cfg(not(feature = "std"))]
pub use alloc::vec;
}
Oftentimes I want to use the vec!
macro and Vec
type like so:
use defs::{
vec,
vec::Vec,
};
However, rustfmt
thinks this is worse than
use defs::vec::{self, Vec};
However, this has different semantics since vec
above refers to the vec!
macro while self
in the replaced variant refers to the vec
submodule of defs
. So I can no longer access the vec!
macro whenever rustfmt
replaced this.
To be honest: I don't know whether this is a rustfmt
bug or a Rust compiler bug.
Metadata
Metadata
Assignees
Labels
a-imports`use` syntax`use` syntaxbugPanic, non-idempotency, invalid code, etc.Panic, non-idempotency, invalid code, etc.only-with-optionrequires a non-default option value to reproducerequires a non-default option value to reproduce