summary refs log tree commit diff
path: root/src/libcollections/string.rs
AgeCommit message (Collapse)AuthorLines
2015-05-10collections: impl AsRef<[u8]> for StringSean McArthur-0/+8
2015-05-10collections: Improve example for as_string and as_vecUlrik Sverdrup-4/+5
2015-05-07std: Remove index notation on slice iteratorsAlex Crichton-9/+12
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791 Conflicts: src/libcoretest/slice.rs src/librustc_driver/lib.rs
2015-04-23Test fixes and rebase conflicts, round 1Alex Crichton-1/+0
Conflicts: src/test/run-pass/task-stderr.rs
2015-04-23std: Remove deprecated/unstable num functionalityAlex Crichton-8/+0
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change] Conflicts: src/libstd/num/strconv.rs
2015-04-23std: Remove deprecated AsOsStr/Str/AsSlice traitsAlex Crichton-9/+0
Cleaning out more deprecated items Conflicts: src/libcore/result.rs
2015-04-23std: Add Default/IntoIterator/ToOwned to the preludeAlex Crichton-2/+2
This is an implementation of [RFC 1030][rfc] which adds these traits to the prelude and additionally removes all inherent `into_iter` methods on collections in favor of the trait implementation (which is now accessible by default). [rfc]: https://github.com/rust-lang/rfcs/pull/1030 This is technically a breaking change due to the prelude additions and removal of inherent methods, but it is expected that essentially no code breaks in practice. [breaking-change] Closes #24538
2015-04-14rollup merge of #24377: apasel422/docsAlex Crichton-7/+7
Conflicts: src/libstd/net/ip.rs src/libstd/sys/unix/fs.rs src/libstd/sys/unix/mod.rs src/libstd/sys/windows/mod.rs
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-7/+7
2015-04-10std: Stabilize the Utf8Error typeAlex Crichton-10/+6
The meaning of each variant of this enum was somewhat ambiguous and it's uncler that we wouldn't even want to add more enumeration values in the future. As a result this error has been altered to instead become an opaque structure. Learning about the "first invalid byte index" is still an unstable feature, but the type itself is now stable.
2015-04-07Auto merge of #23952 - Kimundi:more_string_pattern, r=alexcrichtonbors-1/+1
This adds the missing methods and turns `str::pattern` in a user facing module, as per RFC. This also contains some big internal refactorings: - string iterator pairs are implemented with a central macro to reduce redundancy - Moved all tests from `coretest::str` into `collectionstest::str` and left a note to prevent the two sets of tests drifting apart further. See https://github.com/rust-lang/rust/issues/22477
2015-04-05Refactored core::str::pattern to become a user-facing module and hide awayMarvin Löbel-1/+1
CharEq.
2015-04-02Implement PartialEq<str> for String and CowGleb Kozyrev-0/+2
2015-04-02Change PartialEq impls in collections::string to slice notationGleb Kozyrev-10/+10
2015-04-01Collect the definition of the `Error` trait into `libstd` for now. ThisNiko Matsakis-11/+0
sidesteps a coherence difficulty where `liballoc` had to prove that `&str: !Error`, which didn't involve any local types.
2015-03-31rollup merge of #23873: alexcrichton/remove-deprecatedAlex Crichton-5/+0
Conflicts: src/libcollectionstest/fmt.rs src/libcollectionstest/lib.rs src/libcollectionstest/str.rs src/libcore/error.rs src/libstd/fs.rs src/libstd/io/cursor.rs src/libstd/os.rs src/libstd/process.rs src/libtest/lib.rs src/test/run-pass-fulldeps/compiler-calls.rs
2015-03-31rollup merge of #23875: aturon/revise-convert-2Alex Crichton-1/+8
* Marks `#[stable]` the contents of the `std::convert` module. * Added methods `PathBuf::as_path`, `OsString::as_os_str`, `String::as_str`, `Vec::{as_slice, as_mut_slice}`. * Deprecates `OsStr::from_str` in favor of a new, stable, and more general `OsStr::new`. * Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes, to_cstring}` for ergonomic FFI usage. [breaking-change] r? @alexcrichton
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-5/+0
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-31rollup merge of #23886: demelev/remove_as_slice_usageAlex Crichton-1/+1
2015-03-31Stabilize `std::convert` and related codeAaron Turon-1/+8
* Marks `#[stable]` the contents of the `std::convert` module. * Added methods `PathBuf::as_path`, `OsString::as_os_str`, `String::as_str`, `Vec::{as_slice, as_mut_slice}`. * Deprecates `OsStr::from_str` in favor of a new, stable, and more general `OsStr::new`. * Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes, to_cstring}` for ergonomic FFI usage. [breaking-change]
2015-03-31Rollup merge of #23866 - alexcrichton:switch-some-orders, r=aturonManish Goregaokar-6/+6
This functions swaps the order of arguments to a few functions that previously took (output, input) parameters, but now take (input, output) parameters (in that order). The affected functions are: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-31replace deprecated as_slice()Emeliov Dmitrii-1/+1
2015-03-30std: Standardize (input, output) param orderingsAlex Crichton-6/+6
This functions swaps the order of arguments to a few functions that previously took (output, input) parameters, but now take (input, output) parameters (in that order). The affected functions are: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-30convert: add Into<Cow> impls for &str and StringSean McArthur-2/+19
2015-03-26Register new snapshotsAlex Crichton-28/+0
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-0/+12
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23rollup merge of #23601: nikomatsakis/by-value-indexAlex Crichton-0/+32
This is a [breaking-change]. When indexing a generic map (hashmap, etc) using the `[]` operator, it is now necessary to borrow explicitly, so change `map[key]` to `map[&key]` (consistent with the `get` routine). However, indexing of string-valued maps with constant strings can now be written `map["abc"]`. r? @japaric cc @aturon @Gankro
2015-03-23rollup merge of #23580: nikomatsakis/pattern-and-overflowAlex Crichton-0/+20
2015-03-23Remove auto-deref'ing Pattern impl because it conflicts with otherNiko Matsakis-0/+20
possible blanket impls and also triggers internal overflow. Add some special cases for common uses (&&str, &String) for now; bounds-targeting deref coercions are probably the right longer term answer.
2015-03-23Add generic conversion traitsAaron Turon-0/+23
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+12
2015-03-23Adjust Index/IndexMut impls. For generic collections, we takeNiko Matsakis-0/+32
references. For collections whose keys are integers, we take both references and by-value.
2015-03-18Register new snapshotsAlex Crichton-20/+3
2015-03-17std: Tweak some unstable features of `str`Alex Crichton-4/+5
This commit clarifies some of the unstable features in the `str` module by moving them out of the blanket `core` and `collections` features. The following methods were moved to the `str_char` feature which generally encompasses decoding specific characters from a `str` and dealing with the result. It is unclear if any of these methods need to be stabilized for 1.0 and the most conservative route for now is to continue providing them but to leave them as unstable under a more specific name. * `is_char_boundary` * `char_at` * `char_range_at` * `char_at_reverse` * `char_range_at_reverse` * `slice_shift_char` The following methods were moved into the generic `unicode` feature as they are specifically enabled by the `unicode` crate itself. * `nfd_chars` * `nfkd_chars` * `nfc_chars` * `graphemes` * `grapheme_indices` * `width`
2015-03-17Rollup merge of #23329 - jbcrail:rm-syntax-highlight, r=sanxiynManish Goregaokar-4/+4
As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
2015-03-16better document the hacks required to test libcollectionsJorge Aparicio-4/+6
2015-03-16move some tests back to libcollectionsJorge Aparicio-0/+9
2015-03-16extract libcollections tests into libcollectionstestJorge Aparicio-447/+0
2015-03-16impl<T> [T]Jorge Aparicio-0/+17
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-4/+4
2015-03-13slice::from_raw_parts is preferred over transmuting a fresh raw::SliceOliver Schneider-6/+6
2015-03-10Fix markdown bullet points in function docsCorey Farwell-0/+1
Markdown requires a newline before bullet points, and since there's not one here, they'll get rendered incorrectly
2015-03-09Auto merge of #22561 - richo:as_slice-as_str, r=Manishearthbors-5/+5
This may not be quite ready to go out, I fixed some docs but suspect I missed a bunch. I also wound up fixing a bunch of redundant `[]` suffixes, but on closer inspection I don't believe that can land until after a snapshot.
2015-03-09Rename #[should_fail] to #[should_panic]Steven Fackler-5/+5
2015-03-09doc: Fix extraneous as_slice()'s in docstringsRicho Healey-5/+5
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-36/+36
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-2/+2
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-02-25Rollup merge of #22729 - alexcrichton:ptr-stabilization, r=aturonManish Goregaokar-9/+9
Specifically, the following actions were takend: * The `copy_memory` and `copy_nonoverlapping_memory` functions to drop the `_memory` suffix (as it's implied by the functionality). Both functions are now marked as `#[stable]`. * The `set_memory` function was renamed to `write_bytes` and is now stable. * The `zero_memory` function is now deprecated in favor of `write_bytes` directly. * The `Unique` pointer type is now behind its own feature gate called `unique` to facilitate future stabilization. [breaking-change]
2015-02-24std: Stabilize some `ptr` functionsAlex Crichton-9/+9
Specifically, the following actions were taken: * The `copy_memory` and `copy_nonoverlapping_memory` functions to drop the `_memory` suffix (as it's implied by the functionality). Both functions are now marked as `#[stable]`. * The `set_memory` function was renamed to `write_bytes` and is now stable. * The `zero_memory` function is now deprecated in favor of `write_bytes` directly. * The `Unique` pointer type is now behind its own feature gate called `unique` to facilitate future stabilization. * All type parameters now are `T: ?Sized` wherever possible and new clauses were added to the `offset` functions to require that the type is sized. [breaking-change]
2015-02-24Use arrays instead of vectors in testsVadim Petrochenkov-3/+3