summaryrefslogtreecommitdiffstats
path: root/tests/ui/sync/suggest-once-cell.rs
blob: 14f40ad87a3abebac6a9397f87a114b6c1130ddc (plain)
1
2
3
4
5
6
7
8
9
10
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
}