]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mutexguard-sync.rs
Auto merge of #102992 - nnethercote:rm-RunCompiler-emitter, r=bjorn3
[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 }