]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/auto-trait-leak.rs
Rollup merge of #95374 - RalfJung:assert_uninit_valid, r=Mark-Simulacrum
[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     //~| ERROR cycle detected
15     send(cycle2().clone());
16
17     Rc::new(Cell::new(5))
18 }
19
20 fn cycle2() -> impl Clone {
21     send(cycle1().clone());
22
23     Rc::new(String::from("foo"))
24 }