]> git.lizzy.rs Git - rust.git/blob - src/test/ui/not-sync.rs
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
[rust.git] / src / test / ui / not-sync.rs
1 use std::cell::{Cell, RefCell};
2 use std::rc::{Rc, Weak};
3 use std::sync::mpsc::{Receiver, Sender};
4
5 fn test<T: Sync>() {}
6
7 fn main() {
8     test::<Cell<i32>>();
9     //~^ ERROR `std::cell::Cell<i32>` cannot be shared between threads safely [E0277]
10     test::<RefCell<i32>>();
11     //~^ ERROR `std::cell::RefCell<i32>` cannot be shared between threads safely [E0277]
12
13     test::<Rc<i32>>();
14     //~^ ERROR `std::rc::Rc<i32>` cannot be shared between threads safely [E0277]
15     test::<Weak<i32>>();
16     //~^ ERROR `std::rc::Weak<i32>` cannot be shared between threads safely [E0277]
17
18     test::<Receiver<i32>>();
19     //~^ ERROR `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely [E0277]
20     test::<Sender<i32>>();
21     //~^ ERROR `std::sync::mpsc::Sender<i32>` cannot be shared between threads safely [E0277]
22 }