2017-04-29 02:11:51 -05:00
|
|
|
// MutexGuard<Cell<i32>> must not be Sync, that would be unsound.
|
|
|
|
use std::sync::Mutex;
|
|
|
|
use std::cell::Cell;
|
|
|
|
|
|
|
|
fn test_sync<T: Sync>(_t: T) {}
|
|
|
|
|
|
|
|
fn main()
|
|
|
|
{
|
|
|
|
let m = Mutex::new(Cell::new(0i32));
|
|
|
|
let guard = m.lock().unwrap();
|
2018-02-10 23:01:49 -06:00
|
|
|
test_sync(guard);
|
2020-09-02 02:40:56 -05:00
|
|
|
//~^ ERROR `Cell<i32>` cannot be shared between threads safely [E0277]
|
2017-04-29 02:11:51 -05:00
|
|
|
}
|