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