You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pubenumFoo{X{foo:u32},Y{bar:u32}}pubfnfoo(mutx:Foo){letmut y = None;letmut z = None;ifletFoo::X{ref foo } = x {
z = Some(foo);}ifletFoo::Y{refmut bar } = x {
y = Some(bar);}drop((y, z));}fnmain(){}
If you change the fields to have identical names, it doesn't:
pubenumFoo{X{foo:u32},Y{foo:u32}}pubfnfoo(mutx:Foo){letmut y = None;letmut z = None;ifletFoo::X{ref foo } = x {
z = Some(foo);//~ NOTE previous borrow of `x.foo` occurs here}ifletFoo::Y{refmut foo } = x {
y = Some(foo);//~ ERROR cannot borrow `x.foo` as mutable}drop((y, z));}fnmain(){}
Expected
Field names aren't supposed to be significant between different variants.
The text was updated successfully, but these errors were encountered:
STR
This compiles:
If you change the fields to have identical names, it doesn't:
Expected
Field names aren't supposed to be significant between different variants.
The text was updated successfully, but these errors were encountered: