You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this is working as intended. use std::clone::Clone; imports both the trait and the derive macro (which lives in different namespaces). Thus the #[derive(Clone)] is using the derive that you imported, not the one in the standard library prelude (it is shadowed by the import). They are one in the same, but you could also write use my_derive_macro::Clone; and it would use a different derive. I believe this started with #63056.
@ehuss Thanks for the explanation. I didn't consider that the prelude Clone is a re-export, so they're not the same. The prelude could be considered special for detecting unused imports, but I don't think that's necessary.
Code
I tried this code:
I expected to see this happen: The code compiles with a warning about the import being unused.
Instead, this happened: The code compiles with no warnings.
Version it worked on
It most recently worked on: Rust 1.37
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: