Uh oh!
There was an error while loading. Please reload this page.
Fix slice binary search signature mismatch - #41590
Conversation
The signature for `std::slice::binary_search` is now parameterized over `Borrow`, as in `core::SliceExt`
rust-highfive
commented
Apr 27, 2017
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
shepmaster
commented
Apr 28, 2017
Thanks for the PR! We'll make sure that @aturon or another reviewer takes a look soon. |
mzji
commented
Apr 28, 2017
The error message "the trait bound pubfnbinary_search_by_key<'a,B,F,Q>(&'aself,b:&Q,f:F) -> Result<usize,usize>whereF:FnMut(&'aT) -> B,B:Borrow<Q>,Q:Ord + ?Sizedto pubfnbinary_search_by_key<'a,B,F,Q>(&'aself,b:&Q,f:F) -> Result<usize,usize>whereF:FnMut(&'aT) -> &'aB,// Note the type of the return valueB:Borrow<Q>,Q:Ord + ?Sized, and change the line 27 of test let r = xs.binary_search_by_key(&key, |e| &e.topic);to let r = xs.binary_search_by_key(key, |e| &e.topic);. However, this is a breaking-change. |
aturon
commented
Apr 29, 2017
It might be possible to add a cc @rust-lang/libs, does anyone recall how we even got to a place where |
alexcrichton
commented
Apr 29, 2017
Added in #37761 the orginal intention was to generalize a bunch, we then backed it out because of breakage. I suspect it was just forgotten to back out the libcore changes, and the reviewer (me) wasn't paying enough attention to backing out the changes. I would personally desire a crater run for this PR before we land it, as the last one turned up lots of breakage so we may not be able to land. |
aturon
commented
May 1, 2017
@alexcrichton Hm, that's not quite my read of #37761. It looks to me like the PR originally included similar generalizations to other functions, but never included a change to In any case, seems like a crater run is in order. |
circuitfox
commented
May 2, 2017
alexcrichton
commented
May 2, 2017
@aturon the original commit (I think?) did indeed only change libcore wrt binary_search, I must be misremembering.
Agreed. |
Ok, seems that we should add a type annotation for the |
circuitfox
commented
May 4, 2017
So the tests now fail with |
@circuitfox Changing all 4 appearance of |
circuitfox
commented
May 4, 2017
@mzji You're right. Changing |
mzji
commented
May 4, 2017
@circuitfox And that's shorter. 😄 |
Mark-Simulacrum
commented
May 14, 2017
@brson@eddyb@alexcrichton Could someone do a crater run? |
carols10cents
commented
May 22, 2017
ping @brson@eddyb@alexcrichton reminder that this is waiting on a crater run! |
brson
commented
May 24, 2017
I've started building toolchains for crater |
brson
commented
May 25, 2017
I've started the crate build for crater. |
brson
commented
May 25, 2017
Mark-Simulacrum
commented
May 25, 2017
Actual root regressions below.
|
carols10cents
commented
May 29, 2017
So what are the next steps here @aturon@alexcrichton ? |
alexcrichton
commented
May 30, 2017
The next step is for the @rust-lang/libs team to decide whether this is acceptable breakage and whether or not to merge this PR. The |
alexcrichton
commented
Jun 7, 2017
The libs team discussed this PR during triage and the conclusion was to close, and I've posted more comments on the tracking issue |
Remove Borrow bound from SliceExt::binary_search #37761 added a Borrow bound to `binary_search` and `binary_search_by_key` in `core::SliceExt`, but did not add it to the methods in `std::slice`. #41590 attempted to add this bound to `std::slice` but was not merged due to breakage. This PR removes the bound in `core::SliceExt`, so that these methods will have the same signature in `core` and `std`. Fixes#41561
…ig, r=alexcrichton Remove Borrow bound from SliceExt::binary_search rust-lang#37761 added a Borrow bound to `binary_search` and `binary_search_by_key` in `core::SliceExt`, but did not add it to the methods in `std::slice`. rust-lang#41590 attempted to add this bound to `std::slice` but was not merged due to breakage. This PR removes the bound in `core::SliceExt`, so that these methods will have the same signature in `core` and `std`. Fixesrust-lang#41561
…richton Remove Borrow bound from SliceExt::binary_search #37761 added a Borrow bound to `binary_search` and `binary_search_by_key` in `core::SliceExt`, but did not add it to the methods in `std::slice`. #41590 attempted to add this bound to `std::slice` but was not merged due to breakage. This PR removes the bound in `core::SliceExt`, so that these methods will have the same signature in `core` and `std`. Fixes#41561
#37761 paramaterized
binary_searchoverBorrowincore::SliceExt. This PR does the same forstd::slice, so that the std and core slice APIs match.Fixes#41561