]> git.lizzy.rs Git - rust.git/blob - tests/ui/mutexguard-sync.rs
implement Hash for proc_macro::LineColumn
[rust.git] / tests / 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 }