fn do_stuff_fails(foo @ Foo { a, b }: &mut Foo) {
*a = 42;
*b = 69;
accept(foo)
}
fn do_stuff_works(foo: &mut Foo) {
let Foo { a, b } = foo;
*a = 42;
*b = 69;
accept(foo)
}
struct Foo {
a: u32,
b: u32,
}
fn accept(_: &mut Foo) {}
It would be pretty cool if the lifetimes of foo
and {a, b}
in do_stuff_fails
could be inferred as spanning disjoints blocks of code as in the do_stuff_works
example.