When you need to remove an implementation of a trait, you can use negative impls. The feature is nightly only, and needs to be enabled with #![feature(negative_impls)].

Then you can use it like this:

#![feature(negative_impls)]
 
// I have some magic semantics for some synchronization primitive!
struct SpecialThreadToken(u8);
 
impl !Send for SpecialThreadToken {}
impl !Sync for SpecialThreadToken {}

References

  • J. Gjengset, Rust for Rustaceans: Idiomatic Programming for Experienced Developers. No Starch Press, 2021.