]> git.lizzy.rs Git - rust.git/commit
Auto merge of #51686 - nikomatsakis:issue-51415-borrowck-match-default-bindings-bug...
authorbors <bors@rust-lang.org>
Fri, 22 Jun 2018 06:36:11 +0000 (06:36 +0000)
committerbors <bors@rust-lang.org>
Fri, 22 Jun 2018 06:36:11 +0000 (06:36 +0000)
commit7dae5c0e06f10042fc3b29a55bf6285e539c06db
treeb5d5243140f0919ede4e9d5771dd73ea6b7593f8
parent4b17d31f1147f840231c43b1ac1478a497af20df
parent8289bf2994cc0522616275594cd2bd1a8d10d4b4
Auto merge of #51686 - nikomatsakis:issue-51415-borrowck-match-default-bindings-bug, r=eddyb

yet another "old borrowck" bug around match default bindings

We were getting the type of the parameter from its pattern, but that didn't include adjustments. I did a `ripgrep` around and this seemed to be the only affected case.

The reason this didn't show up as an ICE earlier is that mem-categorization is lenient with respect to weird discrepancies. I am going to add more delay-span-bug calls shortly around that (I'll push onto the PR).

This example is an ICE, but I presume that there is a way to make a soundness example out of this -- it basically ignores borrows occuring inside match-default-bindings in a closure, though only if the implicit deref is at the top-level. It happens though that this occurs frequently in iterators, which often give a `&T` parameter.

Fixes #51415
Fixes #49534

r? @eddyb