-
Notifications
You must be signed in to change notification settings - Fork 961
Closed as not planned
Labels
A-commentsArea: commentsArea: commentsA-importsArea: imports, e.g. `use` syntaxArea: imports, e.g. `use` syntaxS-duplicateStatus: duplicate of another issue or PRStatus: duplicate of another issue or PR
Description
Here is a case where rustfmt, as part of reordering imports, literally moves a comment from one import to another, entirely destroying its meaning:
mod realstd {
struct __FastLocalKeyInner;
}
mod local {
mod fast {
struct Key;
}
}
#[cfg(test)] // comment associated with realstd import
pub use realstd::thread::__FastLocalKeyInner;
#[cfg(test)]
pub use self::local::fast::Key as __FastLocalKeyInnerUnused; // comment associated with fast import
fn main() {}After formatting, the imports look like
#[cfg(test)]
pub use self::local::fast::Key as __FastLocalKeyInnerUnused;
#[cfg(test)] // comment associated with realstd import
pub use realstd::thread::__FastLocalKeyInner; // comment associated with fast importNot that the comment that explained the use self::local::fast::Key as, got moved to the other use!
This is with rustfmt 1.5.1-nightly (2022-08-05 affe0d3).
Metadata
Metadata
Assignees
Labels
A-commentsArea: commentsArea: commentsA-importsArea: imports, e.g. `use` syntaxArea: imports, e.g. `use` syntaxS-duplicateStatus: duplicate of another issue or PRStatus: duplicate of another issue or PR