]>
Commit | Line | Data |
---|---|---|
923072b8 | 1 | // compile-flags:-Zverbose |
dfeec247 | 2 | // check-pass |
3157f602 | 3 | |
ff7c6d11 XL |
4 | // Test that we assume that universal types like `T` outlive the |
5 | // function body. | |
5bcae85e | 6 | |
ff7c6d11 XL |
7 | use std::cell::Cell; |
8 | ||
9 | fn twice<F, T>(value: T, mut f: F) | |
10 | where | |
11 | F: FnMut(Cell<&T>), | |
12 | { | |
13 | f(Cell::new(&value)); | |
14 | f(Cell::new(&value)); | |
15 | } | |
16 | ||
ff7c6d11 XL |
17 | fn generic<T>(value: T) { |
18 | // No error here: | |
19 | twice(value, |r| invoke(r)); | |
20 | } | |
21 | ||
22 | fn invoke<'a, T>(x: Cell<&'a T>) | |
23 | where | |
24 | T: 'a, | |
25 | { | |
26 | } | |
9e0c209e | 27 | |
ff7c6d11 | 28 | fn main() {} |