about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-08-13std: Add comments to the time moduleBrian Anderson-1/+16
2014-08-13std: Add sleep, oneshot and periodic timers, taking DurationBrian Anderson-0/+97
2014-08-13std: Rename sleep, periodic, and oneshot timers to sleep_ms, etc.Brian Anderson-57/+58
Rename io::timer::sleep, Timer::sleep, Timer::oneshot, Timer::periodic, to sleep_ms, oneshot_ms, periodic_ms. These functions all take an integer and interpret it as milliseconds. Replacement functions will be added that take Duration. [breaking-change]
2014-08-13std: Add a Duration typeBrian Anderson-0/+417
Taken from rust-chrono[1]. Needed for timers per #11189. Experimental. [1]: https://github.com/lifthrasiir/rust-chrono
2014-08-13core: Rename ImmutableEqSlice to ImmutablePartialEqSliceBrian Anderson-5/+5
This is in the prelude and won't break much code. [breaking-change]
2014-08-13std: Rename slice::Vector to SliceBrian Anderson-13/+13
This required some contortions because importing both raw::Slice and slice::Slice makes rustc crash. Since `Slice` is in the prelude, this renaming is unlikely to casue breakage. [breaking-change]
2014-08-13std: Rename various slice traits for consistencyBrian Anderson-39/+39
ImmutableVector -> ImmutableSlice ImmutableEqVector -> ImmutableEqSlice ImmutableOrdVector -> ImmutableOrdSlice MutableVector -> MutableSlice MutableVectorAllocating -> MutableSliceAllocating MutableCloneableVector -> MutableCloneableSlice MutableOrdVector -> MutableOrdSlice These are all in the prelude so most code will not break. [breaking-change]
2014-08-12libnative: process spawning should not close inherited file descriptorsIvan Petkov-1/+24
* The caller should be responsible for cleaning up file descriptors * If a caller safely creates a file descriptor (via native::io::file::open) the returned structure (FileDesc) will try to clean up the file, failing in the process and writing error messages to the screen. * This should not happen as the caller has no public interface for telling the FileDesc structure to NOT free the underlying fd. * Alternatively, if another file is opened under the same fd held by the FileDesc structure returned by native::io::file::open, it will close the wrong file upon destruction.
2014-08-12Replace #[cfg(target_os = "win32")] with #[cfg(target_os = "windows")]Vadim Chugunov-3/+5
2014-08-12auto merge of #16195 : P1start/rust/more-index, r=aturonbors-6/+48
Implement `Index` for `RingBuf`, `HashMap`, `TreeMap`, `SmallIntMap`, and `TrieMap`. If there’s anything that I missed or should be removed, let me know.
2014-08-12Implement Index for HashMapP1start-6/+48
This also deprecates HashMap::get. Use indexing instead.
2014-08-11core/std: squash dead_code warnings from fail! invocations.Huon Wilson-6/+11
The fail macro defines some function/static items internally, which got a dead_code warning when `fail!()` is used inside a dead function. This is ugly and unnecessarily reveals implementation details, so the warnings can be squashed. Fixes #16192.
2014-08-09auto merge of #15964 : huonw/rust/gensym-test, r=alexcrichtonbors-5/+3
This requires avoiding `quote_...!` for constructing the parts of the __test module, since that stringifies and reinterns the idents, losing the special gensym'd nature of them. (#15962.)
2014-08-09testsuite: implement #[reexport_test_harness_name] to get access to theHuon Wilson-5/+3
default entrypoint of the --test binary. This allows one to, e.g., run tests under libgreen by starting it manually, passing in the test entrypoint.
2014-08-08Remove the dist function; it is more efficient to compare squared distancesnham-5/+1
2014-08-08auto merge of #16336 : retep998/rust/master, r=brsonbors-4/+5
Several of the tests in `make check-fast` were failing so this fixes those tests.
2014-08-08Add example of estimating pi using Monte Carlo simulation to std::randnham-0/+45
2014-08-08auto merge of #16327 : mdinger/rust/typo, r=steveklabnikbors-1/+1
Fix typo. It's possible it's `These modules` but I think it's supposed to be singular because it's not refering to nested modules.
2014-08-08Register new snapshot 12e0f72Niko Matsakis-37/+0
2014-08-08auto merge of #16285 : alexcrichton/rust/rename-share, r=huonwbors-1/+1
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use` statement, but the `NoShare` struct is no longer part of `std::kinds::marker` due to #12660 (the build cannot bootstrap otherwise). All code referencing the `Share` trait should now reference the `Sync` trait, and all code referencing the `NoShare` type should now reference the `NoSync` type. The functionality and meaning of this trait have not changed, only the naming. Closes #16281 [breaking-change]
2014-08-07Fix typomdinger-1/+1
2014-08-07Rename `Share` to `Sync`Alex Crichton-1/+1
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use` statement, but the `NoShare` struct is no longer part of `std::kinds::marker` due to #12660 (the build cannot bootstrap otherwise). All code referencing the `Share` trait should now reference the `Sync` trait, and all code referencing the `NoShare` type should now reference the `NoSync` type. The functionality and meaning of this trait have not changed, only the naming. Closes #16281 [breaking-change]
2014-08-07windows: Fix several tests on 64-bit.Peter Atashian-4/+5
Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-07auto merge of #16220 : tshepang/rust/temp, r=steveklabnikbors-1/+1
2014-08-06auto merge of #16291 : nham/rust/byte_literals, r=alexcrichtonbors-54/+52
This replaces many instances chars being casted to u8 with byte literals.
2014-08-06Merge commit '881bfb1a180a1b545daa9da1539ec4c8ebda7ed1' into rollupAlex Crichton-2/+3
2014-08-06auto merge of #16258 : aturon/rust/stabilize-atomics, r=alexcrichtonbors-14/+20
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
2014-08-06Use byte literals in libstdnham-54/+52
2014-08-05auto merge of #16243 : alexcrichton/rust/fix-utime-for-windows, r=brsonbors-6/+4
Apparently the units are in milliseconds, not in seconds!
2014-08-04Fix crash in OsRng when compiling with -O.Vadim Chugunov-2/+3
2014-08-04stabilize atomics (now atomic)Aaron Turon-14/+20
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
2014-08-04rustc: Link entire archives of native librariesAlex Crichton-0/+4
As discovered in #15460, a particular #[link(kind = "static", ...)] line is not actually guaranteed to link the library at all. The reason for this is that if the external library doesn't have any referenced symbols in the object generated by rustc, the entire library is dropped by the linker. For dynamic native libraries, this is solved by passing -lfoo for all downstream compilations unconditionally. For static libraries in rlibs this is solved because the entire archive is bundled in the rlib. The only situation in which this was a problem was when a static native library was linked to a rust dynamic library. This commit brings the behavior of dylibs in line with rlibs by passing the --whole-archive flag to the linker when linking native libraries. On OSX, this uses the -force_load flag. This flag ensures that the entire archive is considered candidate for being linked into the final dynamic library. This is a breaking change because if any static library is included twice in the same compilation unit then the linker will start emitting errors about duplicate definitions now. The fix for this would involve only statically linking to a library once. Closes #15460 [breaking-change]
2014-08-03doc: make the sentence make more senseTshepang Lekhonkhobe-1/+1
2014-08-02native: Fix utime() for windowsAlex Crichton-6/+4
Apparently the units are in milliseconds, not in seconds!
2014-08-01Fix misspelled comments.Joseph Crail-3/+3
2014-08-01auto merge of #16102 : zwarich/rust/borrowck-unboxed, r=pcwaltonbors-1/+2
This removes the ability of the borrow checker to determine that repeated dereferences of a Box<T> refer to the same memory object.
2014-08-01auto merge of #16141 : alexcrichton/rust/rollup, r=alexcrichtonbors-7/+407
2014-07-31auto merge of #15399 : kballard/rust/rewrite_local_data, r=alexcrichtonbors-4/+4
This was motivated by a desire to remove allocation in the common pattern of let old = key.replace(None) do_something(); key.replace(old); This also switched the map representation from a Vec to a TreeMap. A Vec may be reasonable if there's only a couple TLD keys, but a TreeMap provides better behavior as the number of keys increases. Like the Vec, this TreeMap implementation does not shrink the container when a value is removed. Unlike Vec, this TreeMap implementation cannot reuse an empty node for a different key. Therefore any key that has been inserted into the TLD at least once will continue to take up space in the Map until the task ends. The expectation is that the majority of keys that are inserted into TLD will be expected to have a value for most of the rest of the task's lifetime. If this assumption is wrong, there are two reasonable ways to fix this that could be implemented in the future: 1. Provide an API call to either remove a specific key from the TLD and destruct its node (e.g. `remove()`), or instead to explicitly clean up all currently-empty nodes in the map (e.g. `compact()`). This is simple, but requires the user to explicitly call it. 2. Keep track of the number of empty nodes in the map and when the map is mutated (via `replace()`), if the number of empty nodes passes some threshold, compact it automatically. Alternatively, whenever a new key is inserted that hasn't been used before, compact the map at that point. --- Benchmarks: I ran 3 benchmarks. tld_replace_none just replaces the tld key with None repeatedly. tld_replace_some replaces it with Some repeatedly. And tld_replace_none_some simulates the common behavior of replacing with None, then replacing with the previous value again (which was a Some). Old implementation: test tld_replace_none ... bench: 20 ns/iter (+/- 0) test tld_replace_none_some ... bench: 77 ns/iter (+/- 4) test tld_replace_some ... bench: 57 ns/iter (+/- 2) New implementation: test tld_replace_none ... bench: 11 ns/iter (+/- 0) test tld_replace_none_some ... bench: 23 ns/iter (+/- 0) test tld_replace_some ... bench: 12 ns/iter (+/- 0)
2014-07-31Tweak error reporting in io::net::tcp testsKevin Ballard-4/+4
Errors can be printed with {}, printing with {:?} does not work very well. Not actually related to this PR, but it came up when running the tests and now is as good a time to fix it as any.
2014-07-31auto merge of #16041 : treeman/rust/doc-rand, r=brsonbors-64/+163
A larger example for `std::rand`.
2014-07-31Implement slice::Vector for Option<T> and CVec<T>Derek Harland-7/+10
2014-07-31Add logic to skip the doc tests on windows since these examples are ↵nham-0/+124
unix-specific
2014-07-31Use byte strings throughout examples. Add an example that was missed in the ↵nham-7/+14
last commit.
2014-07-31Add examples for GenericPath methods.nham-0/+233
2014-07-31auto merge of #16073 : mneumann/rust/dragonfly2, r=alexcrichtonbors-1/+55
Not included are two required patches: * LLVM: segmented stack support for DragonFly [1] * jemalloc: simple configure patches [1]: http://reviews.llvm.org/D4705
2014-07-31rustrt: Make begin_unwind take a single file/line pointerBrian Anderson-0/+33
Smaller text size.
2014-07-31auto merge of #16074 : nham/rust/bitflags_traits, r=alexcrichtonbors-2/+46
I wanted to add an implementation of `Default` inside the bitflags macro, but `Default` isn't in the prelude, which means anyone who wants to use `bitflags!` needs to import it. This seems not nice, so I've just implemented for `FilePermission` instead.
2014-07-31Fix trailing whitespaceMichael Neumann-2/+2
2014-07-30Library changes for RFC #43Cameron Zwarich-1/+2
2014-07-30Implement Default for std::io::FilePermissionnham-0/+6