summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2015-11-23std: Tweak tests of std::timeAlex Crichton-14/+24
Typical algebra currently doesn't work on the types in std::time currently (see [this comment][comment]), so tweak the tests to account for this property. [comment]: https://github.com/rust-lang/rust/issues/29866#issuecomment-159093809 Closes #29970
2015-11-23Auto merge of #29952 - petrochenkov:depr, r=brsonbors-13/+16
Part of https://github.com/rust-lang/rust/issues/29935 The deprecation lint is still called "deprecated", so people can continue using `#[allow(deprecated)]` and similar things.
2015-11-23skip check for DYLD envars in child procJosh Austin-0/+1
2015-11-22test_inherit_env: Don't look for hidden environment variables on WindowsTobias Bucher-2/+4
Fixes #29972.
2015-11-21Auto merge of #29913 - tbu-:pr_windows_path_error_on_nul, r=alexcrichtonbors-30/+37
On Windows: Previously these paths were silently truncated at these NUL characters, now they fail with `ErrorKind::InvalidInput`.
2015-11-21Also check for NULs in environment variablesTobias Bucher-18/+20
This check is necessary, because the underlying API only reads strings until the first NUL.
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-13/+16
2015-11-20Auto merge of #29950 - fhahn:small-doc-fix-rename-var, r=blussbors-4/+4
This tiny PR renames the result variable in HashSet's `intersection` example from `diff` to `intersection` and the same for `union`, which seem more appropriate.
2015-11-20Rename result variable in HashSet's intersection and union examplesFlorian Hahn-4/+4
2015-11-19Auto merge of #29894 - alexcrichton:stdtime, r=brsonbors-102/+816
This commit is an implementation of [RFC 1288][rfc] which adds two new unstable types to the `std::time` module. The `Instant` type is used to represent measurements of a monotonically increasing clock suitable for measuring time withing a process for operations such as benchmarks or just the elapsed time to do something. An `Instant` favors panicking when bugs are found as the bugs are programmer errors rather than typical errors that can be encountered. [rfc]: https://github.com/rust-lang/rfcs/pull/1288 The `SystemTime` type is used to represent a system timestamp and is not monotonic. Very few guarantees are provided about this measurement of the system clock, but a fixed point in time (`UNIX_EPOCH`) is provided to learn about the relative distance from this point for any particular time stamp. This PR takes the same implementation strategy as the `time` crate on crates.io, namely: | Platform | Instant | SystemTime | |------------|--------------------------|--------------------------| | Windows | QueryPerformanceCounter | GetSystemTimeAsFileTime | | OSX | mach_absolute_time | gettimeofday | | Unix | CLOCK_MONOTONIC | CLOCK_REALTIME | These implementations can perhaps be refined over time, but they currently satisfy the requirements of the `Instant` and `SystemTime` types while also being portable across implementations and revisions of each platform. cc #29866
2015-11-19Error when paths contain NUL charactersTobias Bucher-19/+24
On Windows: Previously these paths were silently truncated at these NUL characters, now they fail with `ErrorKind::InvalidInput`.
2015-11-19Re-unignore environment test on MinGWTobias Bucher-1/+1
2015-11-19Ignore malformed environment variables on Windows tooTobias Bucher-15/+24
Leading equals symbols are treated as part of the variable name, if there is no other equality symbol or none at all, the environment string is ignored.
2015-11-19std: Add Instant and SystemTime to std::timeAlex Crichton-102/+816
This commit is an implementation of [RFC 1288][rfc] which adds two new unstable types to the `std::time` module. The `Instant` type is used to represent measurements of a monotonically increasing clock suitable for measuring time withing a process for operations such as benchmarks or just the elapsed time to do something. An `Instant` favors panicking when bugs are found as the bugs are programmer errors rather than typical errors that can be encountered. [rfc]: https://github.com/rust-lang/rfcs/pull/1288 The `SystemTime` type is used to represent a system timestamp and is not monotonic. Very few guarantees are provided about this measurement of the system clock, but a fixed point in time (`UNIX_EPOCH`) is provided to learn about the relative distance from this point for any particular time stamp. This PR takes the same implementation strategy as the `time` crate on crates.io, namely: | Platform | Instant | SystemTime | |------------|--------------------------|--------------------------| | Windows | QueryPerformanceCounter | GetSystemTimeAsFileTime | | OSX | mach_absolute_time | gettimeofday | | Unix | CLOCK_MONOTONIC | CLOCK_REALTIME | These implementations can perhaps be refined over time, but they currently satisfy the requirements of the `Instant` and `SystemTime` types while also being portable across implementations and revisions of each platform.
2015-11-18Auto merge of #29083 - petrochenkov:stability3, r=alexcrichtonbors-23/+211
What this patch does: - Stability annotations are now based on "exported items" supplied by rustc_privacy and not "public items". Exported items are as accessible for external crates as directly public items and should be annotated with stability attributes. - Trait impls require annotations now. - Reexports require annotations now. - Crates themselves didn't require annotations, now they do. - Exported macros are annotated now, but these annotations are not used yet. - Some useless annotations are detected and result in errors - Finally, some small bugs are fixed - deprecation propagates from stable deprecated parents, items in blocks are traversed correctly (fixes https://github.com/rust-lang/rust/issues/29034) + some code cleanup.
2015-11-18Fix buildbot failuresVadim Petrochenkov-9/+23
2015-11-18Auto merge of #29897 - alexcrichton:process-wait-with-output, r=brsonbors-20/+14
Previously this function used channels but this isn't necessary any more now that threads have return values. This also has the added bonus of appropriately waiting for the thread to exit to ensure that the function doesn't still have running threads once it returns.
2015-11-18Add missing annotations and some testsVadim Petrochenkov-14/+188
2015-11-17std: Use join() in Process::wait_with_outputAlex Crichton-20/+14
Previously this function used channels but this isn't necessary any more now that threads have return values. This also has the added bonus of appropriately waiting for the thread to exit to ensure that the function doesn't still have running threads once it returns.
2015-11-17Rollup merge of #29880 - dignati:fix-freebsd-libc, r=alexcrichtonManish Goregaokar-11/+9
With this change the build on FreeBSD is almost working again.
2015-11-17Fix libc module name for FreeBSDOle Krüger-11/+9
2015-11-17Auto merge of #29297 - tbu-:pr_env_ignore_malformed, r=alexcrichtonbors-8/+17
Otherwise, the iterator and the functions for getting specific environment variables might disagree, for environments like FOOBAR
2015-11-16Ignore malformed environment strings like glibc doesTobias Bucher-8/+17
Otherwise, the iterator and the functions for getting specific environment variables might disagree, for environments like FOOBAR Variable names starting with equals sign are OK: glibc only interprets equals signs not in the first position as separators between variable name and variable value. Instead of skipping them entirely, a leading equals sign is interpreted to be part of the variable name.
2015-11-16Correct comment in `Mutex` exampleAndrew Paseltiner-1/+1
2015-11-16Auto merge of #29830 - petrochenkov:mapdoc, r=alexcrichtonbors-2/+3
r? @steveklabnik
2015-11-16Fix docs for HashSet::insertSebastian Hahn-4/+1
insert() returns bool, but it was wrongly stated that if the set had the key already present, that key would be returned (this was probably copied from the HashMap docs). Also remove a reference to the module-level documentation, which doesn't make sense as it doesn't give any more context.
2015-11-14docs: Clarify insertion behavior for mapsVadim Petrochenkov-2/+3
2015-11-12Fixup #29785Manish Goregaokar-1/+1
2015-11-12Rollup merge of #29785 - steveklabnik:doc_prelude, r=nikomatsakisManish Goregaokar-96/+115
This mostly brings them in line with existing linking convention, but also has some minor re-wording. The text at the top has been re-focused, by starting out with what the prelude does, rather than starting from injecting std. Also, it now mentions that other preludes exist. Part of https://github.com/rust-lang/rust/issues/29369
2015-11-11Clean up the prelude docsSteve Klabnik-96/+115
This mostly brings them in line with existing linking convention, but also has some minor re-wording. The text at the top has been re-focused, by starting out with what the prelude does, rather than starting from injecting std. Also, it now mentions that other preludes exist. Part of https://github.com/rust-lang/rust/issues/29369
2015-11-11Cleaner c_char cfg logicarcnmx-11/+10
2015-11-11Prefer raw::c_char or libc::c_char and fix armarcnmx-39/+36
2015-11-11Auto merge of #29755 - mbrubeck:stat-doc, r=steveklabnikbors-2/+4
Moved from #29753. r? @steveklabnik
2015-11-10Auto merge of #29724 - alexcrichton:ip-endian, r=aturonbors-2/+9
The comparison of IP addresses should happen not always in network endianness but rather in the host endianness format, so be sure to convert to that before comparing addresses. There are still locations where the endianness will factor into visible properties, such as the hash, but these are not important to be independent of the endianness in play (as hash values are pretty undefined anyway. Closes #29691
2015-11-10[docs] Update references to renamed fs::stat functionMatt Brubeck-2/+4
2015-11-10Rollup merge of #29708 - Ryman:pathdoc, r=steveklabnikSteve Klabnik-0/+15
r? @steveklabnik
2015-11-09std: Migrate to the new libcAlex Crichton-2339/+1755
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself * Update all references to use `libc` as a result. * Update all references to the new flat namespace. * Moves all windows bindings into sys::c
2015-11-09std: Fix endianness in Ord for IP addressesAlex Crichton-2/+9
The comparison of IP addresses should happen not always in network endianness but rather in the host endianness format, so be sure to convert to that before comparing addresses. There are still locations where the endianness will factor into visible properties, such as the hash, but these are not important to be independent of the endianness in play (as hash values are pretty undefined anyway. Closes #29691
2015-11-09libstd: add example for PathBuf::pushKevin Butler-0/+15
2015-11-08Spell out the fallback of `std::env::home_dir` on POSIXTobias Bucher-1/+3
2015-11-07Update list of array implementations in src/libstd/primitive_docs.rsOliver Middleton-1/+3
2015-11-06Auto merge of #29462 - alexcrichton:refactor-process-ret, r=aturonbors-64/+57
* Store the native representation directly in the `ExitStatus` structure instead of a "parsed version" (mostly for Unix). * On Windows, be more robust against processes exiting with the status of 259. Unfortunately this exit code corresponds to `STILL_ACTIVE`, causing libstd to think the process was still alive, causing an infinite loop. Instead the loop is removed altogether and `WaitForSingleObject` is used to wait for the process to exit.
2015-11-06std: Refactor process exit code handling slightlyAlex Crichton-64/+57
* Store the native representation directly in the `ExitStatus` structure instead of a "parsed version" (mostly for Unix). * On Windows, be more robust against processes exiting with the status of 259. Unfortunately this exit code corresponds to `STILL_ACTIVE`, causing libstd to think the process was still alive, causing an infinite loop. Instead the loop is removed altogether and `WaitForSingleObject` is used to wait for the process to exit.
2015-11-06Auto merge of #29643 - petrochenkov:stability5, r=alexcrichtonbors-5/+0
Also remove `stable` stability annotations from inherent impls (There will be a warning for useless stability annotations soon.) r? @Gankro
2015-11-06Auto merge of #29615 - steveklabnik:lol_strings, r=alexcrichtonbors-1/+1
&format!("...") is the same as "" if we're not doing any interpolation, and doesn't allocate an intermediate String.
2015-11-06Auto merge of #29604 - bstrie:de_ms, r=alexcrichtonbors-0/+5
2015-11-06Auto merge of #29491 - alexcrichton:avoid-stdio-tls, r=brsonbors-8/+26
Currently if a print happens while a thread is being torn down it may cause a panic if the LOCAL_STDOUT TLS slot has been destroyed by that point. This adds a guard to check and prints to the process stdout if that's the case (as we do for if the slot is already borrowed). Closes #29488
2015-11-06Auto merge of #29305 - alexcrichton:bad-getenv, r=brsonbors-56/+62
As discovered in #29298, `env::set_var("", "")` will panic, but it turns out that it *also* deadlocks on Unix systems. This happens because if a panic happens while holding the environment lock, we then go try to read RUST_BACKTRACE, grabbing the environment lock, causing a deadlock. Specifically, the changes made here are: * The environment lock is pushed into `std::sys` instead of `std::env`. This also only puts it in the Unix implementation, not Windows where the functions are already threadsafe. * The `std::sys` implementation now returns `io::Result` so panics are explicitly at the `std::env` level.
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-5/+0
Remove `stable` stability annotations from inherent impls
2015-11-06doc(lib.rs): fix #L79 with inline link syntaxRizky Luthfianto-2/+1