@@ -2677,6 +2677,28 @@ defined. For more information see the [opt-in builtin traits RFC](https://github
26772677.com/rust-lang/rfcs/blob/master/text/0019-opt-in-builtin-traits.md).
26782678"## ,
26792679
2680+ E0321 : r##"
2681+ A cross-crate opt-out trait was implemented on something which wasn't a struct
2682+ or enum type. Erroneous code example:
2683+
2684+ ```
2685+ #![feature(optin_builtin_traits)]
2686+
2687+ struct Foo;
2688+
2689+ impl !Sync for Foo {}
2690+
2691+ unsafe impl Send for &'static Foo {
2692+ // error: cross-crate traits with a default impl, like `core::marker::Send`,
2693+ // can only be implemented for a struct/enum type, not
2694+ // `&'static Foo`
2695+ ```
2696+
2697+ Only structs and enums are permitted to impl Send, Sync, and other opt-out
2698+ trait, and the struct or enum must be local to the current crate. So, for
2699+ example, `unsafe impl Send for Rc<Foo>` is not allowed.
2700+ "## ,
2701+
26802702E0322 : r##"
26812703The `Sized` trait is a special trait built-in to the compiler for types with a
26822704constant size known at compile-time. This trait is automatically implemented
@@ -3463,7 +3485,6 @@ register_diagnostics! {
34633485// E0246, // invalid recursive type
34643486// E0319, // trait impls for defaulted traits allowed just for structs/enums
34653487 E0320 , // recursive overflow during dropck
3466- E0321 , // extended coherence rules for defaulted traits violated
34673488 E0328 , // cannot implement Unsize explicitly
34683489 E0374 , // the trait `CoerceUnsized` may only be implemented for a coercion
34693490 // between structures with one field being coerced, none found
0 commit comments