Skip to content
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

Assoc type bindings #1757

Merged
merged 4 commits into from
Sep 3, 2019
Merged

Assoc type bindings #1757

merged 4 commits into from
Sep 3, 2019

Conversation

flodiebold
Copy link
Member

This adds support for type bindings (bounds like where T: Iterator<Item = u32>).

It doesn't yet work in as many situations as I'd like because of some Chalk problems. But it works in some situations, and will at least not bitrot this way ;)

(part of the problem is that we use Normalize to normalize associated types, but produce ProjectionEq goals from where clauses, so Chalk can't normalize using the environment; this would be fixed by using ProjectionEq for normalization, which I think is the 'proper' way, but then we'd run into those ambiguity problems everywhere...)

@flodiebold flodiebold requested a review from matklad September 3, 2019 11:38
@matklad
Copy link
Member

matklad commented Sep 3, 2019

LGTM with de-morgan transformation applied

It's a bit complicated because we basically have to 'undo' the desugaring, and
the result is very dependent on the specifics of the desugaring and will
probably produce weird results otherwise.
If/when we switch to using Chalk's Ty, we'll need to replace this by its `Fold`
trait, but I didn't want to import the whole thing just yet.
@flodiebold
Copy link
Member Author

bors r+

bors bot added a commit that referenced this pull request Sep 3, 2019
1757: Assoc type bindings r=flodiebold a=flodiebold

This adds support for type bindings (bounds like `where T: Iterator<Item = u32>`).

It doesn't yet work in as many situations as I'd like because of some [Chalk problems](rust-lang/chalk#234). But it works in some situations, and will at least not bitrot this way ;)

(part of the problem is that we use `Normalize` to normalize associated types, but produce `ProjectionEq` goals from where clauses, so Chalk can't normalize using the environment; this would be fixed by using `ProjectionEq` for normalization, which I think is the 'proper' way, but then we'd run into those ambiguity problems everywhere...)

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
@bors
Copy link
Contributor

bors bot commented Sep 3, 2019

Build succeeded

@bors bors bot merged commit b8c1e40 into rust-lang:master Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants