summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-07-15Deprecate `str::from_utf8_lossy`Adolfo Ochagavía-15/+14
Use `String::from_utf8_lossy` instead [breaking-change]
2014-07-15Deprecate `str::from_utf16_lossy`Adolfo Ochagavía-1/+1
Use `String::from_utf16_lossy` instead. [breaking-change]
2014-07-15Deprecate `str::from_utf16`Adolfo Ochagavía-4/+4
Use `String::from_utf16` instead [breaking-change]
2014-07-15Deprecate `str::from_char`Adolfo Ochagavía-14/+10
Use `String::from_char` or `.to_str` instead [breaking-change]
2014-07-15Deprecate `str::from_utf8_owned`Adolfo Ochagavía-20/+15
Use `String::from_utf8` instead [breaking-change]
2014-07-14add Graphemes iterator; tidy unicode exportskwantam-6/+5
- Graphemes and GraphemeIndices structs implement iterators over grapheme clusters analogous to the Chars and CharOffsets for chars in a string. Iterator and DoubleEndedIterator are available for both. - tidied up the exports for libunicode. crate root exports are now moved into more appropriate module locations: - UnicodeStrSlice, Words, Graphemes, GraphemeIndices are in str module - UnicodeChar exported from char instead of crate root - canonical_combining_class is exported from str rather than crate root Since libunicode's exports have changed, programs that previously relied on the old export locations will need to change their `use` statements to reflect the new ones. See above for more information on where the new exports live. closes #7043 [breaking-change]
2014-07-14std: Make unlink() more consistentAlex Crichton-5/+43
Currently when a read-only file has unlink() invoked on it on windows, the call will fail. On unix, however, the call will succeed. In order to have a more consistent behavior across platforms, this error is recognized on windows and the file is changed to read-write before removal is attempted.
2014-07-14auto merge of #15653 : erickt/rust/master, r=alexcrichtonbors-2/+2
2014-07-14auto merge of #15649 : catharsis/rust/rust-libstd-examples, r=alexcrichtonbors-7/+45
This patch adds doc examples for the make_absolute, change_dir, errors_string and args functions in the os module.
2014-07-13std: make std::io::IoError{,Kind} implement EqErick Tryzelaar-2/+2
2014-07-13auto merge of #15591 : aturon/rust/box-cell-stability, r=alexcrichtonbors-23/+26
This PR is the outcome of the library stabilization meeting for the `liballoc::owned` and `libcore::cell` modules. Aside from the stability attributes, there are a few breaking changes: * The `owned` modules is now named `boxed`, to better represent its contents. (`box` was unavailable, since it's a keyword.) This will help avoid the misconception that `Box` plays a special role wrt ownership. * The `AnyOwnExt` extension trait is renamed to `BoxAny`, and its `move` method is renamed to `downcast`, in both cases to improve clarity. * The recently-added `AnySendOwnExt` extension trait is removed; it was not being used and is unnecessary. [breaking-change]
2014-07-13Stabilization for `owned` (now `boxed`) and `cell`Aaron Turon-23/+26
This PR is the outcome of the library stabilization meeting for the `liballoc::owned` and `libcore::cell` modules. Aside from the stability attributes, there are a few breaking changes: * The `owned` modules is now named `boxed`, to better represent its contents. (`box` was unavailable, since it's a keyword.) This will help avoid the misconception that `Box` plays a special role wrt ownership. * The `AnyOwnExt` extension trait is renamed to `BoxAny`, and its `move` method is renamed to `downcast`, in both cases to improve clarity. * The recently-added `AnySendOwnExt` extension trait is removed; it was not being used and is unnecessary. [breaking-change]
2014-07-13libstd: Add a few doc examplesAnton Lofgren-7/+45
This patch adds doc examples for the make_absolute, change_dir, errors_string and args functions in the os module.
2014-07-13auto merge of #15639 : supr/rust/master, r=sfacklerbors-1/+1
* Fixes a typo in the libstd documentation, referring UPD instead of UDP
2014-07-13auto merge of #15584 : alexcrichton/rust/warn-annoyances, r=cmrbors-1/+6
* Don't warn about `#[crate_name]` if `--crate-name` is specified * Don't warn about non camel case identifiers on `#[repr(C)]` structs * Switch `mode` to `mode_t` in libc.
2014-07-12Fix Documentation Typo in libstdPrudhvi Krishna Surapaneni-1/+1
2014-07-12auto merge of #15617 : aturon/rust/std-more-experimental, r=alexcrichtonbors-0/+2
The `hash` module was not included in an earlier pass that sets baseline stability of modules within `std` to `experimental`.
2014-07-12auto merge of #15610 : brson/rust/0.12.0, r=alexcrichtonbors-1/+1
2014-07-12auto merge of #15592 : arjantop/rust/bufwriter-write-fix, r=alexcrichtonbors-2/+4
First condition is not needed and just prevents 0 length writes Fixes #15583
2014-07-12auto merge of #15588 : alexcrichton/rust/issue-15478, r=cmrbors-6/+12
If modified, you can safely unmap arbitrary memory. These fields are not intended to be modified, so read-only accessors are the only ones that are provided. Closes #15478
2014-07-11libc: Switch open to use a mode_t on unixAlex Crichton-1/+6
While I'm at it, export O_SYNC with the other flags that are exported. Closes #15582
2014-07-11std: Move MemoryMap fields to methodsAlex Crichton-6/+12
If modified, you can safely unmap arbitrary memory. These fields are not intended to be modified, so read-only accessors are the only ones that are provided. Closes #15478
2014-07-11mark std::hash experimentalAaron Turon-0/+2
The `hash` module was not included in an earlier pass that sets baseline stability of modules within `std` to `experimental`.
2014-07-11Update doc URLs for version bumpBrian Anderson-1/+1
2014-07-11Allow writes of length 0 to a full bufferArjan Topolovec-2/+4
2014-07-11auto merge of #15574 : omasanori/rust/hidden, r=huonwbors-8/+0
2014-07-11auto merge of #15564 : alexcrichton/rust/moar-hash, r=huonwbors-2/+26
- semver::Version is now Eq, Ord, and Hash - Path is now PartialOrd and Ord
2014-07-10io::process::Command: add fine-grained env builderAaron Turon-20/+86
This commit changes the `io::process::Command` API to provide fine-grained control over the environment: * The `env` method now inserts/updates a key/value pair. * The `env_remove` method removes a key from the environment. * The old `env` method, which sets the entire environment in one shot, is renamed to `env_set_all`. It can be used in conjunction with the finer-grained methods. This renaming is a breaking change. To support these new methods, the internal `env` representation for `Command` has been changed to an optional `HashMap` holding owned `CString`s (to support non-utf8 data). The `HashMap` is only materialized if the environment is updated. The implementation does not try hard to avoid allocation, since the cost of launching a process will dwarf any allocation cost. This patch also adds `PartialOrd`, `Eq`, and `Hash` implementations for `CString`. [breaking-change]
2014-07-10std: Add some implementation of common traitsAlex Crichton-2/+26
- semver::Version is now Eq, Ord, and Hash - Path is now PartialOrd and Ord
2014-07-10Remove deprecated std::unstable module.OGINO Masanori-8/+0
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-10auto merge of #15566 : japaric/rust/command-clone, r=alexcrichtonbors-0/+2
Allows use cases like this one: ``` rust use std::io::Command; fn main() { let mut cmd = Command::new("ls"); cmd.arg("-l"); for &dir in ["a", "b", "c"].iter() { println!("{}", cmd.clone().arg(dir)); } } ``` Output: ``` ls '-l' 'a' ls '-l' 'b' ls '-l' 'c' ``` Without the `clone()`, you'll end up with: ``` ls '-l' 'a' ls '-l' 'a' 'b' ls '-l' 'a' 'b' 'c' ``` cc #15294
2014-07-10auto merge of #15556 : alexcrichton/rust/snapshots, r=brsonbors-3/+1
Closes #15544
2014-07-09Derive Clone for Command and StdioContainerJorge Aparicio-0/+2
2014-07-09auto merge of #15471 : erickt/rust/push_all, r=acrichtobors-5/+49
llvm is currently not able to conver `Vec::extend` into a memcpy for `Copy` types, which results in methods like `Vec::push_all` to run twice as slow as it should be running. This patch takes the unsafe `Vec::clone` optimization to speed up all the operations that are cloning a slice into a `Vec`. before: ``` test vec::tests::bench_clone_from_0000_0000 ... bench: 12 ns/iter (+/- 2) test vec::tests::bench_clone_from_0000_0010 ... bench: 125 ns/iter (+/- 4) = 80 MB/s test vec::tests::bench_clone_from_0000_0100 ... bench: 360 ns/iter (+/- 33) = 277 MB/s test vec::tests::bench_clone_from_0000_1000 ... bench: 2601 ns/iter (+/- 175) = 384 MB/s test vec::tests::bench_clone_from_0010_0000 ... bench: 12 ns/iter (+/- 2) test vec::tests::bench_clone_from_0010_0010 ... bench: 125 ns/iter (+/- 10) = 80 MB/s test vec::tests::bench_clone_from_0010_0100 ... bench: 361 ns/iter (+/- 28) = 277 MB/s test vec::tests::bench_clone_from_0100_0010 ... bench: 131 ns/iter (+/- 13) = 76 MB/s test vec::tests::bench_clone_from_0100_0100 ... bench: 360 ns/iter (+/- 9) = 277 MB/s test vec::tests::bench_clone_from_0100_1000 ... bench: 2575 ns/iter (+/- 168) = 388 MB/s test vec::tests::bench_clone_from_1000_0100 ... bench: 356 ns/iter (+/- 20) = 280 MB/s test vec::tests::bench_clone_from_1000_1000 ... bench: 2605 ns/iter (+/- 167) = 383 MB/s test vec::tests::bench_from_slice_0000 ... bench: 11 ns/iter (+/- 0) test vec::tests::bench_from_slice_0010 ... bench: 115 ns/iter (+/- 5) = 86 MB/s test vec::tests::bench_from_slice_0100 ... bench: 309 ns/iter (+/- 170) = 323 MB/s test vec::tests::bench_from_slice_1000 ... bench: 2065 ns/iter (+/- 198) = 484 MB/s test vec::tests::bench_push_all_0000_0000 ... bench: 7 ns/iter (+/- 0) test vec::tests::bench_push_all_0000_0010 ... bench: 79 ns/iter (+/- 7) = 126 MB/s test vec::tests::bench_push_all_0000_0100 ... bench: 342 ns/iter (+/- 18) = 292 MB/s test vec::tests::bench_push_all_0000_1000 ... bench: 2873 ns/iter (+/- 75) = 348 MB/s test vec::tests::bench_push_all_0010_0010 ... bench: 154 ns/iter (+/- 8) = 64 MB/s test vec::tests::bench_push_all_0100_0100 ... bench: 518 ns/iter (+/- 18) = 193 MB/s test vec::tests::bench_push_all_1000_1000 ... bench: 4490 ns/iter (+/- 223) = 222 MB/s ``` after: ``` test vec::tests::bench_clone_from_0000_0000 ... bench: 12 ns/iter (+/- 1) test vec::tests::bench_clone_from_0000_0010 ... bench: 123 ns/iter (+/- 5) = 81 MB/s test vec::tests::bench_clone_from_0000_0100 ... bench: 367 ns/iter (+/- 23) = 272 MB/s test vec::tests::bench_clone_from_0000_1000 ... bench: 2618 ns/iter (+/- 252) = 381 MB/s test vec::tests::bench_clone_from_0010_0000 ... bench: 12 ns/iter (+/- 1) test vec::tests::bench_clone_from_0010_0010 ... bench: 124 ns/iter (+/- 7) = 80 MB/s test vec::tests::bench_clone_from_0010_0100 ... bench: 369 ns/iter (+/- 34) = 271 MB/s test vec::tests::bench_clone_from_0100_0010 ... bench: 123 ns/iter (+/- 6) = 81 MB/s test vec::tests::bench_clone_from_0100_0100 ... bench: 371 ns/iter (+/- 25) = 269 MB/s test vec::tests::bench_clone_from_0100_1000 ... bench: 2713 ns/iter (+/- 532) = 368 MB/s test vec::tests::bench_clone_from_1000_0100 ... bench: 369 ns/iter (+/- 14) = 271 MB/s test vec::tests::bench_clone_from_1000_1000 ... bench: 2611 ns/iter (+/- 194) = 382 MB/s test vec::tests::bench_from_slice_0000 ... bench: 7 ns/iter (+/- 0) test vec::tests::bench_from_slice_0010 ... bench: 108 ns/iter (+/- 4) = 92 MB/s test vec::tests::bench_from_slice_0100 ... bench: 235 ns/iter (+/- 24) = 425 MB/s test vec::tests::bench_from_slice_1000 ... bench: 1318 ns/iter (+/- 96) = 758 MB/s test vec::tests::bench_push_all_0000_0000 ... bench: 7 ns/iter (+/- 0) test vec::tests::bench_push_all_0000_0010 ... bench: 70 ns/iter (+/- 4) = 142 MB/s test vec::tests::bench_push_all_0000_0100 ... bench: 176 ns/iter (+/- 16) = 568 MB/s test vec::tests::bench_push_all_0000_1000 ... bench: 1125 ns/iter (+/- 94) = 888 MB/s test vec::tests::bench_push_all_0010_0010 ... bench: 159 ns/iter (+/- 15) = 62 MB/s test vec::tests::bench_push_all_0100_0100 ... bench: 363 ns/iter (+/- 12) = 275 MB/s test vec::tests::bench_push_all_1000_1000 ... bench: 2860 ns/iter (+/- 415) = 349 MB/s ``` This also includes extra benchmarks for `Vec` and `MemWriter`.
2014-07-09auto merge of #15283 : kwantam/rust/master, r=alexcrichtonbors-4/+9
Add libunicode; move unicode functions from core - created new crate, libunicode, below libstd - split `Char` trait into `Char` (libcore) and `UnicodeChar` (libunicode) - Unicode-aware functions now live in libunicode - `is_alphabetic`, `is_XID_start`, `is_XID_continue`, `is_lowercase`, `is_uppercase`, `is_whitespace`, `is_alphanumeric`, `is_control`, `is_digit`, `to_uppercase`, `to_lowercase` - added `width` method in UnicodeChar trait - determines printed width of character in columns, or None if it is a non-NULL control character - takes a boolean argument indicating whether the present context is CJK or not (characters with 'A'mbiguous widths are double-wide in CJK contexts, single-wide otherwise) - split `StrSlice` into `StrSlice` (libcore) and `UnicodeStrSlice` (libunicode) - functionality formerly in `StrSlice` that relied upon Unicode functionality from `Char` is now in `UnicodeStrSlice` - `words`, `is_whitespace`, `is_alphanumeric`, `trim`, `trim_left`, `trim_right` - also moved `Words` type alias into libunicode because `words` method is in `UnicodeStrSlice` - unified Unicode tables from libcollections, libcore, and libregex into libunicode - updated `unicode.py` in `src/etc` to generate aforementioned tables - generated new tables based on latest Unicode data - added `UnicodeChar` and `UnicodeStrSlice` traits to prelude - libunicode is now the collection point for the `std::char` module, combining the libunicode functionality with the `Char` functionality from libcore - thus, moved doc comment for `char` from `core::char` to `unicode::char` - libcollections remains the collection point for `std::str` The Unicode-aware functions that previously lived in the `Char` and `StrSlice` traits are no longer available to programs that only use libcore. To regain use of these methods, include the libunicode crate and `use` the `UnicodeChar` and/or `UnicodeStrSlice` traits: extern crate unicode; use unicode::UnicodeChar; use unicode::UnicodeStrSlice; use unicode::Words; // if you want to use the words() method NOTE: this does *not* impact programs that use libstd, since UnicodeChar and UnicodeStrSlice have been added to the prelude. closes #15224 [breaking-change]
2014-07-09Register new snapshotsAlex Crichton-3/+1
Closes #15544
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-152/+149
[breaking-change]
2014-07-07Add libunicode; move unicode functions from corekwantam-4/+9
- created new crate, libunicode, below libstd - split Char trait into Char (libcore) and UnicodeChar (libunicode) - Unicode-aware functions now live in libunicode - is_alphabetic, is_XID_start, is_XID_continue, is_lowercase, is_uppercase, is_whitespace, is_alphanumeric, is_control, is_digit, to_uppercase, to_lowercase - added width method in UnicodeChar trait - determines printed width of character in columns, or None if it is a non-NULL control character - takes a boolean argument indicating whether the present context is CJK or not (characters with 'A'mbiguous widths are double-wide in CJK contexts, single-wide otherwise) - split StrSlice into StrSlice (libcore) and UnicodeStrSlice (libunicode) - functionality formerly in StrSlice that relied upon Unicode functionality from Char is now in UnicodeStrSlice - words, is_whitespace, is_alphanumeric, trim, trim_left, trim_right - also moved Words type alias into libunicode because words method is in UnicodeStrSlice - unified Unicode tables from libcollections, libcore, and libregex into libunicode - updated unicode.py in src/etc to generate aforementioned tables - generated new tables based on latest Unicode data - added UnicodeChar and UnicodeStrSlice traits to prelude - libunicode is now the collection point for the std::char module, combining the libunicode functionality with the Char functionality from libcore - thus, moved doc comment for char from core::char to unicode::char - libcollections remains the collection point for std::str The Unicode-aware functions that previously lived in the Char and StrSlice traits are no longer available to programs that only use libcore. To regain use of these methods, include the libunicode crate and use the UnicodeChar and/or UnicodeStrSlice traits: extern crate unicode; use unicode::UnicodeChar; use unicode::UnicodeStrSlice; use unicode::Words; // if you want to use the words() method NOTE: this does *not* impact programs that use libstd, since UnicodeChar and UnicodeStrSlice have been added to the prelude. closes #15224 [breaking-change]
2014-07-07librustc (RFC #34): Implement the new `Index` and `IndexMut` traits.Patrick Walton-1/+2
This will break code that used the old `Index` trait. Change this code to use the new `Index` traits. For reference, here are their signatures: pub trait Index<Index,Result> { fn index<'a>(&'a self, index: &Index) -> &'a Result; } pub trait IndexMut<Index,Result> { fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result; } Closes #6515. [breaking-change]
2014-07-05std: flesh out MemWriter benchmarksErick Tryzelaar-5/+49
2014-07-05Add #[crate_name] attributes as necessaryAlex Crichton-1/+3
2014-07-05auto merge of #15425 : jbclements/rust/hygiene-for-3-kinds-of-args, r=cmrbors-8/+9
This pull request adds hygiene for 3 kinds of argument bindings: - arguments to item fns, - arguments to `ExprFnBlock`s, and - arguments to `ExprProc`s It also adds a bunch of unit tests, fixes a few macro uses to be non-capturing, and has a few cleanup items. local `make check` succeeds.
2014-07-04make any_pat! and u64_from_be_bytes_bench_impl! macros hygienicJohn Clements-8/+9
2014-07-04auto merge of #15405 : pcwalton/rust/delifetime, r=nick29581bors-6/+3
This was parsed by the parser but completely ignored; not even stored in the AST! This breaks code that looks like: static X: &'static [u8] = &'static [1, 2, 3]; Change this code to the shorter: static X: &'static [u8] = &[1, 2, 3]; Closes #15312. [breaking-change] r? @nick29581
2014-07-04auto merge of #15404 : vhbit/rust/ios-ptr-fixes, r=pcwaltonbors-2/+2
2014-07-04librustc: Remove the `&LIFETIME EXPR` production from the language.Patrick Walton-6/+3
This was parsed by the parser but completely ignored; not even stored in the AST! This breaks code that looks like: static X: &'static [u8] = &'static [1, 2, 3]; Change this code to the shorter: static X: &'static [u8] = &[1, 2, 3]; Closes #15312. [breaking-change]
2014-07-04Fixed iOS build after *T removalValerii Hiora-2/+2
2014-07-04auto merge of #15321 : huonw/rust/nil-prim, r=alexcrichtonbors-0/+3
This adds a primitive page for () like http://doc.rust-lang.org/master/std/uint/primitive.uint.html . I would prefer the modules to be `std::tuple::unit`, but rustdoc only searches at the top level (filed as #15320).
2014-07-04auto merge of #15343 : alexcrichton/rust/0.11.0-release, r=brsonbors-2/+2
2014-07-04core: add a primitive page for `()`.Huon Wilson-0/+3