Pattern Migration 2024: reword to make sense on all Editions by dianne · Pull Request #136475 · rust-lang/rust (original) (raw)
@dianne I think the "this" is not very clear when it's directly in the diagnostic message. maybe something like:
How does this look? I wanted to get something that worked for both mutable and shared references, in case we're labeling both ref
and ref mut
default binding modes, so we can have just one help after all the notes (any more feels excessive):
note: the default binding mode changed to `ref`
--> $DIR/migration_lint.rs:57:9
|
LL | let Foo(&x) = &Foo(&0);
| ^^^^^^^ this matches on type `&_`
= help: matching on a reference type with a non-reference pattern changes the default binding mode
Looking at it as a whole though, the note's message feels a bit redundant with the labels on the main diagnostic, so I tried moving the help into the note again:
note: matching on type `&_` with a non-`&` pattern changes the default binding mode
--> $DIR/migration_lint.rs:57:9
|
LL | let Foo(&x) = &Foo(&0);
| ^^^^^^^ this matches on type `&_`
But then ref
is missing.. maybe it could go at the end of the note or the label? e.g. "matching on type &_
with a non-&
pattern changes the default binding mode to ref
". It's a bit long, but all the information's there, at least.
I'm worried we might be overdoing this x)
Likely, yeah. ^^;