Skip to content
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

Cleanup and stability for core::slice #16332

Merged
merged 12 commits into from
Aug 14, 2014
Merged

Cleanup and stability for core::slice #16332

merged 12 commits into from
Aug 14, 2014

Conversation

brson
Copy link
Contributor

@brson brson commented Aug 7, 2014

This implements some of the recommendations from https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-06.md.

Explanation in commits.

@brson
Copy link
Contributor Author

brson commented Aug 7, 2014

The most substantial change is to make the return type of binary_search a BinarySearchResult that is either Found or NotFound.

cc @nikomatsakis

@@ -47,20 +48,25 @@ use ptr::RawPtr;
use mem;
use mem::size_of;
use kinds::marker;
use raw::{Repr, Slice};
use raw::{Repr};
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditch the {}

@aturon
Copy link
Member

aturon commented Aug 12, 2014

@kballard Note that @brson has updated this PR. Look good to you?

@lilyball
Copy link
Contributor

@aturon There's a few notes of mine that are still outstanding, but they're not serious issues.

@aturon
Copy link
Member

aturon commented Aug 12, 2014

Thanks, then I'm going to go ahead and get this headed to bors.

@aturon
Copy link
Member

aturon commented Aug 12, 2014

@brson needs a rebase, then this is ready to go.

@brson
Copy link
Contributor Author

brson commented Aug 12, 2014

Rebased.

brson added 12 commits August 13, 2014 11:30
ImmutableVector -> ImmutableSlice
ImmutableEqVector -> ImmutableEqSlice
ImmutableOrdVector -> ImmutableOrdSlice
MutableVector -> MutableSlice
MutableVectorAllocating -> MutableSliceAllocating
MutableCloneableVector -> MutableCloneableSlice
MutableOrdVector -> MutableOrdSlice

These are all in the prelude so most code will not break.

[breaking-change]
This required some contortions because importing both raw::Slice
and slice::Slice makes rustc crash.

Since `Slice` is in the prelude, this renaming is unlikely to
casue breakage.

[breaking-change]
These are equivalent to slice_from and slice_to.
This is in the prelude and won't break much code.

[breaking-change]
These are like the existing bsearch methods but if the search fails,
it returns the next insertion point.

The new `binary_search` returns a `BinarySearchResult` that is either
`Found` or `NotFound`. For convenience, the `found` and `not_found`
methods convert to `Option`, ala `Result`.

Deprecate bsearch and bsearch_elem.
This makes it consistent with the same functions for slices,
and allows the search closure to be specified last.

[breaking-change]
bors added a commit that referenced this pull request Aug 14, 2014
@bors bors closed this Aug 14, 2014
@bors bors merged commit fce442e into rust-lang:master Aug 14, 2014
aturon added a commit to aturon/rust that referenced this pull request Sep 24, 2014
This commit is another in the series of vector slice API
stabilization. The focus here is the *mutable* slice API.

Largely, this API inherits the stability attributes [previously
assigned](rust-lang#16332) to the analogous
methods on immutable slides. It also adds comments to a few `unstable`
attributes that were previously missing them.

In addition, the commit adds several `_mut` variants of APIs that were
missing:

- `init_mut`
- `head_mut`
- `tail_mut`
- `splitn_mut`
- `rsplitn_mut`

Some of the unsafe APIs -- `unsafe_set`, `init_elem`, and `copy_memory`
-- were deprecated in favor of working through `as_mut_ptr`, to simplify
the API surface.

Due to deprecations, this is a:

[breaking-change]
bors added a commit that referenced this pull request Sep 25, 2014
…ichton

This commit is another in the series of vector slice API stabilization. The focus here is the *mutable* slice API.

Largely, this API inherits the stability attributes [previously assigned](#16332) to the analogous methods on immutable slides. It also adds comments to a few `unstable` attributes that were previously missing them.

In addition, the commit adds several `_mut` variants of APIs that were missing:

- `init_mut`
- `head_mut`
- `tail_mut`
- `splitn_mut`
- `rsplitn_mut`

Some of the unsafe APIs -- `unsafe_set`, `init_elem`, and `copy_memory` -- were deprecated in favor of working through `as_mut_ptr`, to simplify the API surface.

Due to deprecations, this is a:

[breaking-change]
aturon added a commit to aturon/rust that referenced this pull request Sep 26, 2014
This commit is another in the series of vector slice API
stabilization. The focus here is the *mutable* slice API.

Largely, this API inherits the stability attributes [previously
assigned](rust-lang#16332) to the analogous
methods on immutable slides. It also adds comments to a few `unstable`
attributes that were previously missing them.

In addition, the commit adds several `_mut` variants of APIs that were
missing:

- `init_mut`
- `head_mut`
- `tail_mut`
- `splitn_mut`
- `rsplitn_mut`

Some of the unsafe APIs -- `unsafe_set`, `init_elem`, and `copy_memory`
-- were deprecated in favor of working through `as_mut_ptr`, to simplify
the API surface.

Due to deprecations, this is a:

[breaking-change]
bors added a commit that referenced this pull request Sep 26, 2014
…ichton

This commit is another in the series of vector slice API stabilization. The focus here is the *mutable* slice API.

Largely, this API inherits the stability attributes [previously assigned](#16332) to the analogous methods on immutable slides. It also adds comments to a few `unstable` attributes that were previously missing them.

In addition, the commit adds several `_mut` variants of APIs that were missing:

- `init_mut`
- `head_mut`
- `tail_mut`
- `splitn_mut`
- `rsplitn_mut`

Some of the unsafe APIs -- `unsafe_set`, `init_elem`, and `copy_memory` -- were deprecated in favor of working through `as_mut_ptr`, to simplify the API surface.

Due to deprecations, this is a:

[breaking-change]
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.

4 participants