Closed
Description
While working on my follow-up to #17439 I rediscovered an old problem in our ast representation:
We usually act like you can unambiguously map a node_id
to a single type for that node id. However, if you want to know the type of a pattern like the ref x
in:
let t = Some(box 3i);
match t {
Some(ref x) => ...,
None => ...,
}
then you have a problem: are you trying to find the type of the thing that is being borrowed by the match (i.e. int
in this case)? Or are you trying to find the type of x
itself (&int
in this case)?
The problem is that there is just one node_id
for the entire ref <id>
pattern, even though there are two distinct things that you are potentially trying to match.