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
trait Trait {
type AssociatedType;
fn trait_fn(&self, set: std::collections::HashSet<Self::AssociatedType>);
}
A mutable key type lint is emitted on std::collections::HashSet<Self::AssociatedType> in the trait definition, but not in impls of that trait (interestingly not even in trait impls where Trait::AssociatedType is AtomicUsize).
While Trait::AssociatedType could be an internally mutable type, I think the correct place to lint this would be in impls that actually set Trait::AssociatedType to an internally mutable type.
Minimal example:
A
mutable key type
lint is emitted onstd::collections::HashSet<Self::AssociatedType>
in the trait definition, but not in impls of that trait (interestingly not even in trait impls whereTrait::AssociatedType
isAtomicUsize
).While
Trait::AssociatedType
could be an internally mutable type, I think the correct place to lint this would be in impls that actually setTrait::AssociatedType
to an internally mutable type.Reproducible on the playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=094f6136a26c9911ee8dae0dcf94f150
The text was updated successfully, but these errors were encountered: