#![feature(reentrant_lock)] use std::sync::ReentrantLock; use std::cell::Cell; // ReentrantLockGuard> must not be Sync, that would be unsound. fn test_sync(_t: T) {} fn main() { let m = ReentrantLock::new(Cell::new(0i32)); let guard = m.lock(); test_sync(guard); //~^ ERROR `Cell` cannot be shared between threads safely [E0277] }