]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/auto-trait-leak.rs
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / impl-trait / auto-trait-leak.rs
1 // ignore-tidy-linelength
2
3 use std::cell::Cell;
4 use std::rc::Rc;
5
6 fn send<T: Send>(_: T) {}
7
8 fn main() {
9 }
10
11 // Cycles should work as the deferred obligations are
12 // independently resolved and only require the concrete
13 // return type, which can't depend on the obligation.
14 fn cycle1() -> impl Clone {
15     //~^ ERROR cycle detected
16     //~| ERROR cycle detected
17     send(cycle2().clone());
18     //~^ ERROR cannot be sent between threads safely
19
20     Rc::new(Cell::new(5))
21 }
22
23 fn cycle2() -> impl Clone {
24     send(cycle1().clone());
25
26     Rc::new(String::from("foo"))
27 }