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

Prefer ObjectCandidate to ImplCandidate if both apply #24056

Merged
merged 1 commit into from
Apr 6, 2015

Conversation

nikomatsakis
Copy link
Contributor

If we find a blanket impl for Trait but we're matching on an object Trait, prefer the object (I think we could perhaps go either way, but this seems safer). Also give a nice error for attempts to manually impl Trait for Trait, since they will be ineffectual.

This fixes the problems around ambiguity ICEs relating to Any and MarkerTrait that were cropping up all over the place. There may still be similar ICEs reported in #21756 that this PR does not address.

Fixes #24015.

Fixes #24051.
Fixes #24037.
Fixes #23853.
Fixes #21942.
cc #21756.

cc @alexcrichton (this fixes crates.io)
r? @aturon

@alexcrichton
Copy link
Member

So many fixed issues! Thanks @nikomatsakis!

(there's a tidy error)

@aturon
Copy link
Member

aturon commented Apr 5, 2015

r=me, p=1 after tidy fix

`Trait`, prefer the object. Also give a nice error for attempts to
manually `impl Trait for Trait`, since they will be ineffectual.

Fixes rust-lang#24015.

Fixes rust-lang#24051.
Fixes rust-lang#24037.
Fixes rust-lang#23853.
Fixes rust-lang#21942.
cc rust-lang#21756.
@nikomatsakis
Copy link
Contributor Author

@bors r=aturon p=1 0d56699

@bors
Copy link
Contributor

bors commented Apr 6, 2015

📌 Commit 0d56699 has been approved by aturon

@bors
Copy link
Contributor

bors commented Apr 6, 2015

⌛ Testing commit 0d56699 with merge 3c07835...

bors added a commit that referenced this pull request Apr 6, 2015
If we find a blanket impl for `Trait` but we're matching on an object `Trait`, prefer the object (I think we could perhaps go either way, but this seems safer). Also give a nice error for attempts to manually `impl Trait for Trait`, since they will be ineffectual.

This fixes the problems around ambiguity ICEs relating to `Any` and `MarkerTrait` that were cropping up all over the place. There may still be similar ICEs reported in #21756 that this PR does not address.

Fixes #24015.

Fixes #24051.
Fixes #24037.
Fixes #23853.
Fixes #21942.
cc #21756.

cc @alexcrichton (this fixes crates.io)
r? @aturon
@bors bors merged commit 0d56699 into rust-lang:master Apr 6, 2015
@nikomatsakis nikomatsakis deleted the issue-23853-crates-io branch March 30, 2016 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment