about summary refs log tree commit diff
path: root/src/libcore/str
AgeCommit message (Collapse)AuthorLines
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-1/+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]
2015-04-21std: Remove deprecated AsOsStr/Str/AsSlice traitsAlex Crichton-24/+0
Cleaning out more deprecated items
2015-04-21Auto merge of #24620 - pczarn:model-lexer-issues, r=cmrbors-2/+0
Fixes #15679 Fixes #15878 Fixes #15882 Closes #15883
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-2/+0
2015-04-20Make iterator struct docs more consistent.Steve Klabnik-13/+13
Fixes #24008.
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-2/+2
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-14rollup merge of #24377: apasel422/docsAlex Crichton-4/+4
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-4/+4
2015-04-10std: Stabilize the Utf8Error typeAlex Crichton-22/+17
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-07std: Hide facade extension traits in docsAlex Crichton-0/+1
These traits are currently all just unstable parts of the facade which are implementation details for primitives further up the facade. This may make it more difficult to find what set of methods you get if only linking to libcore, but for now that's also unstable behavior. Closes #22025
2015-04-07Auto merge of #23952 - Kimundi:more_string_pattern, r=alexcrichtonbors-363/+587
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-05Remove external iterator in CharIndices comment and the reference to the ↵Guillaume Gomez-2/+1
std::iter module
2015-04-05Added smoke tests for new methods.Marvin Löbel-10/+23
Fixed bug in existing StrSearcher impl
2015-04-05Refactored core::str::pattern to become a user-facing module and hide awayMarvin Löbel-13/+17
CharEq.
2015-04-05Re-added Clone impls to all str iteratorsMarvin Löbel-9/+82
2015-04-05Implemented remaining string pattern iterators.Marvin Löbel-344/+478
- Added missing reverse versions of methods - Added [r]matches() - Generated the string pattern iterators with a macro - Added where bounds to the methods returning reverse iterators for better error messages.
2015-04-01rollup merge of #23860: nikomatsakis/copy-requires-cloneAlex Crichton-1/+1
Conflicts: src/test/compile-fail/coherence-impls-copy.rs
2015-04-01rollup merge of #23945: pnkfelix/gate-u-negateAlex Crichton-1/+1
Feature-gate unsigned unary negate. Discussed in weekly meeting here: https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2015-03-31.md#feature-gate--expr and also in the internals thread here: http://internals.rust-lang.org/t/forbid-unsigned-integer/752
2015-04-01fallout from feature-gating unary negation on unsigned integers.Felix S. Klock II-1/+1
2015-04-01rollup merge of #23951: alexcrichton/splitnAlex Crichton-11/+9
This commit is an implementation of [RFC 979][rfc] which changes the meaning of the count parameter to the `splitn` function on strings and slices. The parameter now means the number of items that are returned from the iterator, not the number of splits that are made. [rfc]: https://github.com/rust-lang/rfcs/pull/979 Closes #23911 [breaking-change]
2015-04-01std: Changing the meaning of the count to splitnAlex Crichton-11/+9
This commit is an implementation of [RFC 979][rfc] which changes the meaning of the count parameter to the `splitn` function on strings and slices. The parameter now means the number of items that are returned from the iterator, not the number of splits that are made. [rfc]: https://github.com/rust-lang/rfcs/pull/979 Closes #23911 [breaking-change]
2015-04-01Collect the definition of the `Error` trait into `libstd` for now. ThisNiko Matsakis-16/+0
sidesteps a coherence difficulty where `liballoc` had to prove that `&str: !Error`, which didn't involve any local types.
2015-04-01Fallout in public-facing and semi-public-facing libsNiko Matsakis-1/+1
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-141/+125
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-31Stabilize std::numAaron Turon-2/+2
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-28Remove IteratorExtSteven Fackler-2/+2
All methods are inlined into Iterator with `Self: Sized` bounds to make sure Iterator is still object safe. [breaking-change]
2015-03-27rollup merge of #23741: alexcrichton/remove-int-uintAlex Crichton-1/+1
Conflicts: src/librustc/middle/ty.rs src/librustc_trans/trans/adt.rs src/librustc_typeck/check/mod.rs src/libserialize/json.rs src/test/run-pass/spawn-fn.rs
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-1/+1
Now that support has been removed, all lingering use cases are renamed.
2015-03-26Register new snapshotsAlex Crichton-88/+0
2015-03-25Rollup merge of #23664 - bluss:std-docs, r=steveklabnikManish Goregaokar-8/+7
Main motivation was to update docs for the removal or "demotion" of certain extension traits. The update to the slice docs was larger, since the text was largely outdated.
2015-03-24Test fixes and rebase conflicts, round 2Alex Crichton-0/+1
2015-03-24rollup merge of #23630: nrc/coerce-tidyAlex Crichton-1/+1
See notes on the first commit Closes #18601 r? @nikomatsakis cc @eddyb
2015-03-24rollup merge of #23282: nikomatsakis/fn-trait-inheritanceAlex Crichton-1/+28
The primary motivation here is to sidestep #19032 -- for a time, I thought that we should improve coherence or otherwise extend the language, but I now think that any such changes will require more time to bake. In the meantime, inheritance amongst the fn traits is both logically correct *and* a simple solution to that obstacle. This change introduces inheritance and modifies the compiler so that it can properly generate impls for closures and fns. Things enabled by this PR (but not included in this PR): 1. An impl of `FnMut` for `&mut F` where `F : FnMut` (https://github.com/rust-lang/rust/issues/23015). 2. A better version of `Thunk` I've been calling `FnBox`. I did not include either of these in the PR because: 1. Adding the impls in 1 currently induces a coherence conflict with the pattern trait. This is interesting and merits some discussion. 2. `FnBox` deserves to be a PR of its own. The main downside to this design is (a) the need to write impls by hand; (b) the possibility of implementing `FnMut` with different semantics from `Fn`, etc. Point (a) is minor -- in particular, it does not affect normal closure usage -- and could be addressed in the future in many ways (better defaults; convenient macros; specialization; etc). Point (b) is unfortunate but "just a bug" from my POV, and certainly not unique to these traits (c.f. Copy/Clone, PartialEq/Eq, etc). (Until we lift the feature-gate on implementing the Fn traits, in any case, there is room to correct both of these if we find a nice way.) Note that I believe this change is reversible in the future if we decide on another course of action, due to the feature gate on implementing the `Fn` traits, though I do not (currently) think we should reverse it. Fixes #18835. r? @nrc
2015-03-24core: Update docs for StrExt demotion in libstdUlrik Sverdrup-8/+7
Main access point of .split() and other similar methods are not using the StrExt trait anymore, so update the libcore docs to reflect this (because these docs are visible in libstd API documentation).
2015-03-25Add trivial cast lints.Nick Cameron-1/+1
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-23rollup merge of #23601: nikomatsakis/by-value-indexAlex Crichton-0/+78
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-13/+7
2015-03-23rollup merge of #23538: aturon/conversionAlex Crichton-0/+4
Conflicts: src/librustc_back/rpath.rs
2015-03-23Remove auto-deref'ing Pattern impl because it conflicts with otherNiko Matsakis-13/+7
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/+4
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-23Adjust Index/IndexMut impls. For generic collections, we takeNiko Matsakis-0/+78
references. For collections whose keys are integers, we take both references and by-value.
2015-03-23Make the `Fn` traits inherit from one another and remove the bridgingNiko Matsakis-1/+28
impls. This requires: 1. modifying trait selection a bit so that when we synthesize impls for fn pointers and closures; 2. adding code to trans so that we can synthesize a `FnMut`/`FnOnce` impl for a `Fn` closure and so forth.
2015-03-19StrExt::splitn should not require a DoubleEndedSearcherJake Goulding-29/+36
Closes #23262
2015-03-19Introduce rsplitJake Goulding-1/+88
2015-03-19Fix spelling errors in comments.Joseph Crail-2/+2
I corrected misspelled comments in several crates.
2015-03-18Register new snapshotsAlex Crichton-2/+0
2015-03-17std: Tweak some unstable features of `str`Alex Crichton-4/+7
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-3/+3
As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
2015-03-16impl<T> *const T, impl<T> *mut TJorge Aparicio-0/+1
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-3/+3