]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mutexguard-sync.rs
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
[rust.git] / src / test / ui / mutexguard-sync.rs
1 // MutexGuard<Cell<i32>> must not be Sync, that would be unsound.
2 use std::sync::Mutex;
3 use std::cell::Cell;
4
5 fn test_sync<T: Sync>(_t: T) {}
6
7 fn main()
8 {
9     let m = Mutex::new(Cell::new(0i32));
10     let guard = m.lock().unwrap();
11     test_sync(guard);
12     //~^ ERROR `Cell<i32>` cannot be shared between threads safely [E0277]
13 }