about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2015-03-20Add default impls for Send/SyncFlavio Percoco-0/+4
2015-03-20don't use Result::ok just to be able to use unwrap/unwrap_orOliver Schneider-2/+2
2015-03-20Auto merge of #23254 - jbcrail:saturating-math-docs, r=steveklabnikbors-0/+20
This was added for #23241.
2015-03-19StrExt::splitn should not require a DoubleEndedSearcherJake Goulding-29/+36
Closes #23262
2015-03-19Introduce rsplitJake Goulding-1/+88
2015-03-19Auto merge of #23507 - jbcrail:fix-comment-spelling, r=alexcrichtonbors-2/+2
I corrected misspelled comments in several crates.
2015-03-19Fix spelling errors in comments.Joseph Crail-2/+2
I corrected misspelled comments in several crates.
2015-03-19Rollup merge of #23495 - pcwalton:inline-cell, r=cmrManish Goregaokar-0/+21
This is a significant performance problem in Servo. r? @brson
2015-03-19Rollup merge of #23474 - nagisa:patch-1, r=steveklabnikManish Goregaokar-1/+1
r? @steveklabnik
2015-03-19core: Inline most cell methods.Patrick Walton-0/+21
This is a significant performance problem in Servo.
2015-03-19Rollup merge of #23462 - alexcrichton:stabilize-cloned, r=aturonManish Goregaokar-27/+18
This commit stabilizes the `cloned` iterator after tweaking the signature to require that the iterator is over `&T` instead of `U: Deref<T>`. This method has had time to bake for awhile now and it's not clear whether the `Deref` bound is worth it. Additionally, there aren't clear conventions on when to bound and/or implement the `Deref` trait, so for now the conservative route is to require references instead of `U: Deref<T>`. To change this signature to using `Deref` would technically be a backwards-incompatible change, but it is doubtful that any code will actually break in practice.
2015-03-18Register new snapshotsAlex Crichton-1144/+960
2015-03-18std: Stabilize marker::MarkerTraitAlex Crichton-0/+1
This trait has proven quite useful when defining marker traits to avoid the semi-confusing `PhantomFn` trait and it looks like it will continue to be a useful tool for defining these traits.
2015-03-18std: Add missing stability on RangeAlex Crichton-3/+4
Now that we check the stability of fields, the fields of this struct should also be stable.
2015-03-18Rollup merge of #23461 - alexcrichton:feat-char-at, r=aturonManish Goregaokar-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-18Make it clear which value is discardedSimonas Kazlauskas-1/+1
2015-03-18Auto merge of #22838 - petrochenkov:bytelit, r=alexcrichtonbors-2/+27
This patch changes the type of byte string literals from `&[u8]` to `&[u8; N]`. It also implements some necessary traits (`IntoBytes`, `Seek`, `Read`, `BufRead`) for fixed-size arrays (also related to #21725) and adds test for #17233, which seems to be resolved. Fixes #18465 [breaking-change]
2015-03-17std: Stabilize `IteratorExt::cloned`Alex Crichton-27/+18
This commit stabilizes the `cloned` iterator after tweaking the signature to require that the iterator is over `&T` instead of `U: Deref<T>`. This method has had time to bake for awhile now and it's not clear whether the `Deref` bound is worth it. Additionally, there aren't clear conventions on when to bound and/or implement the `Deref` trait, so for now the conservative route is to require references instead of `U: Deref<T>`. To change this signature to using `Deref` would technically be a backwards-incompatible change, but it is doubtful that any code will actually break in practice.
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-18Avoid metadata bloat by using trait FixedSizeArrayVadim Petrochenkov-1/+25
2015-03-18Add and fix more testsVadim Petrochenkov-1/+2
2015-03-17Replace TyDesc and its uses with trait vtables and a type_name intrinsic.Eduard Burtescu-0/+7
2015-03-17Auto merge of #23423 - nikomatsakis:issue-18737-trait-subtyping, r=nrcbors-0/+26
This upcast coercion currently never requires vtable changes. It should be generalized. This is a [breaking-change] -- if you have an impl on an object type like `impl SomeTrait`, then this will no longer be applicable to object types like `SomeTrait+Send`. In the standard library, this primarily affected `Any`, and this PR adds impls for `Any+Send` as to keep the API the same in practice. An alternate workaround is to use UFCS form or standalone fns. For more details, see <https://github.com/rust-lang/rust/issues/18737#issuecomment-78450798>. r? @nrc
2015-03-17Remove subtyping for object types and replace with an *upcast* coercion.Niko Matsakis-0/+26
This upcast coercion currently preserves the vtable for the object, but eventually it can be used to create a derived vtable. The upcast coercion is not introduced into method dispatch; see comment on #18737 for information about why. Fixes #18737.
2015-03-17Rollup merge of #23385 - tamird:cleanup-whitespace, r=alexcrichtonManish Goregaokar-3/+0
r? @alexcrichton Conflicts: src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs
2015-03-17Rollup merge of #23329 - jbcrail:rm-syntax-highlight, r=sanxiynManish Goregaokar-34/+34
As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
2015-03-16impl {i,u}{8,16,32,64,size}Jorge Aparicio-0/+990
2015-03-16impl<T> *const T, impl<T> *mut TJorge Aparicio-0/+121
2015-03-16Auto merge of #23347 - aturon:stab-misc, r=alexcrichtonbors-69/+114
This commit deprecates the `count`, `range` and `range_step` functions in `iter`, in favor of range notation. To recover all existing functionality, a new `step_by` adapter is provided directly on `ops::Range` and `ops::RangeFrom`. [breaking-change] r? @alexcrichton
2015-03-15core: Update tuple docUlrik Sverdrup-11/+5
Remove mention of removed methods `.val0` etc.
2015-03-15core: Remove unused parts of tuple macroUlrik Sverdrup-79/+79
2015-03-15Strip all leading/trailing newlinesTamir Duberstein-3/+0
2015-03-14Auto merge of #23333 - oli-obk:slice_from_raw_parts, r=alexcrichtonbors-14/+27
at least that's what the docs say: http://doc.rust-lang.org/std/slice/fn.from_raw_parts.html A few situations got prettier. In some situations the mutability of the resulting and source pointers differed (and was cast away by transmute), the mutability matches now.
2015-03-14Auto merge of #22948 - rprichard:simple-panic-opt, r=alexcrichtonbors-1/+7
Reduce code size overhead from core::panicking::panic core::panicking::panic currently creates an Arguments structure using format_args!("{}", expr), which formats the expr str using the Display::fmt. Display::fmt pulls in Formatter::pad, which then also pulls in string-related code for truncation and padding. If core::panicking::panic instead creates an Arguments structure with a string piece, it is possible that the Display::fmt function for str can be optimized out of the program. In my testing with a 32-bit x86 bare metal program, the change tended to save between ~100 bytes and ~5500 bytes, depending on what other panic* functions the program invokes and whether the panic_fmt lang item uses the Arguments value.
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-34/+34
2015-03-13Deprecate range, range_step, count, distributionsAaron Turon-69/+114
This commit deprecates the `count`, `range` and `range_step` functions in `iter`, in favor of range notation. To recover all existing functionality, a new `step_by` adapter is provided directly on `ops::Range` and `ops::RangeFrom`. [breaking-change]
2015-03-13Rollup merge of #23321 - apasel422:hash, r=alexcrichtonManish Goregaokar-3/+1
It is no longer possible to specialize on the `Hasher` because it moved to a method-level type parameter.
2015-03-13slice::from_raw_parts is preferred over transmuting a fresh raw::SliceOliver Schneider-14/+27
2015-03-12remove mention of specialization from `Hash` traitAndrew Paseltiner-3/+1
It is no longer possible to specialize on the `Hasher` because it moved to a method-level type parameter.
2015-03-12Update the ways to get a pointer from a boxGleb Kozyrev-13/+16
Show how to get a pointer without destroying the box. Use `boxed::into_raw` instead of `mem::transmute`.
2015-03-12Auto merge of #23162 - sfackler:debug-builders, r=alexcrichtonbors-1/+422
I've made some minor changes from the implementation attached to the RFC to try to minimize codegen. The methods now take `&Debug` trait objects rather than being parameterized and there are inlined stub methods that call to non-inlined methods to do the work. r? @alexcrichton cc @huonw for the `derive(Debug)` changes.
2015-03-12Rollup merge of #23263 - alexcrichton:stabilize-from-raw-parts, r=brsonManish Goregaokar-2/+2
These new APIs have had some time to bake now, and no pressing issues have come up so they should be ok for stabilizing. Specifically, these two APIs were stabilized: * `slice::from_raw_parts` * `slice::from_raw_parts_mut`
2015-03-12Rollup merge of #23247 - tbu-:pr_core_iter_rm_isize, r=huonwManish Goregaokar-3/+3
2015-03-11Example -> ExamplesSteve Klabnik-89/+89
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-11Add docs for saturating integer arithmetic.Joseph Crail-0/+20
This was added for #23241.
2015-03-11Switch to a specific featureSteven Fackler-10/+10
2015-03-10Remove core::panicking::panic's dependence on str's Display::fmt implRyan Prichard-1/+7
Display::fmt for str calls into Formatter::pad, which is modest in size and also pulls in string-related functions for its truncation and padding abilities. For size-critical programs (e.g. embedded), this call site may be the only reason Formatter::pad is linked into the output.
2015-03-10Remove inline silliness from debug buildersSteven Fackler-60/+11
Turns out it's basically a wash, codegen wise.
2015-03-11Auto merge of #23251 - tbu-:pr_rm_core_str_checked_add, r=alexcrichtonbors-1/+4
2015-03-10Auto merge of #23126 - alexcrichton:char-third-pass, r=aturonbors-221/+4
This commit performs another pass over the `std::char` module for stabilization. Some minor cleanup is performed such as migrating documentation from libcore to libunicode (where the `std`-facing trait resides) as well as a slight reorganiation in libunicode itself. Otherwise, the stability modifications made are: * `char::from_digit` is now stable * `CharExt::is_digit` is now stable * `CharExt::to_digit` is now stable * `CharExt::to_{lower,upper}case` are now stable after being modified to return an iterator over characters. While the implementation today has not changed this should allow us to implement the full set of case conversions in unicode where some characters can map to multiple when doing an upper or lower case mapping. * `StrExt::to_{lower,upper}case` was added as unstable for a convenience of not having to worry about characters expanding to more characters when you just want the whole string to get into upper or lower case. This is a breaking change due to the change in the signatures of the `CharExt::to_{upper,lower}case` methods. Code can be updated to use functions like `flat_map` or `collect` to handle the difference. [breaking-change] Closes #20333