-
Notifications
You must be signed in to change notification settings - Fork 161
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
Contract breaking impl From<SizeRange> for Range<usize> #80
Comments
I doubt anyone is actually using this or will do so in the near future since proptest doesn't ever return this type on its own, so it would require someone else to decide to use |
Yeah; I agree with everything you said and this :) I would suggest that we start with a more elaborate labeling system in this repo with milestones and more labels, which will be more important as proptest grows in importance in the ecosystem (which I'm hoping it will, because I think it is the state of the art wrt. Rust and testing). Something like:
and so on... Here's some inspiration: |
I just hit a related case, /// Given `low .. high`, then a size range `[low, high)` is the result.
impl From<Range<usize>> for SizeRange {
fn from(r: Range<usize>) -> Self { size_range(r.start..=r.end - 1) }
} (note that the |
Seems I implemented that incorrectly; should be: /// Given `low .. high`, then a size range `[low, high)` is the result.
impl From<Range<usize>> for SizeRange {
fn from(r: Range<usize>) -> Self {
let end = if r.end == 0 { 0 } else { r.end - 1 };
size_range(r.start..=end)
}
} This can only occur if you provide EDIT: actually... probably not; this would change the semantics given EDIT: To actually represent the concept of an empty range in EDIT: but if you do that... you can't convert |
Or you can use |
@Eh2406 if you do |
Fixed in 0.8.6, along with some other issues with The original issue this report is about no longer happens as of 0.8.6 since |
(I'm going to keep this open for the moment since there are some other unaddressed talking points still.) |
Removed the |
A while back I added the implementation:
however, the trait
From
states that:Therefore, the implementation above is contract breaking since it may panic in fringe circumstances.
As such, the implementation should be removed. This amounts to a breaking change (so we should probably label the issue as such...)
The text was updated successfully, but these errors were encountered: