]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / nll / ty-outlives / ty-param-implied-bounds.rs
CommitLineData
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
7use std::cell::Cell;
8
9fn twice<F, T>(value: T, mut f: F)
10where
11 F: FnMut(Cell<&T>),
12{
13 f(Cell::new(&value));
14 f(Cell::new(&value));
15}
16
ff7c6d11
XL
17fn generic<T>(value: T) {
18 // No error here:
19 twice(value, |r| invoke(r));
20}
21
22fn invoke<'a, T>(x: Cell<&'a T>)
23where
24 T: 'a,
25{
26}
9e0c209e 27
ff7c6d11 28fn main() {}