Skip to content

Conversation

@pnkfelix
Copy link

This is another detail that I had wanted spelled out explicit in the RFC; see rust-lang#1733 (comment)

(I am assuming that we want it to be legal to put in redundant constraints; that's the case I wrote that we might issue a lint warning for in the text I'm adding here. But maybe this is actually an unresolved question?)

trait IntIterator = Iterator<Item=i32>;

fn quux1<T: SharableIterator<Item=f64>>(...) { ... } // ok
fn quux2<T: IntIterator<Item=i32>>(...) { ... } // ok (perhaps subject to lint warning)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this shoudn’t be authorized?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy either way.

Originally I was going to list it as disallowed, as you suggest.

But then I worried that might not be consistent with other design choices. E.g. one can add where clauses that are already implied by pre-existing constraints, right? So should it be an error to add a redundant equivalence constraint?

Maybe best (or at least easiest in terms of getting the RFC merged) to take out the fn quux2 example, and then make a new Unresolved Question for this case?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I think you’re right about the consistency. Others construct follow such a pattern. I’ll merge it then.

@hadronized hadronized merged commit 2a1a5b2 into hadronized:trait-alias Apr 16, 2017
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