]> git.proxmox.com Git - rustc.git/blob - src/test/ui/not-sync.rs
New upstream version 1.49.0+dfsg1
[rustc.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 `Cell<i32>` cannot be shared between threads safely [E0277]
10 test::<RefCell<i32>>();
11 //~^ ERROR `RefCell<i32>` cannot be shared between threads safely [E0277]
12
13 test::<Rc<i32>>();
14 //~^ ERROR `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 `Sender<i32>` cannot be shared between threads safely [E0277]
22 }