Sign in
fuchsia
/
third_party
/
rust
/
9d09331e00b02f81c714b0c41ce3a38380dd36a2
/
.
/
src
/
test
/
ui
/
regions
/
regions-return-interior-of-option.rs
blob: 2dc91ec84f556977f41c56a36007911961117675 [
file
] [
log
] [
blame
]
// run-pass
fn
get
<
T
>(
opt
:
&
Option
<
T
>)
->
&
T
{
match
*
opt
{
Some
(
ref
v
)
=>
v
,
None
=>
panic
!(
"none"
)
}
}
pub
fn
main
()
{
let
mut
x
=
Some
(
23
);
{
let
y
=
get
(&
x
);
assert_eq
!(*
y
,
23
);
}
x
=
Some
(
24
);
{
let
y
=
get
(&
x
);
assert_eq
!(*
y
,
24
);
}
}