yet another "old borrowck" bug around match default bindings #51686
Conversation
Hmm, adding in the asserts I wanted caused some failures elsewhere that I don't know if I fully want to mix into this PR. I'm going to remove the WIP. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
0885d97
to
8289bf2
@bors r+ |
|
@bors p=17 |
…t-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
|
Nominating this to be backported into beta, especially if this is going to get into 1.27.1. |
[beta] Rollup backports Merged and approved: * #51725: Do not build LLVM tools for any of the tools * #51852: Don't use `ParamEnv::reveal_all()` if there is a real one available * #51686: yet another "old borrowck" bug around match default bindings * #51868: Remove process::id from 'Stabilized APIs' in 1.27.0 release notes * #51335: Prohibit `global_allocator` in submodules r? @ghost
This looks like a typo introduced in rust-lang#51686. Fixes rust-lang#52213.
This looks like a typo introduced in rust-lang#51686. Fixes rust-lang#52213.
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