External Publication
Visit Post

Idea: Borrowck Transparent Function Calls

Rust Internals [Unofficial] March 21, 2026
Source

I recently thought about syntax like this:

struct Foo {
    foo: usize,
    bar: usize,
}

impl Foo {
    fn foo_mut(Self { foo, .. }: &mut Self) -> &mut usize {
        foo
    }
}

This compiles today. Maybe the borrow checker could infer that only foo is being used here?

Discussion in the ATmosphere

Loading comments...