mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
6d0c91fda3
Suggest using a lock instead.
13 lines
402 B
Rust
13 lines
402 B
Rust
#![feature(once_cell)]
|
|
|
|
fn require_sync<T: Sync>() {}
|
|
//~^ NOTE required by this bound in `require_sync`
|
|
//~| NOTE required by a bound in `require_sync`
|
|
|
|
fn main() {
|
|
require_sync::<std::cell::OnceCell<()>>();
|
|
//~^ ERROR `OnceCell<()>` cannot be shared between threads safely
|
|
//~| NOTE `OnceCell<()>` cannot be shared between threads safely
|
|
//~| NOTE use `std::sync::OnceLock` instead
|
|
}
|