diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2024-02-19 17:39:25 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2024-02-19 17:41:48 -0300 |
| commit | 086463b227ea12c244243609cce5c795dc3ec40a (patch) | |
| tree | 4b1eb3c69d76eda8f858eb9b1086732c2087a06f /tests/ui/auto-traits | |
| parent | eee9d2a773f8c38c83f251c41ea2ec879d7c825c (diff) | |
| download | rust-086463b227ea12c244243609cce5c795dc3ec40a.tar.gz rust-086463b227ea12c244243609cce5c795dc3ec40a.zip | |
Remove suspicious auto trait lint
Diffstat (limited to 'tests/ui/auto-traits')
| -rw-r--r-- | tests/ui/auto-traits/issue-117789.rs | 2 | ||||
| -rw-r--r-- | tests/ui/auto-traits/issue-117789.stderr | 4 | ||||
| -rw-r--r-- | tests/ui/auto-traits/issue-83857-ub.rs | 1 | ||||
| -rw-r--r-- | tests/ui/auto-traits/issue-83857-ub.stderr | 12 | ||||
| -rw-r--r-- | tests/ui/auto-traits/suspicious-impls-lint.rs | 50 | ||||
| -rw-r--r-- | tests/ui/auto-traits/suspicious-impls-lint.stderr | 82 | ||||
| -rw-r--r-- | tests/ui/auto-traits/suspicious-negative-impls-lint.rs | 21 | ||||
| -rw-r--r-- | tests/ui/auto-traits/suspicious-negative-impls-lint.stderr | 52 |
8 files changed, 8 insertions, 216 deletions
diff --git a/tests/ui/auto-traits/issue-117789.rs b/tests/ui/auto-traits/issue-117789.rs index 0c30931a1b5..63f796771db 100644 --- a/tests/ui/auto-traits/issue-117789.rs +++ b/tests/ui/auto-traits/issue-117789.rs @@ -1,5 +1,3 @@ -#![deny(suspicious_auto_trait_impls)] - auto trait Trait<P> {} //~ ERROR auto traits cannot have generic parameters //~^ ERROR auto traits are experimental and possibly buggy impl<P> Trait<P> for () {} diff --git a/tests/ui/auto-traits/issue-117789.stderr b/tests/ui/auto-traits/issue-117789.stderr index 1f8880b1ef4..99efb213417 100644 --- a/tests/ui/auto-traits/issue-117789.stderr +++ b/tests/ui/auto-traits/issue-117789.stderr @@ -1,5 +1,5 @@ error[E0567]: auto traits cannot have generic parameters - --> $DIR/issue-117789.rs:3:17 + --> $DIR/issue-117789.rs:1:17 | LL | auto trait Trait<P> {} | -----^^^ help: remove the parameters @@ -7,7 +7,7 @@ LL | auto trait Trait<P> {} | auto trait cannot have generic parameters error[E0658]: auto traits are experimental and possibly buggy - --> $DIR/issue-117789.rs:3:1 + --> $DIR/issue-117789.rs:1:1 | LL | auto trait Trait<P> {} | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/auto-traits/issue-83857-ub.rs b/tests/ui/auto-traits/issue-83857-ub.rs index f9b47d2b0c6..20abfdd851a 100644 --- a/tests/ui/auto-traits/issue-83857-ub.rs +++ b/tests/ui/auto-traits/issue-83857-ub.rs @@ -1,4 +1,3 @@ -#![allow(suspicious_auto_trait_impls)] // Tests that we don't incorrectly allow overlap between a builtin auto trait // impl and a user written one. See #83857 for more details diff --git a/tests/ui/auto-traits/issue-83857-ub.stderr b/tests/ui/auto-traits/issue-83857-ub.stderr index 6372bdfe762..20bfe7e36ca 100644 --- a/tests/ui/auto-traits/issue-83857-ub.stderr +++ b/tests/ui/auto-traits/issue-83857-ub.stderr @@ -1,12 +1,12 @@ error[E0277]: `Foo<T, U>` cannot be sent between threads safely - --> $DIR/issue-83857-ub.rs:22:38 + --> $DIR/issue-83857-ub.rs:21:38 | LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo<T, U>` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `Foo<T, U>`, which is required by `Foo<T, U>: WithAssoc` note: required for `Foo<T, U>` to implement `WithAssoc` - --> $DIR/issue-83857-ub.rs:15:15 + --> $DIR/issue-83857-ub.rs:14:15 | LL | impl<T: Send> WithAssoc for T { | ---- ^^^^^^^^^ ^ @@ -18,7 +18,7 @@ LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i | +++++++++++++++++++++ error[E0277]: `Foo<T, U>` cannot be sent between threads safely - --> $DIR/issue-83857-ub.rs:22:80 + --> $DIR/issue-83857-ub.rs:21:80 | LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i32) { | ________________________________________________________________________________^ @@ -31,7 +31,7 @@ LL | | } | = help: the trait `Send` is not implemented for `Foo<T, U>`, which is required by `Foo<T, U>: WithAssoc` note: required for `Foo<T, U>` to implement `WithAssoc` - --> $DIR/issue-83857-ub.rs:15:15 + --> $DIR/issue-83857-ub.rs:14:15 | LL | impl<T: Send> WithAssoc for T { | ---- ^^^^^^^^^ ^ @@ -43,7 +43,7 @@ LL | fn generic<T, U>(v: Foo<T, U>, f: fn(<Foo<T, U> as WithAssoc>::Output) -> i | +++++++++++++++++++++ error[E0277]: `Foo<T, U>` cannot be sent between threads safely - --> $DIR/issue-83857-ub.rs:25:11 + --> $DIR/issue-83857-ub.rs:24:11 | LL | f(foo(v)); | --- ^ `Foo<T, U>` cannot be sent between threads safely @@ -52,7 +52,7 @@ LL | f(foo(v)); | = help: the trait `Send` is not implemented for `Foo<T, U>` note: required by a bound in `foo` - --> $DIR/issue-83857-ub.rs:29:11 + --> $DIR/issue-83857-ub.rs:28:11 | LL | fn foo<T: Send>(x: T) -> <T as WithAssoc>::Output { | ^^^^ required by this bound in `foo` diff --git a/tests/ui/auto-traits/suspicious-impls-lint.rs b/tests/ui/auto-traits/suspicious-impls-lint.rs deleted file mode 100644 index 7712e84f4a2..00000000000 --- a/tests/ui/auto-traits/suspicious-impls-lint.rs +++ /dev/null @@ -1,50 +0,0 @@ -#![deny(suspicious_auto_trait_impls)] - -use std::marker::PhantomData; - -struct MayImplementSendOk<T>(T); -unsafe impl<T: Send> Send for MayImplementSendOk<T> {} // ok - -struct MayImplementSendErr<T>(T); -unsafe impl<T: Send> Send for MayImplementSendErr<&T> {} -//~^ ERROR -//~| WARNING this will change its meaning - -struct ContainsNonSendDirect<T>(*const T); -unsafe impl<T: Send> Send for ContainsNonSendDirect<&T> {} // ok - -struct ContainsPtr<T>(*const T); -struct ContainsIndirectNonSend<T>(ContainsPtr<T>); -unsafe impl<T: Send> Send for ContainsIndirectNonSend<&T> {} // ok - -struct ContainsVec<T>(Vec<T>); -unsafe impl Send for ContainsVec<i32> {} -//~^ ERROR -//~| WARNING this will change its meaning - -struct TwoParams<T, U>(T, U); -unsafe impl<T: Send, U: Send> Send for TwoParams<T, U> {} // ok - -struct TwoParamsFlipped<T, U>(T, U); -unsafe impl<T: Send, U: Send> Send for TwoParamsFlipped<U, T> {} // ok - -struct TwoParamsSame<T, U>(T, U); -unsafe impl<T: Send> Send for TwoParamsSame<T, T> {} -//~^ ERROR -//~| WARNING this will change its meaning - -pub struct WithPhantomDataNonSend<T, U>(PhantomData<*const T>, U); -unsafe impl<T> Send for WithPhantomDataNonSend<T, i8> {} // ok - -pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U); -unsafe impl<T> Send for WithPhantomDataSend<*const T, i8> {} -//~^ ERROR -//~| WARNING this will change its meaning - -pub struct WithLifetime<'a, T>(&'a (), T); -unsafe impl<T> Send for WithLifetime<'static, T> {} // ok -unsafe impl<T> Sync for WithLifetime<'static, Vec<T>> {} -//~^ ERROR -//~| WARNING this will change its meaning - -fn main() {} diff --git a/tests/ui/auto-traits/suspicious-impls-lint.stderr b/tests/ui/auto-traits/suspicious-impls-lint.stderr deleted file mode 100644 index 9cd4e79f851..00000000000 --- a/tests/ui/auto-traits/suspicious-impls-lint.stderr +++ /dev/null @@ -1,82 +0,0 @@ -error: cross-crate traits with a default impl, like `Send`, should not be specialized - --> $DIR/suspicious-impls-lint.rs:9:1 - | -LL | unsafe impl<T: Send> Send for MayImplementSendErr<&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> - = note: `&T` is not a generic parameter -note: try using the same sequence of generic parameters as the struct definition - --> $DIR/suspicious-impls-lint.rs:8:1 - | -LL | struct MayImplementSendErr<T>(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/suspicious-impls-lint.rs:1:9 - | -LL | #![deny(suspicious_auto_trait_impls)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: cross-crate traits with a default impl, like `Send`, should not be specialized - --> $DIR/suspicious-impls-lint.rs:21:1 - | -LL | unsafe impl Send for ContainsVec<i32> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = 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> - = note: `i32` is not a generic parameter -note: try using the same sequence of generic parameters as the struct definition - --> $DIR/suspicious-impls-lint.rs:20:1 - | -LL | struct ContainsVec<T>(Vec<T>); - | ^^^^^^^^^^^^^^^^^^^^^ - -error: cross-crate traits with a default impl, like `Send`, should not be specialized - --> $DIR/suspicious-impls-lint.rs:32:1 - | -LL | unsafe impl<T: Send> Send for TwoParamsSame<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> - = note: `T` is mentioned multiple times -note: try using the same sequence of generic parameters as the struct definition - --> $DIR/suspicious-impls-lint.rs:31:1 - | -LL | struct TwoParamsSame<T, U>(T, U); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: cross-crate traits with a default impl, like `Send`, should not be specialized - --> $DIR/suspicious-impls-lint.rs:40:1 - | -LL | unsafe impl<T> Send for WithPhantomDataSend<*const T, i8> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = 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> - = note: `*const T` is not a generic parameter -note: try using the same sequence of generic parameters as the struct definition - --> $DIR/suspicious-impls-lint.rs:39:1 - | -LL | pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: cross-crate traits with a default impl, like `Sync`, should not be specialized - --> $DIR/suspicious-impls-lint.rs:46:1 - | -LL | unsafe impl<T> Sync for WithLifetime<'static, Vec<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> - = note: `Vec<T>` is not a generic parameter -note: try using the same sequence of generic parameters as the struct definition - --> $DIR/suspicious-impls-lint.rs:44:1 - | -LL | pub struct WithLifetime<'a, T>(&'a (), T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 5 previous errors - diff --git a/tests/ui/auto-traits/suspicious-negative-impls-lint.rs b/tests/ui/auto-traits/suspicious-negative-impls-lint.rs deleted file mode 100644 index 34842e5944b..00000000000 --- a/tests/ui/auto-traits/suspicious-negative-impls-lint.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(negative_impls)] -#![deny(suspicious_auto_trait_impls)] - -use std::marker::PhantomData; - -struct ContainsVec<T>(Vec<T>); -impl !Send for ContainsVec<u32> {} -//~^ ERROR -//~| WARNING this will change its meaning - -pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U); -impl<T> !Send for WithPhantomDataSend<*const T, u8> {} -//~^ ERROR -//~| WARNING this will change its meaning - -pub struct WithLifetime<'a, T>(&'a (), T); -impl<T> !Sync for WithLifetime<'static, Option<T>> {} -//~^ ERROR -//~| WARNING this will change its meaning - -fn main() {} diff --git a/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr b/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr deleted file mode 100644 index ee03ea12557..00000000000 --- a/tests/ui/auto-traits/suspicious-negative-impls-lint.stderr +++ /dev/null @@ -1,52 +0,0 @@ -error: cross-crate traits with a default impl, like `Send`, should not be specialized - --> $DIR/suspicious-negative-impls-lint.rs:7:1 - | -LL | impl !Send for ContainsVec<u32> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = 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> - = note: `u32` is not a generic parameter -note: try using the same sequence of generic parameters as the struct definition - --> $DIR/suspicious-negative-impls-lint.rs:6:1 - | -LL | struct ContainsVec<T>(Vec<T>); - | ^^^^^^^^^^^^^^^^^^^^^ -note: the lint level is defined here - --> $DIR/suspicious-negative-impls-lint.rs:2:9 - | -LL | #![deny(suspicious_auto_trait_impls)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: cross-crate traits with a default impl, like `Send`, should not be specialized - --> $DIR/suspicious-negative-impls-lint.rs:12:1 - | -LL | impl<T> !Send for WithPhantomDataSend<*const T, u8> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = 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> - = note: `*const T` is not a generic parameter -note: try using the same sequence of generic parameters as the struct definition - --> $DIR/suspicious-negative-impls-lint.rs:11:1 - | -LL | pub struct WithPhantomDataSend<T, U>(PhantomData<T>, U); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: cross-crate traits with a default impl, like `Sync`, should not be specialized - --> $DIR/suspicious-negative-impls-lint.rs:17:1 - | -LL | impl<T> !Sync for WithLifetime<'static, Option<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> - = note: `Option<T>` is not a generic parameter -note: try using the same sequence of generic parameters as the struct definition - --> $DIR/suspicious-negative-impls-lint.rs:16:1 - | -LL | pub struct WithLifetime<'a, T>(&'a (), T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors - |
