Sign in
fuchsia
/
third_party
/
rust
/
346aec9b02f3c74f3fce97fd6bda24709d220e49
/
.
/
src
/
test
/
ui
/
regions
/
regions-var-type-out-of-scope.rs
blob: aba55e9df6ac6baef4c0468738c5343171241679 [
file
] [
log
] [
blame
]
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
()
{}