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