]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/ty-outlives/ty-param-implied-bounds.rs
Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
[rust.git] / tests / ui / nll / ty-outlives / ty-param-implied-bounds.rs
1 // compile-flags:-Zverbose
2 // check-pass
3
4 // Test that we assume that universal types like `T` outlive the
5 // function body.
6
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
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 }
27
28 fn main() {}