Commit Graph

3831 Commits

Author SHA1 Message Date
Alex Crichton
67d13883f8 rollup merge of #20061: aturon/stab-2-vec-slice
Conflicts:
	src/libcollections/slice.rs
	src/libcollections/vec.rs
	src/libstd/sys/windows/os.rs
2014-12-30 18:51:51 -08:00
Aaron Turon
6abfac083f Fallout from stabilization 2014-12-30 17:06:08 -08:00
Alex Crichton
dd0f29ad0f rollup merge of #20353: alexcrichton/snapshots 2014-12-30 16:26:24 -08:00
Alex Crichton
38f9805f11 rollup merge of #20348: frewsxcv/rm-reexports
Part of #19253

[breaking-change]
2014-12-30 16:26:22 -08:00
Alex Crichton
a8820f7a2d rollup merge of #20328: huonw/attack-of-the-clones
It's useful to be able to save state.
2014-12-30 16:26:15 -08:00
Alex Crichton
262c1efe63 Register new snapshots 2014-12-30 15:04:43 -08:00
Aaron Turon
b94bcbf56e Stabilize cmp
This patch marks `PartialEq`, `Eq`, `PartialOrd`, and `Ord` as
`#[stable]`, as well as the majorify of manual implementaitons of these
traits. The traits match the [reform
RFC](https://github.com/rust-lang/rfcs/pull/439).

Along the way, two changes are made:

* The recently-added type parameters for `Ord` and `Eq` are
  removed. These were mistakenly added while adding them to `PartialOrd`
  and `PartialEq`, but they don't make sense given the laws that are
  required for (and use cases for) `Ord` and `Eq`.

* More explicit laws are added for `PartialEq` and `PartialOrd`,
  connecting them to their associated mathematical concepts.

In the future, many of the impls should be generalized; see
since generalizing later is not a breaking change.

[breaking-change]
2014-12-30 14:44:26 -08:00
Aaron Turon
6e1879eaf1 Adjustments from review 2014-12-30 12:02:22 -08:00
Aaron Turon
4f863a338e Second pass stabilization: slice
This commit takes a second pass through the `slice` module to
stabilize its API. The changes are as follows:

**Stable**:

* `as_mut_slice`
* `as_ptr`, `as_mut_ptr`
* `binary_search_by` (was: `binary_search`)
* `binary_search` (was: `binary_search_elem`)
* `chunks`, `chunks_mut`
* `contains`
* `ends_with`
* `first`, `first_mut` (was: `head`)
* `get_unchecked`, `get_unchecked_mut` (was: `unsafe_get`)
* `get`
* `is_empty`
* `iter`, `iter_mut`
* `len`
* `reverse`
* `sort_by`
* `sort`
* `split_at`, `split_at_mut`
* `split_mut`, `splitn_mut`, `rsplitn_mut`
* `split`, `splitn`, `rsplitn`
* `starts_with`
* `swap`
* `to_vec`
* `windows`

**Deprecated**:

* `head`, `head_mut` (renamed as above)
* `unsafe_get`, `unsafe_mut` (renamed as above)
* `binary_search_elem` (renamed as above)
* `partitioned`, deprecated in favor of a new, more
  general iterator consumer called `partition`.
* `BinarySearchResult`, deprecated in favor of `Result<uint, uint>`

[breaking-change]
2014-12-30 12:02:22 -08:00
Aaron Turon
8a5057af2e std::iter: Add partition and unzip methods to iterators 2014-12-30 12:02:21 -08:00
Corey Farwell
1d26fb9e07 Remove core::atomic::Ordering::* public reexport
Part of #19253

[breaking-change]
2014-12-30 11:43:51 -08:00
Huon Wilson
b7832ed0b4 Implement Clone for a large number of iterators & other adaptors.
It's useful to be able to save state.
2014-12-30 21:01:36 +11:00
Alex Crichton
731fcfc289 rollup merge of #20309: sfackler/refcell-send
Also get rid of NoSync markers since UnsafeCell is now not Sync

r? @alexcrichton
2014-12-29 16:36:54 -08:00
Alex Crichton
21f661a6ef rollup merge of #20239: YawarRaza7349/patch-1 2014-12-29 16:36:14 -08:00
Alex Crichton
06256582e9 rollup merge of #20195: nagisa/unused-typo 2014-12-29 16:36:00 -08:00
Alex Crichton
28f424fd1b rollup merge of #20191: lifthrasiir/double-debug_assert
Yes, really. That definition wouldn't work anyway.

This also fixes repeated entries for `debug_assert!` from libcore docs. Maybe we should warn such macro definitions in the first place?
2014-12-29 16:35:57 -08:00
Alex Crichton
dbc8440821 rollup merge of #20160: nick29581/ranges2
The first six commits are from an earlier PR (#19858) and have already been reviewed. This PR makes an awful hack in the compiler to accommodate slices both natively and in the index a range form. After a snapshot we can hopefully add the new Index impls and then we can remove these awful hacks.

r? @nikomatsakis (or anyone who knows the compiler, really)
2014-12-29 16:35:53 -08:00
Nick Cameron
3bf405682d Fallout from mut slices 2014-12-30 13:06:25 +13:00
Nick Cameron
4e2afb0052 Remove ExprSlice by hacking the compiler
[breaking-change]

The `mut` in slices is now redundant. Mutability is 'inferred' from position. This means that if mutability is only obvious from the type, you will need to use explicit calls to the slicing methods.
2014-12-30 13:06:25 +13:00
Nick Cameron
ed8f503911 Add hypothetical support for ranges with only an upper bound
Note that this doesn't add the surface syntax.
2014-12-30 13:06:24 +13:00
Alex Crichton
54452cdd68 std: Second pass stabilization for ptr
This commit performs a second pass for stabilization over the `std::ptr` module.
The specific actions taken were:

* The `RawPtr` trait was renamed to `PtrExt`
* The `RawMutPtr` trait was renamed to `MutPtrExt`
* The module name `ptr` is now stable.
* These functions were all marked `#[stable]` with no modification:
  * `null`
  * `null_mut`
  * `swap`
  * `replace`
  * `read`
  * `write`
  * `PtrExt::is_null`
  * `PtrExt::offset`
* These functions remain unstable:
  * `as_ref`, `as_mut` - the return value of an `Option` is not fully expressive
                         as null isn't the only bad value, and it's unclear
                         whether we want to commit to these functions at this
                         time. The reference/lifetime semantics as written are
                         also problematic in how they encourage arbitrary
                         lifetimes.
  * `zero_memory` - This function is currently not used at all in the
                    distribution, and in general it plays a broader role in the
                    "working with unsafe pointers" story. This story is not yet
                    fully developed, so at this time the function remains
                    unstable for now.
  * `read_and_zero` - This function remains unstable for largely the same
                      reasons as `zero_memory`.
* These functions are now all deprecated:
  * `PtrExt::null` - call `ptr::null` or `ptr::null_mut` instead.
  * `PtrExt::to_uint` - use an `as` expression instead.
  * `PtrExt::is_not_null` - use `!p.is_null()` instead.
2014-12-29 15:57:28 -08:00
Steven Fackler
88d4e02d5b Implement Send for Cell and RefCell
Also get rid of NoSync markers since UnsafeCell is now not Sync
2014-12-29 12:20:34 -08:00
bors
19f73b4ef6 auto merge of #20058 : Kimundi/rust/str_pattern_pre, r=alexcrichton
This stabilizes most methods on `&str` working with patterns in a way that is forwards-compatible with a generic string pattern matching API:
- Methods that are using the primary name for their operation are marked as `#[stable]`, as they can be upgraded to a full `Pattern` API later without existing code breaking. Example: `contains(&str)`
- Methods that are using a more specific name in order to not clash with the primary one are marked as `#[unstable]`, as they will likely be removed once their functionality is merged into the primary one. Example: `contains_char<C: CharEq>(C)`
- The method docs got changed to consistently refer to the pattern types as a pattern.
- Methods whose names do not match in the context of the more generic API got renamed. Example: `trim_chars -> trim_matches` 

Additionally, all methods returning iterators got changed to return unique new types with changed names in accordance with the new naming guidelines.

See also https://github.com/rust-lang/rfcs/pull/528

Due to some deprecations and type changes, this is a 

[breaking-change]
2014-12-29 18:02:30 +00:00
Luqman Aden
0e039ada55 libcoretest: Add tests for NonZero. 2014-12-28 19:40:48 -05:00
Luqman Aden
94f1261573 libcore: Use Zeroable trait to try to limit what types may be used with NonZero. 2014-12-28 19:40:48 -05:00
Luqman Aden
c15df8e68f libcore: Don't impl RawPtr* traits for NonZero. 2014-12-28 19:40:48 -05:00
Luqman Aden
b44d7cb89c Don't expose NonZero through libstd. 2014-12-28 19:40:48 -05:00
Luqman Aden
466135bfef libcore: Make it unsafe to create NonZero and impl Deref. 2014-12-28 19:40:48 -05:00
Luqman Aden
ef5da14edb libcore: Add NonZero lang item and implement some methods. 2014-12-28 19:40:47 -05:00
Eduard Burtescu
647e54d6d1 Fallout of changing format_args!(f, args) to f(format_args!(args)). 2014-12-27 23:57:43 +02:00
Flavio Percoco
7df17a2868 Rename UniquePtr to Unique
Mostly following the convention in RFC 356
2014-12-26 17:26:33 +01:00
Flavio Percoco
e2116c8fba Move RacyCell to std::comm
RacyCell is not exactly what we'd like as a final implementation for
this. Therefore, we're moving it under `std::comm` and also making it
private.
2014-12-26 17:26:33 +01:00
Flavio Percoco
f436f9ca29 Make Send and Sync traits unsafe 2014-12-26 17:26:33 +01:00
Flavio Percoco
686ce664da Rename OwnedPtr to UniquePtr 2014-12-26 17:26:33 +01:00
Flavio Percoco
fb803a8570 Require types to opt-in Sync 2014-12-26 17:26:32 +01:00
YawarRaza7349
2fefb22dca Fixed minor typo in docs for Result's err method 2014-12-26 00:31:48 -05:00
Marvin Löbel
72c8f3772b Prepared most StrExt pattern using methods for stabilization
Made iterator-returning methods return newtypes
Adjusted some docs to be forwards compatible with a generic pattern API
2014-12-25 17:08:29 +01:00
Simonas Kazlauskas
ffd0f5a111 Fix a typo 2014-12-24 12:40:42 +02:00
Kang Seonghoon
556e3da55f core: Removed a shadowed, unused definition of debug_assert!. 2014-12-24 17:45:49 +09:00
bors
e64a8193b0 auto merge of #19858 : nick29581/rust/ranges, r=aturon
Closes #19794

r? @aturon for the first patch
r? @nikomatsakis for the rest
2014-12-24 06:31:13 +00:00
Nick Cameron
e82215d4e2 Review changes 2014-12-24 09:24:59 +13:00
Nick Cameron
53c5fcb99f Add lang items for ranges. 2014-12-24 09:12:45 +13:00
Nick Cameron
21ea66f47a Add structs for ranges to core::ops. 2014-12-24 09:12:45 +13:00
Tobias Bucher
16f01cc13f Rename and namespace FPCategory
Rename `FPCategory` to `FpCategory` and `Fp* to `*` in order to adhere to the
naming convention

This is a [breaking-change].

Existing code like this:
```
use std::num::{FPCategory, FPNaN};
```
should be adjusted to this:
```
use std::num::FpCategory as Fp
```

In the following code you can use the constants `Fp::Nan`, `Fp::Normal`, etc.
2014-12-23 13:42:09 +01:00
Alex Crichton
3583d613b9 Test fixes and rebase conflicts 2014-12-22 15:17:26 -08:00
Alex Crichton
de11710d80 rollup merge of #19891: nikomatsakis/unique-fn-types-3
Conflicts:
	src/libcore/str.rs
	src/librustc_trans/trans/closure.rs
	src/librustc_typeck/collect.rs
	src/libstd/path/posix.rs
	src/libstd/path/windows.rs
2014-12-22 12:51:23 -08:00
Alex Crichton
459f3b2cfa rollup merge of #20056: MrFloya/iter_rename
Conflicts:
	src/libcollections/bit.rs
	src/libcore/str.rs
2014-12-22 12:49:57 -08:00
Alex Crichton
fac17defcb rollup merge of #20140: frewsxcv/rm-reexports
Part of #19253

I would have removed this public reexport in #19842, but #19812 hadn't merged (and snapshotted) at the time

In #19407, I changed the codebase to stop utilizing this reexport

[breaking-change]
2014-12-22 12:48:16 -08:00
Corey Farwell
02feaf2a80 Remove cmp::Ordering::* public reexport
Part of #19253

I would have removed this public reexport in #19842, but #19812 hadn't merged (and snapshotted) at the time

In #19407, I changed the codebase to stop utilizing this reexport

[breaking-change]
2014-12-22 11:28:23 -08:00
Niko Matsakis
2c76ced954 Correct merge failure around imports in str.rs. 2014-12-22 12:27:08 -05:00