Skip to content

Change TraitRef subtyping checks to equality #29960

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

Merged
merged 1 commit into from
Nov 24, 2015

Conversation

aturon
Copy link
Member

@aturon aturon commented Nov 20, 2015

Trait references are always invariant, so all uses of subtyping between
them are equivalent to using equality.

Moreover, the overlap check was previously performed twice per impl
pair, once in each direction. It is now performed only once, and
internally uses the equality check.

On glium, a crate that spends some time in coherence, this change sped
up coherence checking by a few percent (not very significant).

r? @nikomatsakis

Trait references are always invariant, so all uses of subtyping between
them are equivalent to using equality.

Moreover, the overlap check was previously performed twice per impl
pair, once in each direction. It is now performed only once, and
internally uses the equality check.

On glium, a crate that spends some time in coherence, this change sped
up coherence checking by a few percent (not very significant).
@arielb1
Copy link
Contributor

arielb1 commented Nov 21, 2015

Performance numbers please.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 24, 2015

📌 Commit 612d001 has been approved by nikomatsakis

@nikomatsakis
Copy link
Contributor

@arielb1

Performance numbers please.

While measurements are always nice, I don't see any reason to gate on them (and I know @aturon has a lot on his plate right now). There is nor reason to think that this change will make the compiler slower. (Keep in mind that trait references are always invariant, so doing sub on them translated immediately to equality anyway.)

@bors
Copy link
Collaborator

bors commented Nov 24, 2015

⌛ Testing commit 612d001 with merge 2a0ce4a...

bors added a commit that referenced this pull request Nov 24, 2015
…sakis

Trait references are always invariant, so all uses of subtyping between
them are equivalent to using equality.

Moreover, the overlap check was previously performed twice per impl
pair, once in each direction. It is now performed only once, and
internally uses the equality check.

On glium, a crate that spends some time in coherence, this change sped
up coherence checking by a few percent (not very significant).

r? @nikomatsakis
@bors bors merged commit 612d001 into rust-lang:master Nov 24, 2015
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.

4 participants