]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/issue-84973-blacklist.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / issue-84973-blacklist.rs
1 // Checks that certain traits for which we don't want to suggest borrowing
2 // are blacklisted and don't cause the suggestion to be issued.
3
4 #![feature(generators)]
5
6 fn f_copy<T: Copy>(t: T) {}
7 fn f_clone<T: Clone>(t: T) {}
8 fn f_unpin<T: Unpin>(t: T) {}
9 fn f_sized<T: Sized>(t: T) {}
10 fn f_send<T: Send>(t: T) {}
11
12 struct S;
13
14 fn main() {
15     f_copy("".to_string()); //~ ERROR: the trait bound `String: Copy` is not satisfied [E0277]
16     f_clone(S); //~ ERROR: the trait bound `S: Clone` is not satisfied [E0277]
17     f_unpin(static || { yield; });
18     //~^ ERROR: cannot be unpinned [E0277]
19
20     let cl = || ();
21     let ref_cl: &dyn Fn() -> () = &cl;
22     f_sized(*ref_cl);
23     //~^ ERROR: the size for values of type `dyn Fn()` cannot be known at compilation time [E0277]
24
25     use std::rc::Rc;
26     let rc = Rc::new(0);
27     f_send(rc); //~ ERROR: `Rc<{integer}>` cannot be sent between threads safely [E0277]
28 }