mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
f4b9ac68f3
Fixes: #125526
16 lines
374 B
Rust
16 lines
374 B
Rust
#![feature(reentrant_lock)]
|
|
use std::sync::ReentrantLock;
|
|
use std::cell::Cell;
|
|
|
|
// ReentrantLockGuard<Cell<i32>> must not be Sync, that would be unsound.
|
|
|
|
fn test_sync<T: Sync>(_t: T) {}
|
|
|
|
fn main()
|
|
{
|
|
let m = ReentrantLock::new(Cell::new(0i32));
|
|
let guard = m.lock();
|
|
test_sync(guard);
|
|
//~^ ERROR `Cell<i32>` cannot be shared between threads safely [E0277]
|
|
}
|