# \[feat\] Functions should have a metadata describing what fields they modify or read

**URL:** <https://internals.rust-lang.org/t/feat-functions-should-have-a-metadata-describing-what-fields-they-modify-or-read/24842>\
**Category:** language design\
**Created:** [November 26, 2026, 9:11pm UTC](https://internals.rust-lang.org/t/feat-functions-should-have-a-metadata-describing-what-fields-they-modify-or-read/24842 "2026-11-26T21:11:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archee565](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@archee565](https://internals.rust-lang.org/u/archee565)\
**Post date:** [November 26, 2026, 9:11pm UTC](https://internals.rust-lang.org/t/feat-functions-should-have-a-metadata-describing-what-fields-they-modify-or-read/24842/1 "2026-11-26T21:11:44Z")

</div>

Hello developers,

### new borrow checker feature

Every function should have a metadata describing what fields or sub fields down the tree it modifies or reads from it's &mut parameters. The borrow checker could use this information to be more permissive in those cases, where inlining the called function would make it compile.

```rust
metadata for fn World::do_scoring = 
     ReadWrite [self.score],
     ReadOnly [self.people]
     

```

### why it matters?

Instead of passing on multiple data separately as ref(mut) parameters, you could just pass a &mut to the root data, usually &mut self.

Also the mutability of parameters and variables could be infered by the compiler, making it easier to code.

### Example:

```rust
struct World {
    bullets: Vec<i32>,
    people: Vec<i32>,
    score: i32,
}

impl World {
    pub fn do_scoring(&mut self) {
        self.score += self.people[2];
    }
}

fn main() {
    let mut world = World {
        bullets: vec![1; 8],
        people: vec![1; 8],
        score: 0,
    };

    let refbullet = &mut world.bullets[2];

    world.do_scoring(); // borrow error
    //world.score += world.people[2]; // would compile when inlining the same logic.

    *refbullet = 3;

    println!("score: {}", world.score);
}

```

---

<div class="post-metadata">

**Author:** ![scottmcm](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/scottmcm/32/2355_2.png) [@scottmcm](https://internals.rust-lang.org/u/scottmcm)\
**Post date:** [November 26, 2026, 9:56pm UTC](https://internals.rust-lang.org/t/feat-functions-should-have-a-metadata-describing-what-fields-they-modify-or-read/24842/2 "2026-11-26T21:56:08Z")

</div>

The name you're looking for is "view types": [View types for Rust · baby steps](https://smallcultfollowing.com/babysteps/blog/2021/11/05/view-types/)
