-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Unfortunate type bound on Range #10414
Comments
On Mon, Nov 11, 2013 at 02:02:45AM -0800, Corey Richardson wrote:
The only way I can think to do this would be to add "negative" bounds,
(Or whatever trait this is) I've always been kind of against this |
There are other circumstances in which negative bounds would be nice. In this particular case, it's a shame that you'd need to have identical implementations of
then you could say
and selectively re-implement only the methods that you care to do; anything not implemented would use the "parent"'s implementation. Naturally, this falls down if you then say
and some type implements both For example:
Or maybe something like this:
|
You can avoid most of the duplication by just having |
Do we really need |
I believe the plan is to support range on anything that implements some kind of enumerable trait. Although rust-lang/rfcs/pull/439 introduces some generalizations to slicing that we might want to favour instead. |
Ranges have changed a bunch, and I can't seem to find an implementation of Is this issue still relevant? |
The (old) iter::Range is on its way out, so I think this is fine to kill. |
add large future lint Closes rust-lang#5263 --- changelog: new lint: [`large_futures`] [rust-lang#10414](rust-lang/rust-clippy#10414) <!-- changelog_checked -->
Range has a type bound on ToPrimitive so that it can have a size_hint. It does not need this to function, and the size_hint is just an optional nicety.
It'd be nice if there were some way to express this with the type system; this "optional" type bound makes the interface less generic (though it's not that big of a deal).
The text was updated successfully, but these errors were encountered: