Skip to content

Infer argument types for unboxed closures by inspecting the expected type #19089

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conversation

nikomatsakis
Copy link
Contributor

This also lays the groundwork for a simple version of inference to decide on FnOnce vs FnMut etc.

Fixes #17907

r? @pcwalton

@nikomatsakis nikomatsakis force-pushed the issue-17907-infer-arg-types-in-unboxed-closures branch from f742c70 to be370d6 Compare November 19, 2014 01:47
@nikomatsakis nikomatsakis force-pushed the issue-17907-infer-arg-types-in-unboxed-closures branch from be370d6 to 8e44688 Compare November 19, 2014 10:53
@japaric
Copy link
Member

japaric commented Nov 19, 2014

@nikomatsakis Tidy error:

/home/travis/build/rust-lang/rust/src/librustc/middle/typeck/check/closure.rs:132: line longer than 100 chars

@nikomatsakis
Copy link
Contributor Author

Closing in favor of #19113.

bors added a commit that referenced this pull request Nov 20, 2014
…ation, r=acrichto

Use the expected type to infer the argument/return types of unboxed closures. Also, in `||` expressions, use the expected type to decide if the result should be a boxed or unboxed closure (and if an unboxed closure, what kind).

This supercedes PR #19089, which was already reviewed by @pcwalton.
@nikomatsakis nikomatsakis deleted the issue-17907-infer-arg-types-in-unboxed-closures branch March 30, 2016 16:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unboxed closures: Type inferencer failed to detect closure argument types
3 participants