Match & with &mut in RFC-3627 2024 Match ergonomics

⚓ Rust    📅 2025-09-25    👤 surdeus    👁️ 8      

surdeus

Warning

This post was published 36 days ago. The information described in this article may have changed.

In RFC-3627 it says:

On all editions, & patterns can match against &mut references.

But when i run this code:
let &foo = &mut 42;
the compiler complains that types differ in mutability. I've tested this in multiple versions even before 2024. The result is the same.

It is interesting to me that this is not mentioned in 2024 edition guide!

2 posts - 2 participants

Read full topic

🏷️ Rust_feed