diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-06-29 23:13:37 +0500 |
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-06-30 11:50:19 +0500 |
| commit | bf5910d9bb0c5cc3e4fb1a1a9ed3d73e26793c71 (patch) | |
| tree | eeec900b449e7889d0b828c9aca5f6676c943770 /tests/ui/traits/struct-negative-sync-impl.rs | |
| parent | 4b6c3d923f9c9ec869bfc77e6c08e98f9de87ac8 (diff) | |
| download | rust-bf5910d9bb0c5cc3e4fb1a1a9ed3d73e26793c71.tar.gz rust-bf5910d9bb0c5cc3e4fb1a1a9ed3d73e26793c71.zip | |
cleaned up some tests
Diffstat (limited to 'tests/ui/traits/struct-negative-sync-impl.rs')
| -rw-r--r-- | tests/ui/traits/struct-negative-sync-impl.rs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/ui/traits/struct-negative-sync-impl.rs b/tests/ui/traits/struct-negative-sync-impl.rs index 7d8a36a76f2..d32846276f6 100644 --- a/tests/ui/traits/struct-negative-sync-impl.rs +++ b/tests/ui/traits/struct-negative-sync-impl.rs @@ -1,14 +1,21 @@ +//! Test negative Sync implementation on structs. +//! +//! Uses the unstable `negative_impls` feature to explicitly opt-out of Sync. + #![feature(negative_impls)] use std::marker::Sync; -struct Foo { a: isize } -impl !Sync for Foo {} +struct NotSync { + value: isize, +} + +impl !Sync for NotSync {} -fn bar<T: Sync>(_: T) {} +fn requires_sync<T: Sync>(_: T) {} fn main() { - let x = Foo { a: 5 }; - bar(x); - //~^ ERROR `Foo` cannot be shared between threads safely [E0277] + let not_sync = NotSync { value: 5 }; + requires_sync(not_sync); + //~^ ERROR `NotSync` cannot be shared between threads safely [E0277] } |
