summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-05-22libstd: Remove all uses of `~str` from `libstd`Patrick Walton-203/+150
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-442/+494
2014-05-22Remove a slew of old deprecated functionsAlex Crichton-74/+5
2014-05-22Spelling/doc formatting fixes.Huon Wilson-7/+7
2014-05-22auto merge of #14322 : thestinger/rust/secret_santa_heap, r=alexcrichtonbors-3/+3
2014-05-21doc: Fix some broken linksAlex Crichton-1/+1
2014-05-21auto merge of #14307 : kballard/rust/vim_prelude_mutablecloneablevector, r=cmrbors-4/+4
Add slice::MutableCloneableVector to the prelude. It's the only slice trait that's currently missing. Update rust.vim to match the latest prelude and current set of keywords. Also teach it to handle box placement expressions specially.
2014-05-21Change static.rust-lang.org to doc.rust-lang.orgAlex Crichton-1/+1
The new documentation site has shorter urls, gzip'd content, and index.html redirecting functionality.
2014-05-21auto merge of #14301 : alexcrichton/rust/remove-unsafe-arc, r=brsonbors-343/+174
This type can be built with `Arc<Unsafe<T>>` now that liballoc exists.
2014-05-21std,green: Mark some queue types as NoShareAlex Crichton-3/+9
2014-05-21migrate from `exchange_malloc` to `allocate`Daniel Micay-3/+3
This is now only used internally by the compiler.
2014-05-21std: Change hash to reexport its own WriterAlex Crichton-1/+2
One of the long-term goals of the libstd facade is to move the collections library underneath the standard library. This would imply that libcollections today would invert its dependency with libstd. One of the primary blockers for doing this is the HashMap collection. Of its two major dependencies, hashing and randomness, this commit is the first step in dealing with hashing. When moving the hash module beneath libstd, it must break its primary dependence on the io::Writer trait (used as the hashing state). The proposed strategy for breaking this dependence is taking a similar path as core::fmt, which is to have the hash module define its own "writer trait". This trait would be similar to std::io::Writer, except that it would not return errors and it would have fewer convenience methods. The Hash trait today has its type parameter behind a feature gate (default type parameters), so this pending change will likely break no code which hasn't opted in to the feature gate. The SipState struct will lose its implementation of io::Writer, but it will regain similar methods for dealing with writing data. This change specifically prepares for the hash migration by modifying deriving(Hash) to use the std::hash::Writer bound instead of the std::io::Writer bound. This bound is currently wired to std::io::Writer, but after a snapshot it will have no need to be wired to the io writer trait.
2014-05-21auto merge of #14315 : kballard/rust/stdreader_isatty, r=alexcrichtonbors-0/+10
StdWriter has .isatty(). StdReader can trivially vend the same function, and someone asked today on IRC how to call isatty() on stdin.
2014-05-20auto merge of #14259 : alexcrichton/rust/core-mem, r=brsonbors-12/+16
Excluding the functions inherited from the cast module last week (with marked stability levels), these functions received the following treatment. * size_of - this method has become #[stable] * nonzero_size_of/nonzero_size_of_val - these methods have been removed * min_align_of - this method is now #[stable] * pref_align_of - this method has been renamed without the `pref_` prefix, and it is the "default alignment" now. This decision is in line with what clang does (see url linked in comment on function). This function is now #[stable]. * init - renamed to zeroed and marked #[stable] * uninit - marked #[stable] * move_val_init - renamed to overwrite and marked #[stable] * {from,to}_{be,le}{16,32,64} - all functions marked #[stable] * swap/replace/drop - marked #[stable] * size_of_val/min_align_of_val/align_of_val - these functions are marked #[unstable], but will continue to exist in some form. Concerns have been raised about their `_val` prefix.
2014-05-20core: Stabilize the mem moduleAlex Crichton-12/+16
Excluding the functions inherited from the cast module last week (with marked stability levels), these functions received the following treatment. * size_of - this method has become #[stable] * nonzero_size_of/nonzero_size_of_val - these methods have been removed * min_align_of - this method is now #[stable] * pref_align_of - this method has been renamed without the `pref_` prefix, and it is the "default alignment" now. This decision is in line with what clang does (see url linked in comment on function). This function is now #[stable]. * init - renamed to zeroed and marked #[stable] * uninit - marked #[stable] * move_val_init - renamed to overwrite and marked #[stable] * {from,to}_{be,le}{16,32,64} - all functions marked #[stable] * swap/replace/drop - marked #[stable] * size_of_val/min_align_of_val/align_of_val - these functions are marked #[unstable], but will continue to exist in some form. Concerns have been raised about their `_val` prefix. [breaking-change]
2014-05-20auto merge of #14293 : alexcrichton/rust/weak-lang-items, r=brsonbors-8/+72
This commit is part of the ongoing libstd facade efforts (cc #13851). The compiler now recognizes some language items as "extern { fn foo(...); }" and will automatically perform the following actions: 1. The foreign function has a pre-defined name. 2. The crate and downstream crates can only be built as rlibs until a crate defines the lang item itself. 3. The actual lang item has a pre-defined name. This is essentially nicer compiler support for the hokey core-depends-on-std-failure scheme today, but it is implemented the same way. The details are a little more hidden under the covers. In addition to failure, this commit promotes the eh_personality and rust_stack_exhausted functions to official lang items. The compiler can generate calls to these functions, causing linkage errors if they are left undefined. The checking for these items is not as precise as it could be. Crates compiling with `-Z no-landing-pads` will not need the eh_personality lang item, and crates compiling with no split stacks won't need the stack exhausted lang item. For ease, however, these items are checked for presence in all final outputs of the compiler. It is quite easy to define dummy versions of the functions necessary: #[lang = "stack_exhausted"] extern fn stack_exhausted() { /* ... */ } #[lang = "eh_personality"] extern fn eh_personality() { /* ... */ } cc #11922, rust_stack_exhausted is now a lang item cc #13851, libcollections is blocked on eh_personality becoming weak
2014-05-20Add .isatty() method to StdReaderKevin Ballard-0/+10
StdWriter has .isatty(). StdReader can trivially vend the same function, and someone asked today on IRC how to call isatty() on stdin.
2014-05-20auto merge of #14305 : tbu-/rust/pr_doc_bytes, r=huonwbors-1/+2
Only an example was needed, as the ability to write uints into the string is already mentioned. Fix #7102.
2014-05-20Add non-utf8 byte to the bytes!() exampleTobias Bucher-1/+2
Only an example was needed, as the ability to write uints into the string is already mentioned. Fix #7102.
2014-05-20Add slice::MutableCloneableVector to the preludeKevin Ballard-4/+4
Every other trait in slice is in the prelude, so it makes sense to provide MutableCloneableVector as well.
2014-05-20Address review commentsBrian Anderson-1/+1
2014-05-20std: Alphabetize crate reexports for rustdocBrian Anderson-4/+6
2014-05-20std: Fix broken linkBrian Anderson-2/+1
2014-05-19std: Remove UnsafeArcAlex Crichton-218/+23
This type has been superseded by Arc<Unsafe<T>>. The UnsafeArc type is a relic of an era that has long since past, and with the introduction of liballoc the standard library is able to use the Arc smart pointer. With little need left for UnsafeArc, it was removed. All existing code using UnsafeArc should either be reevaluated to whether it can use only Arc, or it should transition to Arc<Unsafe<T>> [breaking-change]
2014-05-19std: Move comm primitives away from UnsafeArcAlex Crichton-30/+39
They currently still use `&mut self`, this migration was aimed towards moving from UnsafeArc<T> to Arc<Unsafe<T>>
2014-05-19std: Build Exclusive on Arc<Unsafe<T>>Alex Crichton-3/+5
This removes the usage of UnsafeArc
2014-05-19std: Use Arc instead of UnsafeArc in BlockedTaskAlex Crichton-8/+9
2014-05-19std: Rebuild spsc with Unsafe/&selfAlex Crichton-25/+26
This removes the incorrect usage of `&mut self` in a concurrent setting.
2014-05-19std: Rebuild mpsc queue with Unsafe/&selfAlex Crichton-8/+9
This removes the incorrect `&mut self` taken because it can alias among many threads.
2014-05-19std: Rebuild mpmc queues on Unsafe/ArcAlex Crichton-23/+27
This removes usage of UnsafeArc and uses proper self mutability for concurrent types.
2014-05-19std: Rebuild sync::deque on ArcAlex Crichton-25/+27
This also removes the `&mut self` requirement, using the correct `&self` requirement for concurrent types.
2014-05-19rustc: Add official support for weak failureAlex Crichton-8/+72
This commit is part of the ongoing libstd facade efforts (cc #13851). The compiler now recognizes some language items as "extern { fn foo(...); }" and will automatically perform the following actions: 1. The foreign function has a pre-defined name. 2. The crate and downstream crates can only be built as rlibs until a crate defines the lang item itself. 3. The actual lang item has a pre-defined name. This is essentially nicer compiler support for the hokey core-depends-on-std-failure scheme today, but it is implemented the same way. The details are a little more hidden under the covers. In addition to failure, this commit promotes the eh_personality and rust_stack_exhausted functions to official lang items. The compiler can generate calls to these functions, causing linkage errors if they are left undefined. The checking for these items is not as precise as it could be. Crates compiling with `-Z no-landing-pads` will not need the eh_personality lang item, and crates compiling with no split stacks won't need the stack exhausted lang item. For ease, however, these items are checked for presence in all final outputs of the compiler. It is quite easy to define dummy versions of the functions necessary: #[lang = "stack_exhausted"] extern fn stack_exhausted() { /* ... */ } #[lang = "eh_personality"] extern fn eh_personality() { /* ... */ } cc #11922, rust_stack_exhausted is now a lang item cc #13851, libcollections is blocked on eh_personality becoming weak
2014-05-19Minor doc fixes in various placesPiotr Jawniak-1/+1
2014-05-18Fixing rustdoc stage1.Felix S. Klock II-17/+51
See #13983 and #14000. Fix was originally authored by alexcrichton and then rebased a couple times by pnkfelix, most recently atop PR 13954. ---- Regarding the change to librustdoc/lib.rs, to do `map_err` before unwrapping a `TqskResult`: I do not understand how master is passing without this change or something like it, since `Box<Any:Send>` does not implement `Show`. (Is this something that is only a problem for the snapshot stage0 compiler?) Still, the change I have put in here (which was added as part of a rebase after alex's review) seems harmless to me to apply to rustdoc at all stages, since a call to `unwrap` is just going to `fail!` on the err case anyway.
2014-05-17Register new snapshotsAlex Crichton-8/+0
2014-05-17std: Refactor liballoc out of lib{std,sync}Alex Crichton-700/+17
This commit is part of the libstd facade RFC, issue #13851. This creates a new library, liballoc, which is intended to be the core allocation library for all of Rust. It is pinned on the basic assumption that an allocation failure is an abort or failure. This module has inherited the heap/libc_heap modules from std::rt, the owned/rc modules from std, and the arc module from libsync. These three pointers are currently the three most core pointer implementations in Rust. The UnsafeArc type in std::sync should be considered deprecated and replaced by Arc<Unsafe<T>>. This commit does not currently migrate to this type, but future commits will continue this refactoring.
2014-05-17auto merge of #14253 : alexcrichton/rust/issue-14221, r=pcwaltonbors-3/+3
This plugs a leak where resolve was treating enums defined in parent modules as in-scope for all children modules when resolving a pattern identifier. This eliminates the code path in resolve entirely. If this breaks any existing code, then it indicates that the variants need to be explicitly imported into the module. Closes #14221
2014-05-16rustc: Stop leaking enum variants into childrenAlex Crichton-3/+3
This plugs a leak where resolve was treating enums defined in parent modules as in-scope for all children modules when resolving a pattern identifier. This eliminates the code path in resolve entirely. If this breaks any existing code, then it indicates that the variants need to be explicitly imported into the module. Closes #14221 [breaking-change]
2014-05-16auto merge of #14135 : gereeter/rust/two-way-search, r=brsonbors-0/+74
This changes the previously naive string searching algorithm to a two-way search like glibc, which should be faster on average while still maintaining worst case linear time complexity. This fixes #14107. Note that I don't think this should be merged yet, as this is the only approach to speeding up search I've tried - it's worth considering options like Boyer-Moore or adding a bad character shift table to this. However, the benchmarks look quite good so far: test str::bench::bench_contains_bad_naive ... bench: 290 ns/iter (+/- 12) from 1309 ns/iter (+/- 36) test str::bench::bench_contains_equal ... bench: 479 ns/iter (+/- 10) from 137 ns/iter (+/- 2) test str::bench::bench_contains_short_long ... bench: 2844 ns/iter (+/- 105) from 5473 ns/iter (+/- 14) test str::bench::bench_contains_short_short ... bench: 55 ns/iter (+/- 4) from 57 ns/iter (+/- 6) Except for the case specifically designed to be optimal for the naive case (`bench_contains_equal`), this gets as good or better performance as the previous code.
2014-05-15core: Update all tests for fmt movementAlex Crichton-17/+29
2014-05-15std: Fix float testsAlex Crichton-21/+18
2014-05-15std: Delegate some integer formatting to core::fmtAlex Crichton-45/+29
In an attempt to phase out the std::num::strconv module's string formatting functionality, this commit reimplements some provided methods for formatting integers on top of format!() instead of the custom (and slower) implementation inside of num::strconv. Primarily, this deprecates int_to_str_bytes_common
2014-05-15Updates with core::fmt changesAlex Crichton-35/+30
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-15std: Rewrite the `write!` and `writeln!` macrosAlex Crichton-5/+12
These are reimplemented using the new `core::fmt` module.
2014-05-15std: Add an adaptor for Writer => FormatWriterAlex Crichton-0/+36
This new method, write_fmt(), is the one way to write a formatted list of arguments into a Writer stream. This has a special adaptor to preserve errors which occur on the writer. All macros will be updated to use this method explicitly.
2014-05-15core: Implement unwrap()/unwrap_err() on ResultAlex Crichton-330/+5
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-1968/+583
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-689/+8
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-15auto merge of #14213 : kballard/rust/str_from_utf8_result, r=cmrbors-12/+20
Change `str::from_utf8_owned()` and `StrBuf::from_utf8()` to return `Result`. This allows the vector to be recovered when it contains invalid UTF-8.
2014-05-15std: Delete unused fileBrian Anderson-52/+0