]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/enum-drop-access.rs
6 impl<T
> Drop
for DropOption
<T
> {
10 // Dropping opt could access the value behind the reference,
11 fn drop_enum(opt
: DropOption
<&mut i32>) -> Option
<&mut i32> {
13 DropOption
::Some(&mut ref mut r
) => { //~ ERROR
16 DropOption
::None
=> None
,
20 fn optional_drop_enum(opt
: Option
<DropOption
<&mut i32>>) -> Option
<&mut i32> {
22 Some(DropOption
::Some(&mut ref mut r
)) => { //~ ERROR
25 Some(DropOption
::None
) | None
=> None
,
29 // Ok, dropping opt doesn't access the reference
30 fn optional_tuple(opt
: Option
<(&mut i32, String
)>) -> Option
<&mut i32> {
32 Some((&mut ref mut r
, _
)) => {
39 // Ok, dropping res doesn't access the Ok case.
40 fn different_variants(res
: Result
<&mut i32, String
>) -> Option
<&mut i32> {
42 Ok(&mut ref mut r
) => {