about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2014-05-15core: Update all tests for fmt movementAlex Crichton-132/+219
2014-05-15std: Fix float testsAlex Crichton-27/+1
2014-05-15core: Implement f32/f64 formattingAlex Crichton-0/+362
This is a migration of the std::{f32, f64}::to_str* functionality to the core library. This removes the growable `Vec` used in favor of a large stack buffer. The maximum base 10 exponent for f64 is 308, so a stack buffer of 512 bytes should be sufficient to store all floats.
2014-05-15Updates with core::fmt changesAlex Crichton-1/+1
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-15core: Derive Show impls wherever possibleAlex Crichton-6/+6
These were temporarily moved to explicit implementations, but now that fmt is in core it's possible to derive again.
2014-05-15core: Implement and export the try! macroAlex Crichton-0/+6
This is used quite extensively by core::fmt
2014-05-15core: Allow formatted failure and assert in coreAlex Crichton-2/+25
With std::fmt having migrated, the failure macro can be expressed in its full glory.
2014-05-15core: Implement unwrap()/unwrap_err() on ResultAlex Crichton-18/+61
Now that std::fmt is in libcore, it's possible to implement this as an inherit method rather than through extension traits. This commit also tweaks the failure interface of libcore to libstd to what it should be, one method taking &fmt::Arguments
2014-05-15core: Inherit the std::fmt moduleAlex Crichton-0/+1407
This commit moves all possible functionality from the standard library's string formatting utilities into the core library. This is a breaking change, due to a few tweaks in the semantics of formatting: 1. In order to break the dependency on the std::io module, a new trait, FormatWriter was introduced in core::fmt. This is the trait which is used (instead of Writer) to format data into a stream. 2. The new FormatWriter trait has one method, write(), which takes some bytes and can return an error, but the error contains very little information. The intent for this trait is for an adaptor writer to be used around the standard library's Writer trait. 3. The fmt::write{,ln,_unsafe} methods no longer take &mut io::Writer, but rather &mut FormatWriter. Since this trait is less common, all functions were removed except fmt::write, and it is not intended to be invoked directly. The main API-breaking change here is that the fmt::Formatter structure will no longer expose its `buf` field. All previous code writing directly to `f.buf` using writer methods or the `write!` macro will now instead use `f` directly. The Formatter object itself implements the `Writer` trait itself for convenience, although it does not implement the `FormatWriter` trait. The fallout of these changes will be in the following commits. [breaking-change]
2014-05-15core: Move intrinsic float functionality from stdAlex Crichton-2/+699
The Float trait in libstd is quite a large trait which has dependencies on cmath (libm) and such, which libcore cannot satisfy. It also has many functions that libcore can implement, however, as LLVM has intrinsics or they're just bit twiddling. This commit moves what it can of the Float trait from the standard library into libcore to allow floats to be usable in the core library. The remaining functions are now resident in a FloatMath trait in the standard library (in the prelude now). Previous code which was generic over just the Float trait may now need to be generic over the FloatMath trait. [breaking-change]
2014-05-15Implement cell::clone_refKeegan McAllister-0/+34
Per discussion with @alexcrichton, this is a free function.
2014-05-15core: Remove the unit moduleBrian Anderson-47/+22
2014-05-15Add a crate for missing stubs from libcoreAlex Crichton-0/+3
The core library in theory has 0 dependencies, but in practice it has some in order for it to be efficient. These dependencies are in the form of the basic memory operations provided by libc traditionally, such as memset, memcmp, etc. These functions are trivial to implement and themselves have 0 dependencies. This commit adds a new crate, librlibc, which will serve the purpose of providing these dependencies. The crate is never linked to by default, but is available to be linked to by downstream consumers. Normally these functions are provided by the system libc, but in other freestanding contexts a libc may not be available. In these cases, librlibc will suffice for enabling execution with libcore. cc #10116
2014-05-15Register new snapshotsAlex Crichton-104/+0
2014-05-14auto merge of #14133 : db48x/rust/ord-for-mut-refs, r=alexcrichtonbors-1/+33
Also Show, which is useful in assertions. Fixes #14074
2014-05-14define Eq,TotalEq,Ord,TotalOrd for &mut TDaniel Brooks-1/+33
Also Show, which is useful in assertions. Fixes #14074
2014-05-13core: Allow using failure outside of libcoreAlex Crichton-4/+7
Due to our excellent macro hygiene, this involves having a global path and a hidden module in libcore itself.
2014-05-13core: Document should_not_exist's existenceAlex Crichton-0/+16
Explain why it should not exist, and the plan of attack for removing it.
2014-05-13core: Add a crate doc blockAlex Crichton-0/+21
2014-05-13core: Inherit the atomics moduleAlex Crichton-0/+792
2014-05-13io: Implement process wait timeoutsAlex Crichton-0/+1
This implements set_timeout() for std::io::Process which will affect wait() operations on the process. This follows the same pattern as the rest of the timeouts emerging in std::io::net. The implementation was super easy for everything except libnative on unix (backwards from usual!), which required a good bit of signal handling. There's a doc comment explaining the strategy in libnative. Internally, this also required refactoring the "helper thread" implementation used by libnative to allow for an extra helper thread (not just the timer). This is a breaking change in terms of the io::Process API. It is now possible for wait() to fail, and subsequently wait_with_output(). These two functions now return IoResult<T> due to the fact that they can time out. Additionally, the wait_with_output() function has moved from taking `&mut self` to taking `self`. If a timeout occurs while waiting with output, the semantics are undesirable in almost all cases if attempting to re-wait on the process. Equivalent functionality can still be achieved by dealing with the output handles manually. [breaking-change] cc #13523
2014-05-13std: Rename str::Normalizations to str::DecompositionsFlorian Zeitz-3/+3
The Normalizations iterator has been renamed to Decompositions. It does not currently include all forms of Unicode normalization, but only encompasses decompositions. If implemented recomposition would likely be a separate iterator which works on the result of this one. [breaking-change]
2014-05-13core: Move Hangul decomposition into unicode.rsFlorian Zeitz-50/+52
2014-05-13core: Use appropriately sized integers for codepoints and bytesFlorian Zeitz-50/+45
2014-05-13std, core: Generate unicode.rs using unicode.pyFlorian Zeitz-4/+7
2014-05-13std: Move the owned module from core to stdAlex Crichton-93/+95
The compiler was updated to recognize that implementations for ty_uniq(..) are allowed if the Box lang item is located in the current crate. This enforces the idea that libcore cannot allocated, and moves all related trait implementations from libcore to libstd. This is a breaking change in that the AnyOwnExt trait has moved from the any module to the owned module. Any previous users of std::any::AnyOwnExt should now use std::owned::AnyOwnExt instead. This was done because the trait is intended for Box traits and only Box traits. [breaking-change]
2014-05-12Improved example code in OptionAdolfo OchagavĂ­a-12/+15
2014-05-12libcore: remove fails from slice.rs and remove duplicated length checkingKevin Butler-24/+35
core::slice::raw::{shift_ptr,pop_ptr} now returns Option<*T> rather than *T. They no longer fail on empty slices. [breaking-change]
2014-05-12Add the patch number to version strings. Closes #13289Brian Anderson-1/+1
2014-05-12register snapshotsDaniel Micay-16/+0
2014-05-11core: Remove the cast moduleAlex Crichton-189/+165
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-10initial port of the exchange allocator to jemallocDaniel Micay-3/+5
In stage0, all allocations are 8-byte aligned. Passing a size and alignment to free is not yet implemented everywhere (0 size and 8 align are used as placeholders). Fixing this is part of #13994. Closes #13616
2014-05-10add an align parameter to exchange_mallocDaniel Micay-5/+21
Closes #13094
2014-05-10auto merge of #14073 : alexcrichton/rust/snapshots, r=huonwbors-2/+2
2014-05-10auto merge of #14068 : alexcrichton/rust/rustdoc-xcrate-links, r=brsonbors-1/+1
This should improve the libcore experience quite a bit when looking at the libstd documentation.
2014-05-09Register new snapshotsAlex Crichton-2/+2
2014-05-09doc: Fix some broken linksAlex Crichton-1/+1
2014-05-09auto merge of #14053 : FlaPer87/rust/master, r=huonwbors-0/+1
This patch allows for using derivings for `kinds` in libcore r? @alexcrichton
2014-05-08auto merge of #14019 : brson/rust/docs, r=alexcrichtonbors-44/+24
Just small bits of polish.
2014-05-09core: Allow kinds derivingsFlavio Percoco-0/+1
2014-05-08Handle breakage after libcore splitKevin Ballard-3/+33
API Changes: - &[T] and ~[T] no longer support the addition operator (+)
2014-05-08Handle fallout in documentationKevin Ballard-55/+56
Tweak the tutorial's section on vectors and strings, to slightly clarify the difference between fixed-size vectors, vectors, and slices.
2014-05-08Handle fallout for vector additionKevin Ballard-17/+0
Adding two vectors now results in a Vec<T> instead of a ~[T]. Implement Add on Vec<T>.
2014-05-08Handle fallout in iter, option, result, and sync::arcKevin Ballard-50/+51
API changes: - UnsafeArc::newN() returns Vec<UnsafeArc<T>>
2014-05-08Remove FromIterator impl for ~[T]Kevin Ballard-33/+0
As part of the shift from ~[T] to Vec<T>, recently ~[T] was made non-growable. However, the FromIterator implementation for ~[T] was left intact (albeit implemented inefficiently), which basically provided a loophole to grow a ~[T] despite its non-growable nature. This is a problem, both for performance reasons and because it encourages APIs to continue returning ~[T] when they should return Vec<T>. Removing FromIterator forces these APIs to adopt the correct type. Furthermore, during today's weekly meeting it was decided that we should remove all instances of ~[T] from the standard libraries in favor of Vec<T>. Removing the FromIterator impl makes sense to do as a result. This commit only includes the removal of the FromIterator impl. The subsequent commits involve handling all of the breakage that results, including changing APIs to use Vec<T> instead of ~[T]. The precise API changes are documented in the subsequent commit messages, but each commit is not individually marked as a breaking change. Finally, a new trait FromVec is introduced that provides a mechanism to convert Vec<T> back into ~[T] if truly necessary. It is a bit awkward to use by design, and is anticipated that it will be more useful in a post-DST world to convert to an arbitrary Foo<[T]> smart pointer. [breaking-change]
2014-05-07std: Small doc tweaksBrian Anderson-1/+3
2014-05-07std: Change names of transmute's type parametersBrian Anderson-1/+1
from L, G to T, U. I don't know what L and G mean. T, U easier to understand.
2014-05-07std: Reorder definitions in castBrian Anderson-19/+19
Prioritize `transmute` and `forget`.
2014-05-07std: Remove bump_box_refcount. Deprecated and unused. Deprecused.Brian Anderson-23/+1
2014-05-07Test fixes and rebase conflictsAlex Crichton-25/+59