As a variant on this, I encountered the following a few weeks ago:
pub fn new([...], config_custom_toolchains: Vec<config::CustomToolchain>) -> Self {
[...]
for ct in config_custom_toolchains.into_iter() {
[...]
let CustomToolchain { compiler_executable, archive } = ct;
// use compiler_executable and archive
Altering the Vec in the code above to be a slice causes problems much further down in the usage of compiler_executable and archive because the types become incorrect.
This was quite confusing to me, likely because I’ve spent so long without match ergonomics that I’ve built up a particular mental model. Specifically, I see any form of let Struct { ... } = s as a checkpoint for my ‘type reasoning’ - scanning it instantly lets me know the exact types coming out of the expression (i.e. a kind of type annotation). With match ergonomics this is no longer the case and so I must either write something like let Struct { ... }: Struct = s, keep all the borrow state in my head or accept the loss of the checkpoint (so errors end up further away when I compile). I’ll be interested to see how I adapt longer term (this is my first real encounter in the wild).
I would’ve spent longer on this if I hadn’t already been aware of match ergonomics (as it’s such a sharp departure from previous behavior). It made me wonder if there are good ways to flag “the compiler made a type decision here that affects your later errors” - it’s probably not an issue for new users, but I expect initial confusion among Rust-using coworkers who (like me) need to re-examine how they reason about some bits of Rust code but (unlike me) have no idea about the match ergonomics feature.