-
Notifications
You must be signed in to change notification settings - Fork 496
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
Potential len
method ambiguity in src/range.rs
#1159
Comments
I would say it is the other way around: We do not assume that they do implement I am not sure what you mean by "break" if such an implementation was added to the standard library? From my understanding, Rayon would just not automatically take advantage of it, but everything should continue to work as it does now, shouldn't it? In any case, we should not move here before the std does, i.e. there is not just a decision, but the feature is published and available in Rayon's MSRV. |
One can check this failed action once we add the implementation it will gives a compile error. |
Understood, so we could rename |
Ambiguous method resolution is a risk for any standard library addition. I don't think it's fair to call that "unrobust" here, because the only perfect way to defend against it is to use fully-qualified syntax for all trait method calls. This risk is acknowledged as a "minor change" in the API evolution RFC, and the Rust Project uses its crater tool to judge the practical impact -- though it's more obvious when it breaks a library used by the toolchain itself, as you found.
AIUI, the compiler has no ability to consider editions during trait/method resolution. I don't know if that's a fundamental limitation, or just something that hasn't been implemented or would be very difficult. So in the current situation, the library team will weigh the benefit of such additions against the crater impact and decide all or nothing. I'm not totally opposed to renaming internal implementation details like |
src/range.rs
len
method ambiguity in src/range.rs
I see. So this proposal is under discussion in rust-lang/libs-team#369 because I'm afraid of there are more example that "implicitly" "assume some trait are not implemented". |
As we can see, in the following code we assume
Range<u64>
andRange<i64>
does not implementExactSizeIterator
.rayon/src/range.rs
Lines 292 to 296 in 8ccfda3
But in 64-bit platforms, they should implement and there are proposes in rust-lang/rust#124056 and rust-lang/libs-team#369.
However, it encounters barrier because this hardcoded logic. So we hope it can be improved.
The text was updated successfully, but these errors were encountered: