python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Weird type when pattern matching references
I encountered this strange behaviour when reading this post, and the core question of this post is when you matching (&k, &v) = &(&String, &String) , k and v will get the type Stri...
Steve Lau
Votes: 0
Answers: 2
Match ergonomics and & pattern
Consider following code
fn main() {
let s = (&&0,);
let (x,) = s; // &&i32
let (&y,) = s; // &i32
let (&&z,) = s; // i32
let t = &(&0,);
...
ZeroXbot
Votes: 0
Answers: 1
What does pattern-matching a non-reference against a reference do in Rust?
What happens when pattern-matching against a reference with a pattern that doesn't include a reference?
Here's an example using a struct pattern:
fn main() {
struct S(u32);
let S(x) = &S(2...
Max Heiber
Votes: 0
Answers: 1