summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-06-05Improve documentation on std::os::env.Axel Viala-2/+11
2014-06-05auto merge of #14644 : alexcrichton/rust/more-no-runtime-use-cases, r=brsonbors-156/+218
A few notable improvements were implemented to cut down on the number of aborts triggered by the standard library when a local task is not found. * Primarily, the unwinding functionality was restructured to support an unsafe top-level function, `try`. This function invokes a closure, capturing any failure which occurs inside of it. The purpose of this function is to be as lightweight of a "try block" as possible for rust, intended for use when the runtime is difficult to set up. This function is *not* meant to be used by normal rust code, nor should it be consider for use with normal rust code. * When invoking spawn(), a `fail!()` is triggered rather than an abort. * When invoking LocalIo::borrow(), which is transitively called by all I/O constructors, None is returned rather than aborting to indicate that there is no local I/O implementation. A test case was also added showing the variety of things that you can do without a runtime or task set up now. In general, this is just a refactoring to abort less quickly in the standard library when a local task is not found.
2014-06-05Adding examples and possible failures for getcwd.Axel Viala-2/+36
For both window and unix platforms.
2014-06-05auto merge of #14568 : erickt/rust/slice-update, r=alexcrichtonbors-0/+49
This PR adds two features to make it possible to transform an `Iterator<u8>` into a `Reader`. The first patch adds a method to mutable slices that allows it to be updated with an `Iterator<T>` without paying for the bounds cost. The second adds a Iterator adaptor, `IterReader`, to provide that `Reader` interface. I had two questions. First, are these named the right things? Second, should `IterReader` instead wrap an `Iterator<Result<u8, E>>`? This would allow you to `IterReader::new(rdr.bytes())`, which could be useful if you want to apply some iterator transformations on a reader while still exporting the Reader interface, but I'd expect there'd be a lot of overhead annotating each byte with an error result.
2014-06-04auto merge of #14610 : alexcrichton/rust/issue-14008, r=brsonbors-182/+4
This commit removes the <M: Any + Send> type parameter from Option::expect in favor of just taking a hard-coded `&str` argument. This allows this function to move into libcore. Previous code using strings with `expect` will continue to work, but code using this implicitly to transmit task failure will need to unwrap manually with a `match` statement. [breaking-change] Closes #14008
2014-06-04auto merge of #14633 : huonw/rust/nodylibc, r=alexcrichtonbors-0/+5
libc: only provide an rlib. There's absolutely no reason for `libc` to be offered as a dynamic library.
2014-06-04std: Improve non-task-based usageAlex Crichton-156/+218
A few notable improvements were implemented to cut down on the number of aborts triggered by the standard library when a local task is not found. * Primarily, the unwinding functionality was restructured to support an unsafe top-level function, `try`. This function invokes a closure, capturing any failure which occurs inside of it. The purpose of this function is to be as lightweight of a "try block" as possible for rust, intended for use when the runtime is difficult to set up. This function is *not* meant to be used by normal rust code, nor should it be consider for use with normal rust code. * When invoking spawn(), a `fail!()` is triggered rather than an abort. * When invoking LocalIo::borrow(), which is transitively called by all I/O constructors, None is returned rather than aborting to indicate that there is no local I/O implementation. * Invoking get() on a TLD key will return None if no task is available * Invoking replace() on a TLD key will fail if no task is available. A test case was also added showing the variety of things that you can do without a runtime or task set up now. In general, this is just a refactoring to abort less quickly in the standard library when a local task is not found.
2014-06-04Add code example to std::os::getenv for unix.Axel Viala-0/+10
2014-06-04libc: only provide an rlib.Huon Wilson-0/+5
There's absolutely no reason for `libc` to be offered as a dynamic library.
2014-06-03std: Remove generics from Option::expectAlex Crichton-182/+4
This commit removes the <M: Any + Send> type parameter from Option::expect in favor of just taking a hard-coded `&str` argument. This allows this function to move into libcore. Previous code using strings with `expect` will continue to work, but code using this implicitly to transmit task failure will need to unwrap manually with a `match` statement. [breaking-change] Closes #14008
2014-06-03Add next_permutation and prev_permutation onto MutableOrdVector<T>.Thomas Backman-0/+142
Unlike ImmutableClonableVector::permutations() which returns an iterator, cloning the entire array each iteration, these methods mutate the vector in-place. For that reason, these methods are much faster; between 35-55 times faster, depending on the benchmark. They also generate permutations in lexicographical order.
2014-06-02std: add `IterReader` to adapt iterators into readersErick Tryzelaar-0/+49
2014-06-02docs: Stop using `notrust`Florian Gilcher-6/+6
Now that rustdoc understands proper language tags as the code not being Rust, we can tag everything properly. This change tags examples in other languages by their language. Plain notations are marked as `text`. Console examples are marked as `console`. Also fix markdown.rs to not highlight non-rust code.
2014-06-01std: Drop Total from Total{Eq,Ord}Alex Crichton-27/+27
This completes the last stage of the renaming of the comparison hierarchy of traits. This change renames TotalEq to Eq and TotalOrd to Ord. In the future the new Eq/Ord will be filled out with their appropriate methods, but for now this change is purely a renaming change. [breaking-change]
2014-05-31rustdoc: Create anchor pages for primitive typesAlex Crichton-0/+26
This commit adds support in rustdoc to recognize the `#[doc(primitive = "foo")]` attribute. This attribute indicates that the current module is the "owner" of the primitive type `foo`. For rustdoc, this means that the doc-comment for the module is the doc-comment for the primitive type, plus a signal to all downstream crates that hyperlinks for primitive types will be directed at the crate containing the `#[doc]` directive. Additionally, rustdoc will favor crates closest to the one being documented which "implements the primitive type". For example, documentation of libcore links to libcore for primitive types, but documentation for libstd and beyond all links to libstd for primitive types. This change involves no compiler modifications, it is purely a rustdoc change. The landing pages for the primitive types primarily serve to show a list of implemented traits for the primitive type itself. The primitive types documented includes both strings and slices in a semi-ad-hoc way, but in a way that should provide at least somewhat meaningful documentation. Closes #14474
2014-05-30auto merge of #14544 : aturon/rust/issue-14352, r=alexcrichtonbors-2/+94
Adds a platform-specific function, `split_paths` to the `os` module. This function can be used to parse PATH-like environment variables according to local platform conventions. Closes #14352.
2014-05-30Add os::split_pathsAaron Turon-2/+94
Adds a platform-specific function, `split_paths` to the `os` module. This function can be used to parse PATH-like environment variables according to local platform conventions. Closes #14352.
2014-05-30std: Rename {Eq,Ord} to Partial{Eq,Ord}Alex Crichton-40/+40
This is part of the ongoing renaming of the equality traits. See #12517 for more details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord} or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}. cc #12517 [breaking-change]
2014-05-30Register new snapshotsAlex Crichton-1219/+2
2014-05-30windows: Allow snake_case errors for now.Kevin Butler-4/+12
2014-05-30lib{std,core,debug,rustuv,collections,native,regex}: Fix snake_case errors.Kevin Butler-28/+19
A number of functions/methods have been moved or renamed to align better with rust standard conventions. std::reflect::MovePtrAdaptor => MovePtrAdaptor::new debug::reflect::MovePtrAdaptor => MovePtrAdaptor::new std::repr::ReprVisitor => ReprVisitor::new debug::repr::ReprVisitor => ReprVisitor::new rustuv::homing::HomingIO.go_to_IO_home => go_to_io_home [breaking-change]
2014-05-30Rename OSRng to OsRngPiotr Jawniak-25/+25
According to Rust's style guide acronyms in type names should be CamelCase. [breaking-change]
2014-05-29auto merge of #14510 : kballard/rust/rename_strallocating_into_owned, ↵bors-21/+16
r=alexcrichton We already have into_string(), but it was implemented in terms of into_owned(). Flip it around and deprecate into_owned(). Remove a few spurious calls to .into_owned() that existed in libregex and librustdoc.
2014-05-29std: Recreate a `rand` moduleAlex Crichton-25/+925
This commit shuffles around some of the `rand` code, along with some reorganization. The new state of the world is as follows: * The librand crate now only depends on libcore. This interface is experimental. * The standard library has a new module, `std::rand`. This interface will eventually become stable. Unfortunately, this entailed more of a breaking change than just shuffling some names around. The following breaking changes were made to the rand library: * Rng::gen_vec() was removed. This has been replaced with Rng::gen_iter() which will return an infinite stream of random values. Previous behavior can be regained with `rng.gen_iter().take(n).collect()` * Rng::gen_ascii_str() was removed. This has been replaced with Rng::gen_ascii_chars() which will return an infinite stream of random ascii characters. Similarly to gen_iter(), previous behavior can be emulated with `rng.gen_ascii_chars().take(n).collect()` * {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all relied on being able to use an OSRng for seeding, but this is no longer available in librand (where these types are defined). To retain the same functionality, these types now implement the `Rand` trait so they can be generated with a random seed from another random number generator. This allows the stdlib to use an OSRng to create seeded instances of these RNGs. * Rand implementations for `Box<T>` and `@T` were removed. These seemed to be pretty rare in the codebase, and it allows for librand to not depend on liballoc. Additionally, other pointer types like Rc<T> and Arc<T> were not supported. If this is undesirable, librand can depend on liballoc and regain these implementations. * The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`, but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice structure now has a lifetime associated with it. * The `sample` method on `Rng` has been moved to a top-level function in the `rand` module due to its dependence on `Vec`. cc #13851 [breaking-change]
2014-05-29auto merge of #14481 : alexcrichton/rust/no-format-strbuf, r=sfacklerbors-39/+23
* Removes `format_strbuf!()`
2014-05-28Replace StrAllocating.into_owned() with .into_string()Kevin Ballard-21/+16
We already have into_string(), but it was implemented in terms of into_owned(). Flip it around and deprecate into_owned(). Remove a few spurious calls to .into_owned() that existed in libregex and librustdoc.
2014-05-28auto merge of #14437 : Sawyer47/rust/utf16-items, r=alexcrichtonbors-2/+2
According to Rust's style guide acronyms should be CamelCase.
2014-05-28std: Remove format_strbuf!()Alex Crichton-39/+23
This was only ever a transitionary macro.
2014-05-28auto merge of #14459 : seanmonstar/rust/select-docs, r=alexcrichtonbors-3/+3
2014-05-28Rename UTF16Item[s] to Utf16Item[s]Piotr Jawniak-2/+2
According to Rust's style guide acronyms should be CamelCase. [breaking-change]
2014-05-27Move std::{reflect,repr,Poly} to a libdebug crateAlex Crichton-19/+32
This commit moves reflection (as well as the {:?} format modifier) to a new libdebug crate, all of which is marked experimental. This is a breaking change because it now requires the debug crate to be explicitly linked if the :? format qualifier is used. This means that any code using this feature will have to add `extern crate debug;` to the top of the crate. Any code relying on reflection will also need to do this. Closes #12019 [breaking-change]
2014-05-27auto merge of #14414 : richo/rust/features/nerf_unused_string_fns, ↵bors-302/+306
r=alexcrichton This should block on #14323
2014-05-27doc: Fix link to stringRicho Healey-1/+1
This was missed in 553074506ecd139eb961fb91eb33ad9fd0183acb
2014-05-27std: Rename strbuf operations to stringRicho Healey-187/+187
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-109/+113
2014-05-27std: change select! docs from 'ports' to 'receivers'Sean McArthur-3/+3
2014-05-26std: Remove String::from_owned_str as it's redundantRicho Healey-5/+5
[breaking-change]
2014-05-26Minor fixes to `std::str` docsP1start-11/+12
This tweaks the `std::str` docs to compensate for the recent shift from `~str` to `String`.
2014-05-25auto merge of #14430 : kballard/rust/squelch_os_warning, r=alexcrichtonbors-70/+27
Clean up the re-exports of various modules in `std::std`, and remove the `realstd` stuff from `std::rt::args`.
2014-05-25De-realstd os::argsKevin Ballard-48/+8
With the test runner using ::std::os::args(), and std::std::os now being a re-export of realstd::os, there's no more need for realstd stuff mucking up rt::args. Remove the one test of os::args(), as it's not very useful and it won't work anymore now that rt::args doesn't use realstd.
2014-05-25libstd: Remove unnecessary re-exports under std::stdKevin Ballard-22/+19
2014-05-25auto merge of #14391 : alexcrichton/rust/more-rustdoc-inline, r=huonwbors-48/+55
As part of the libstd facade (cc #13851), rustdoc is taught to inline documentation across crate boundaries through the usage of a `pub use` statement. This is done to allow libstd to maintain the facade that it is a standalone library with a defined public interface (allowing us to shuffle around what's underneath it). A preview is available at http://people.mozilla.org/~acrichton/doc/std/index.html
2014-05-25rustdoc: Move inlining to its own moduleAlex Crichton-55/+55
2014-05-25std: Add doc(noinline) to the prelude reexportsAlex Crichton-42/+49
2014-05-25auto merge of #14415 : Sawyer47/rust/ascii-fixme, r=huonwbors-5/+2
Issue #5475 was closed some time ago, but ascii.rs still contained a FIXME for it.
2014-05-25Fix FIXME #5475 in std::asciiPiotr Jawniak-5/+2
Issue #5475 was closed some time ago, but ascii.rs still contained a FIXME for it.
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-286/+286
[breaking-change]
2014-05-24auto merge of #14402 : huonw/rust/arc-field-rename, r=alexcrichtonbors-7/+9
Paper over privacy issues with Deref by changing field names. Types that implement Deref can cause weird error messages due to their private fields conflicting with a field of the type they deref to, e.g., previously struct Foo { x: int } let a: Arc<Foo> = ...; println!("{}", a.x); would complain the the `x` field of `Arc` was private (since Arc has a private field called `x`) rather than just ignoring it. This patch doesn't fix that issue, but does mean one would have to write `a._ptr` to hit the same error message, which seems far less common. (This patch `_`-prefixes all private fields of `Deref`-implementing types.) cc #12808
2014-05-25Paper over privacy issues with Deref by changing field names.Huon Wilson-7/+9
Types that implement Deref can cause weird error messages due to their private fields conflicting with a field of the type they deref to, e.g., previously struct Foo { x: int } let a: Arc<Foo> = ...; println!("{}", a.x); would complain the the `x` field of `Arc` was private (since Arc has a private field called `x`) rather than just ignoring it. This patch doesn't fix that issue, but does mean one would have to write `a._ptr` to hit the same error message, which seems far less common. (This patch `_`-prefixes all private fields of `Deref`-implementing types.) cc #12808
2014-05-24auto merge of #14401 : aochagavia/rust/pr4, r=alexcrichtonbors-6/+48
Some functions implemented for the Ascii struct have the same functionality as other functions implemented for the normal chars. For consistency, I think they should have the same name, so I renamed the functions in Ascii to match the names in the Char trait. * Renamed `to_lower` to `to_lowercase` * Renamed `to_upper` to `to_uppercase` * Renamed `is_alpha` to `is_alphabetic` * Renamed `is_alnum` to `is_alphanumeric` * Renamed `is_lower` to `is_lowercase` * Renamed `is_upper` to `is_uppercase` [breaking-change]