Closed
Description
#![feature(negative_impls)]
struct Foo<T, U>(T, U);
impl<T> !Send for Foo<T, T> {}
struct Bar<T, U>(T, U);
unsafe impl<T> Send for Bar<T, T> {}
results in the following:
warning: cross-crate traits with a default impl, like `Send`, should not be specialized
--> src/lib.rs:7:1
|
7 | unsafe impl<T> Send for Bar<T, T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this will change its meaning in a future release!
= note: for more information, [see issue #93367 <https://github.com/rust-lang/rust/issues/93367>](https://github.com/rust-lang/rust/issues/93367)
= note: `T` is mentioned multiple times
note: try using the same sequence of generic parameters as the struct definition
--> src/lib.rs:6:1
|
6 | struct Bar<T, U>(T, U);
| ^^^^^^^^^^^^^^^^
= note: `#[warn(suspicious_auto_trait_impls)]` on by default
the lint should also be emitted for the negative impl. The lint was implemented in #93267. To fix that remove the following line and add a test:
rust/compiler/rustc_hir_analysis/src/coherence/orphan.rs
Lines 481 to 483 in 8c0f83d