Implementation of RFC 2289 (associated_type_bounds)#57428
Implementation of RFC 2289 (associated_type_bounds)#57428bors merged 24 commits intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
r? @nikomatsakis for re-assignment. |
|
A few things:
|
This comment has been minimized.
This comment has been minimized.
|
@oli-obk Oh absolutely – I'll clean up the commits in due time. You mean a test for your own debugging purposes? I can add one, though I was planning on writing actual regression tests later.
Adding an inference variable sounds like a sensible idea. What do you mean by this however? |
|
I am not actually sure how to address the issue, so I'd suggest comparing what happens when you use explicit |
|
@oli-obk Yeah, I've tried that, but it's too difficult for me to spot. |
|
@oli-obk Here are the debug outputs produced by Here's the code. #![feature(existential_type)]
use std::fmt::{Debug, Display};
trait TraitB {
type AssocB;
}
trait TraitC {
}
// Failing case:
existential type Bar: Debug + TraitB<AssocB = impl Send>;
// Working case:
existential type Bar: Debug + TraitB<AssocB = _0>;
existential type _0: Send;
impl TraitB for i32 {
type AssocB = u32;
}
impl TraitC for i32 {
}
fn a() -> Bar {
42
}
fn main() {} |
|
The major difference seems to be this part. Tracking down why that additional code is run only in the successful case should shed some light on what we need to do in the failing case You will get a cleaner diff if you add |
|
@oli-obk I'm pretty sure that's not the issue. The extra code for the working case is just because type resolution has to go through the indirection of resolving the path before it gets to the opaque types. If you look at the code that follows, it's basically identical. Hmm. |
|
@alexreg I've pushed a commit that gets things building and adds some debug printouts. I compared the logs from the working/not-working example. The problem seems to be that, in the not working case, the "parent" of the This means that we only search the children of that existential type declaration to find the "defining uses" for the impl trait -- and naturally we don't find any, because the defining use is elsewhere in the module. In this case of an |
|
If you'd like to see what I'm talking about, try running your example with |
|
@nikomatsakis So, I thought a pretty similar thing at first, but it turns out the error is coming before I've fixed it so |
oli-obk
left a comment
There was a problem hiding this comment.
I find it very hard to review this PR with all the unrelated formatting changes intermingled with the actual changes. Could you use git add -p from now on to do separate commits for the different kinds of changes?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ikomatsakis,Centril Implementation of RFC 2289 (associated_type_bounds) This PR implements the [`asociated_type_bounds` feature](https://github.com/rust-lang/rfcs/blob/master/text/2289-associated-type-bounds.md). Associated type bounds are implemented in: - function/method arguments and return types - structs, enums, unions - associated items in traits - type aliases - type parameter defaults - trait objects - let bindings CC @nikomatsakis @Centril
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors r=nikomatsakis,Centril |
|
📌 Commit ee89033 has been approved by |
…,Centril Implementation of RFC 2289 (associated_type_bounds) This PR implements the [`asociated_type_bounds` feature](https://github.com/rust-lang/rfcs/blob/master/text/2289-associated-type-bounds.md). Associated type bounds are implemented in: - function/method arguments and return types - structs, enums, unions - associated items in traits - type aliases - type parameter defaults - trait objects - let bindings CC @nikomatsakis @Centril
|
☀️ Test successful - checks-travis, status-appveyor |
This PR implements the
asociated_type_boundsfeature.Associated type bounds are implemented in:
CC @nikomatsakis @Centril