8 impl<T> Drop for DropOption<T> {
12 // Dropping opt could access the value behind the reference,
13 fn drop_enum(opt: DropOption<&mut i32>) -> Option<&mut i32> {
15 DropOption::Some(&mut ref mut r) => { //~ ERROR
18 DropOption::None => None,
22 fn optional_drop_enum(opt: Option<DropOption<&mut i32>>) -> Option<&mut i32> {
24 Some(DropOption::Some(&mut ref mut r)) => { //~ ERROR
27 Some(DropOption::None) | None => None,
31 // Ok, dropping opt doesn't access the reference
32 fn optional_tuple(opt: Option<(&mut i32, String)>) -> Option<&mut i32> {
34 Some((&mut ref mut r, _)) => {
41 // Ok, dropping res doesn't access the Ok case.
42 fn different_variants(res: Result<&mut i32, String>) -> Option<&mut i32> {
44 Ok(&mut ref mut r) => {