about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-03 15:36:07 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-03 20:11:20 -0800
commit74f7e0693909a45f9159c6d2ef72b42fcb4f1bac (patch)
tree4a275ef4606878200f7a1e7ee57cf9fa1bb75b16 /src/libstd/sys
parent1d921f557d6d9e509ce0d696d7b2178628989935 (diff)
parent8ddcb06b1d021560bfe641c0dbc452a04e80388e (diff)
downloadrust-74f7e0693909a45f9159c6d2ef72b42fcb4f1bac.tar.gz
rust-74f7e0693909a45f9159c6d2ef72b42fcb4f1bac.zip
rollup merge of #21899: nikomatsakis/closure-unify-anyhow
This *almost* completes the job for #16440. The idea is that even if we do not know whether some closure type `C` implements `Fn` or `FnMut` (etc), we still know its argument and return types. So if we see an obligation `C : Fn(_0)`, we can unify `_0` with those argument types while still considering the obligation ambiguous and unsatisfied. This helps to make a lot of progress with type inference even before closure kind inference is done.

As part of this PR, the explicit `:` syntax is removed from the AST and completely ignored. We still infer the closure kind based on the expected type if that is available. There are several reasons for this. First, deciding the closure kind earlier is always better, as it allows us to make more progress. Second, this retains a (admittedly obscure) way for users to manually specify the closure kind, which is useful for writing tests if nothing else. Finally, there are still some cases where inference can fail, so it may be useful to have this manual override. (The expectation is that we will eventually revisit an explicit syntax for specifying the closure kind, but it will not be `:` and may be some sort of generalization of the `||` syntax to handle other traits as well.)

This commit does not *quite* fix #16640 because a snapshot is still needed to enable the obsolete syntax errors for explicit `&mut:` and friends.

r? @eddyb as he reviewed the prior patch in this direction
Diffstat (limited to 'src/libstd/sys')
0 files changed, 0 insertions, 0 deletions