I believe @drXor was paraphrasing me from our Discord conversation.
I want to clarify that what I meant by this is that I believe ref will be used much less frequently given match ergonomics. I have no plans to propose deprecating ref and I think I would be opposed to it at this stage.
Regarding the idea of having move, it seems like filling a missing piece of the puzzle in a natural way.
In particular, given type ascription, you can say:
match expr {
Some(move x: &usize) => { println!("{:?}", x); }
}
and you will know that expr : &Option<&usize> and that expr : &Option<usize> is not possible.
Furthermore, consider:
trait Foo {
fn new() -> Self;
}
impl Foo for &'static Option<usize> {
fn new() -> Self { &Some(0) }
}
impl Foo for &'static Option<&'static usize> {
fn new() -> Self { &Some(&1) }
}
fn main() {
let x: &_ = Foo::new();
if let Some(x) = x {
let x: &usize = x;
// Prints 0.
println!("{}", x);
}
}
In this case, the dynamic semantics of printing x is directly affected by which mode you pick.
By having move, we could ensure that 1 gets printed.
Having move also strikes me as advantageous for teaching by showing an in-language desugaring for match ergonomics.
All in all, I believe move $pat is an idea worth considering.