]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/restrict-type-argument.rs
Rollup merge of #105795 - nicholasbishop:bishop-stabilize-efiapi, r=joshtriplett
[rust.git] / tests / ui / suggestions / restrict-type-argument.rs
1 fn is_send<T: Send>(val: T) {}
2
3 fn use_impl_sync(val: impl Sync) {
4     is_send(val); //~ ERROR `impl Sync` cannot be sent between threads safely
5 }
6
7 fn use_where<S>(val: S) where S: Sync {
8     is_send(val); //~ ERROR `S` cannot be sent between threads safely
9 }
10
11 fn use_bound<S: Sync>(val: S) {
12     is_send(val); //~ ERROR `S` cannot be sent between threads safely
13 }
14
15 fn use_bound_2<
16     S // Make sure we can synthezise a correct suggestion span for this case
17     :
18     Sync
19 >(val: S) {
20     is_send(val); //~ ERROR `S` cannot be sent between threads safely
21 }
22
23 fn use_bound_and_where<S: Sync>(val: S) where S: std::fmt::Debug {
24     is_send(val); //~ ERROR `S` cannot be sent between threads safely
25 }
26
27 fn use_unbound<S>(val: S) {
28     is_send(val); //~ ERROR `S` cannot be sent between threads safely
29 }
30
31 fn main() {}