]> git.lizzy.rs Git - rust.git/commitdiff
Merge #1845
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Tue, 24 Sep 2019 21:12:26 +0000 (21:12 +0000)
committerGitHub <noreply@github.com>
Tue, 24 Sep 2019 21:12:26 +0000 (21:12 +0000)
1845: Closure types r=flodiebold a=flodiebold

This adds types for closures and makes them implement the `Fn` traits (we don't currently care or try to infer `Fn` vs. `FnMut` vs. `FnOnce`; this would require move analysis, I think).

This requires some changes in Chalk; one is that we need to know the self type when asked for impls, so we can synthesize `Fn` trait impls for closures; but also there's a problem that prevents us from normalizing the closure output type correctly that I _think_ will be fixed on the Chalk side (basically, we ask too early and try to solve `Normalize(<?1 as FnOnce<(u32,)>>::Output => ?0)` -- note the variable in the self type -- and instead of an ambiguous answer, we get back that it can't be solved, so we don't try again. Niko mentioned he's making all goals where the self type is unconstrained flounder, which I think would mean this would be ambiguous).

Co-authored-by: Florian Diebold <flodiebold@gmail.com>

Trivial merge