blob: aba55e9df6ac6baef4c0468738c5343171241679 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
fn id<T>(x: T) -> T { x }
fn foo(cond: bool) {
// Here we will infer a type that uses the
// region of the if stmt then block:
let mut x;
if cond {
x = &id(3); //~ ERROR temporary value dropped while borrowed
assert_eq!(*x, 3);
}
}
fn main() {}
|