]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-var-type-out-of-scope.rs
internally change regions to be covariant
[rust.git] / tests / ui / regions / regions-var-type-out-of-scope.rs
1 fn id<T>(x: T) -> T { x }
2
3 fn foo(cond: bool) {
4     // Here we will infer a type that uses the
5     // region of the if stmt then block:
6     let mut x;
7
8     if cond {
9         x = &id(3); //~ ERROR temporary value dropped while borrowed
10         assert_eq!(*x, 3);
11     }
12 }
13
14 fn main() {}