-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encountered error Unimplemented
selecting Binder(<[closure ...] as Fn()>)
during trans
#34349
Comments
Looks like a regression; 1.9 outputs the correct "trait bound is not satisfied" error. |
Unimplemented
selecting Binder(...)
during transUnimplemented
selecting Binder(<[closure ...] as Fn()>)
during trans
cc @soltanmm |
assigning P-medium to keep it out of brson's sight |
1.11 is now beta |
|
The issue is that upvar inference mutates the |
@arielb1 so I looked into this some. Is the problem related to caching? That is, we solve the trait once with |
Because basically I think things are largely working as they are supposed to -- and an error would be expected, except that I think a cache is kicking in. Disabling caching for these sorts of predicates would probably fix the problem (I'll try it), though of course it'd be nice in a way if we could surface the closure kind up into the key (not sure how that would work though). |
OK, I have a simple patch that fixes this. It moves the computation of the closure-kind into a temporary table; the final results are copied into the main table only when done. The result is that the |
Doing final testing now, hopefully have a PR up soon. |
We used to write a temporary closure kind into the inference table, but this could lead to obligations being incorrectled resolved before inference had completed. This result could then be cached, leading to further trouble. This patch avoids writing any closure kind until the computation is complete. Fixes rust-lang#34349.
Last time I checked the problem wasn't caching, but that the "[closure ...]: Fn" obligation, left over from type-checking, was incorrectly marked as resolved. |
That is what I meant by caching, basically. |
Avoid writing a temporary closure kind We used to write a temporary closure kind into the inference table, but this could lead to obligations being incorrectled resolved before inference had completed. This result could then be cached, leading to further trouble. This patch avoids writing any closure kind until the computation is complete. Fixes #34349. r? @arielb1 -- what do you think?
We used to write a temporary closure kind into the inference table, but this could lead to obligations being incorrectled resolved before inference had completed. This result could then be cached, leading to further trouble. This patch avoids writing any closure kind until the computation is complete. Fixes rust-lang#34349.
We used to write a temporary closure kind into the inference table, but this could lead to obligations being incorrectled resolved before inference had completed. This result could then be cached, leading to further trouble. This patch avoids writing any closure kind until the computation is complete. Fixes rust-lang#34349.
I was going over the examples on Rust by Example (section 8.2.2) when I encountered the following error:
Encountered error 'Unimplemented' selecting 'Binder(<[[email protected]:11:17: 14:6 farewell:&mut std::string::String] as std::ops::Fn<()>>)' during trans
.In the
apply()
function, if I replaceFn()
withFnMut()
orFnOnce()
, the code works (withFnMut()
it fails of course), but if I keepFn()
, the compiler panics.If I remove the
inc()
call, the compiler also doesn't panic.Source code
Stack trace
Version
rustc 1.11.0-nightly (5c2a5d4 2016-06-11)
binary: rustc
commit-hash: 5c2a5d4
commit-date: 2016-06-11
host: x86_64-pc-windows-gnu
release: 1.11.0-nightly
The same problem occurs on Linux, also Nightly.
The text was updated successfully, but these errors were encountered: