about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2015-09-05Rollup merge of #28253 - murarth:prelude-typo, r=steveklabnikManish Goregaokar-2/+2
2015-09-05Auto merge of #28242 - Diggsey:msvc-backtrace, r=alexcrichtonbors-4/+31
Currently LLVM does not generate the debug info required to get complete backtraces even when functions are inlined, so that part of the `run-pass/backtrace-debuginfo.rs` test is disabled when targetting MSVC. At worst this results in missing stack frames where functions have been inlined.
2015-09-04Fix typo in prelude docsMurarth-2/+2
2015-09-05Add line numbers to MSVC backtraceDiggory Blake-4/+31
Add comments
2015-09-04Auto merge of #28069 - alexcrichton:rt-atexit, r=brsonbors-17/+9
This adds a call to `rt::cleanup` on `process::exit` to make sure we clean up after ourselves on the way out from Rust. Closes #28065
2015-09-04Auto merge of #28034 - alexcrichton:new-lines, r=aturonbors-4/+7
This commit is an implementation of [RFC 1212][rfc] which tweaks the behavior of the `str::lines` and `BufRead::lines` iterators. Both iterators now account for `\r\n` sequences in addition to `\n`, allowing for less surprising behavior across platforms (especially in the `BufRead` case). Splitting *only* on the `\n` character can still be achieved with `split('\n')` in both cases. The `str::lines_any` function is also now deprecated as `str::lines` is a drop-in replacement for it. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1212-line-endings.md Closes #28032
2015-09-03std: Account for CRLF in {str, BufRead}::linesAlex Crichton-4/+7
This commit is an implementation of [RFC 1212][rfc] which tweaks the behavior of the `str::lines` and `BufRead::lines` iterators. Both iterators now account for `\r\n` sequences in addition to `\n`, allowing for less surprising behavior across platforms (especially in the `BufRead` case). Splitting *only* on the `\n` character can still be achieved with `split('\n')` in both cases. The `str::lines_any` function is also now deprecated as `str::lines` is a drop-in replacement for it. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1212-line-endings.md Closes #28032
2015-09-04Add line numbers to windows-gnu backtracesDiggory Blake-77/+155
Fix formatting Remove unused imports Refactor Fix msvc build Fix line lengths Formatting Enable backtrace tests Fix using directive on mac pwd info Work-around buildbot PWD bug, and fix libbacktrace configuration Use alternative to `env -u` which is not supported on bitrig Disable tests on 32-bit windows gnu
2015-09-04Add ptr import (fixup #28187)Manish Goregaokar-1/+1
2015-09-03Use `null()`/`null_mut()` instead of `0 as *const T`/`0 as *mut T`Vadim Petrochenkov-37/+48
2015-09-02std: Run at_exit cleanup on process::exitAlex Crichton-17/+9
This adds a call to `rt::cleanup` on `process::exit` to make sure we clean up after ourselves on the way out from Rust. Closes #28065
2015-09-02Fix compile on DragonFly: Replace unknown uint32_t/in64_t by u32/i64.Michael Neumann-4/+4
2015-09-01Auto merge of #28130 - alexcrichton:fix-msvc-static-tls-dtor, r=brsonbors-9/+29
Running TLS destructors for a MSVC Windows binary requires the linker doesn't elide the `_tls_used` or `__tls_used` symbols (depending on the architecture). This is currently achieved via a `#[link_args]` hack but this only works for dynamically linked binaries because the link arguments aren't propagated to statically linked binaries. This commit alters the strategy to instead emit a volatile load from those symbols so LLVM can't elide it, forcing the reference to the symbol to stay alive as long as the callback function stays alive (which we've made sure of with the `#[linkage]` attribute). Closes #28111
2015-09-01std: Run TLS destructors in a statically linked binaryAlex Crichton-9/+29
Running TLS destructors for a MSVC Windows binary requires the linker doesn't elide the `_tls_used` or `__tls_used` symbols (depending on the architecture). This is currently achieved via a `#[link_args]` hack but this only works for dynamically linked binaries because the link arguments aren't propagated to statically linked binaries. This commit alters the strategy to instead emit a volatile load from those symbols so LLVM can't elide it, forcing the reference to the symbol to stay alive as long as the callback function stays alive (which we've made sure of with the `#[linkage]` attribute). Closes #28111
2015-09-01Auto merge of #28094 - apasel422:extend-hashmap, r=alexcrichtonbors-0/+62
It appears that these impls were left out of #25989 by mistake. r? @alexcrichton I'm not sure what the stability markers for these should be.
2015-08-31Implement RFC 839 for `{HashMap, HashSet}`Andrew Paseltiner-0/+62
It appears that these impls were left out of #25989 by mistake.
2015-08-30Atomically set CLOEXEC on duplicated socketsTobias Bucher-5/+25
For Bitrig, NetBSD and OpenBSD the constant was incorrectly in posix01, when it's actually posix08, so we move it. This is a [breaking-change], but we already had one in #27930. Fix NetBSD's F_DUPFD_CLOEXEC constant. For a similar feature detection, see this musl thread: http://comments.gmane.org/gmane.linux.lib.musl.general/2963 This assumes that an int literal has type `c_int` for varidic functions.
2015-08-30Auto merge of #27588 - cesarb:read_all, r=alexcrichtonbors-0/+140
This implements the proposed "read_exact" RFC (https://github.com/rust-lang/rfcs/pull/980). Tracking issue: https://github.com/rust-lang/rust/issues/27585
2015-08-29Auto merge of #28043 - apasel422:rfc-1194, r=alexcrichtonbors-4/+105
2015-08-28implement RFC 1194Andrew Paseltiner-4/+105
2015-08-28Auto merge of #28047 - steveklabnik:doc_print, r=alexcrichtonbors-0/+20
2015-08-28Add issue number to read_exact unstable declarationsCesar Eduardo Barros-2/+2
2015-08-28Auto merge of #28054 - zaeleus:ios-imports, r=alexcrichtonbors-4/+1
This fixes building for ios targets caused by 7925c79.
2015-08-28Auto merge of #28038 - durka:grep-unstable-issue-refs, r=alexcrichtonbors-1/+1
After submitting #28031, I ran a [script](https://gist.github.com/durka/a5243440697c780f669b) on the rest of src/ and found some anomalies. In this PR are the fixes that I thought were obvious (but I might be wrong!). The others I've submitted in issue #28037.
2015-08-27std: Fix backtrace imports for ios targetsMichael Macias-4/+1
This fixes building for ios targets caused by 7925c79.
2015-08-27Auto merge of #28052 - Manishearth:rollup, r=Manishearthbors-2/+5
- Successful merges: #28010, #28013, #28022, #28029, #28033, #28039, #28045, #28048 - Failed merges:
2015-08-27Add some examples for the print! macroSteve Klabnik-0/+20
2015-08-28Rollup merge of #28029 - tshepang:unusual, r=steveklabnikManish Goregaokar-2/+5
2015-08-27Auto merge of #27930 - barosl:path_max, r=alexcrichtonbors-20/+37
This PR rewrites the code that previously relied on `PATH_MAX`. On my tests, even though the user gives the buffer length explicitly, both Linux's glibc and OS X's libc seems to obey the hard limit of `PATH_MAX` internally. So, to truly remove the limitation of `PATH_MAX`, the related system calls should be rewritten from scratch in Rust, which this PR does not try to do. However, eliminating the need of `PATH_MAX` is still a good idea for various reasons, such as: (1) they might change the implementation in the future, and (2) some platforms don't have a hard-coded `PATH_MAX`, such as GNU Hurd. More details are in the commit messages. Fixes #27454. r? @alexcrichton
2015-08-28Use a different buffer doubling logic for `std::sys::os::getcwd`Barosl Lee-5/+7
Make `std::sys::os::getcwd` call `Vec::reserve(1)` followed by `Vec::set_len` to double the buffer. This is to align with other similar functions, such as: - `std::sys_common::io::read_to_end_uninitialized` - `std::sys::fs::readlink` Also, reduce the initial buffer size from 2048 to 512. The previous size was introduced with 4bc26ce in 2013, but it seems a bit excessive. This is probably because buffer doubling was not implemented back then.
2015-08-28Reduce the reliance on `PATH_MAX`Barosl Lee-15/+30
- Rewrite `std::sys::fs::readlink` not to rely on `PATH_MAX` It currently has the following problems: 1. It uses `_PC_NAME_MAX` to query the maximum length of a file path in the underlying system. However, the meaning of the constant is the maximum length of *a path component*, not a full path. The correct constant should be `_PC_PATH_MAX`. 2. `pathconf` *may* fail if the referred file does not exist. This can be problematic if the file which the symbolic link points to does not exist, but the link itself does exist. In this case, the current implementation resorts to the hard-coded value of `1024`, which is not ideal. 3. There may exist a platform where there is no limit on file path lengths in general. That's the reaon why GNU Hurd doesn't define `PATH_MAX` at all, in addition to having `pathconf` always returning `-1`. In these platforms, the content of the symbolic link can be silently truncated if the length exceeds the hard-coded limit mentioned above. 4. The value obtained by `pathconf` may be outdated at the point of actually calling `readlink`. This is inherently racy. This commit introduces a loop that gradually increases the length of the buffer passed to `readlink`, eliminating the need of `pathconf`. - Remove the arbitrary memory limit of `std::sys::fs::realpath` As per POSIX 2013, `realpath` will return a malloc'ed buffer if the second argument is a null pointer.[1] [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html - Comment on functions that are still using `PATH_MAX` There are some functions that only work in terms of `PATH_MAX`, such as `F_GETPATH` in OS X. Comments on them for posterity.
2015-08-27Auto merge of #28030 - tshepang:improve-example, r=alexcrichtonbors-2/+4
2015-08-27fix some more unstable issue annotationsAlex Burka-1/+1
2015-08-27Auto merge of #27975 - sfackler:iter-order-methods, r=aturonbors-8/+8
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737 r? @alexcrichton
2015-08-26Make iter::order functions into methods on IteratorSteven Fackler-8/+8
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737
2015-08-27Auto merge of #27808 - SimonSapin:utf16decoder, r=alexcrichtonbors-6/+6
* Rename `Utf16Items` to `Utf16Decoder`. "Items" is meaningless. * Generalize it to any `u16` iterator, not just `[u16].iter()` * Make it yield `Result` instead of a custom `Utf16Item` enum that was isomorphic to `Result`. This enable using the `FromIterator for Result` impl. * Replace `Utf16Item::to_char_lossy` with a `Utf16Decoder::lossy` iterator adaptor. This is a [breaking change], but only for users of the unstable `rustc_unicode` crate. I’d like this functionality to be stabilized and re-exported in `std` eventually, as the "low-level equivalent" of `String::from_utf16` and `String::from_utf16_lossy` like #27784 is the low-level equivalent of #27714. CC @aturon, @alexcrichton
2015-08-26doc: improve as_path exampleTshepang Lekhonkhobe-2/+4
2015-08-26path: the if-else block looked unusualTshepang Lekhonkhobe-2/+5
2015-08-26Auto merge of #27998 - birkenfeld:patch-1, r=alexcrichtonbors-28/+6
These have been removed and should not be documented here. Should the replacement crates on crates.io be linked to, or is that not wanted in the core docs?
2015-08-25Auto merge of #27995 - nagisa:windows-error-message, r=alexcrichtonbors-3/+2
According to https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx: > If the function succeeds, the return value is the number of TCHARs stored in the output buffer, > excluding the terminating null character. _**Completely untested**_… since I have no Windows machine or anything of a sort to test this on. r? @aturon
2015-08-25collections doc: remove mention of BitVec, BitSet, VecMapGeorg Brandl-28/+6
These have been removed and should not be documented here.
2015-08-25Do not recalculate string length in error_stringSimonas Kazlauskas-3/+2
According to https://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx: > If the function succeeds, the return value is the number of TCHARs stored in the output buffer, > excluding the terminating null character.
2015-08-25Auto merge of #27971 - tbu-:pr_cloexec, r=alexcrichtonbors-1/+4
On Linux the flag is just ignored if it is not supported: https://lwn.net/Articles/588444/ Still needs the values of O_CLOEXEC on the BSDs. Touches #24237.
2015-08-25Auto merge of #27966 - GuillaumeGomez:iterator, r=alexcrichtonbors-0/+3
Part of #22709. cc @Veedrac r? @bluss I don't have added tests yet, I'll see how to do it tomorrow.
2015-08-25Auto merge of #27957 - overminder:aug23-i686-android, r=alexcrichtonbors-1/+2
- All the libstd tests are passing in the optimized build against a Zenfone2 and the x86 Android emulator. I haven't tested the other libraries though.
2015-08-24Implement read_exact for the Read traitCesar Eduardo Barros-0/+140
This implements the proposed "read_exact" RFC (https://github.com/rust-lang/rfcs/pull/980).
2015-08-24Atomically open files with O_CLOEXEC where possibleTobias Bucher-1/+4
On Linux the flag is just ignored if it is not supported: https://lwn.net/Articles/588444/ Touches #24237.
2015-08-24Add stability markers for new implsSteven Fackler-0/+2
2015-08-23Implement Error for AddrParseErrorSteven Fackler-1/+15
Closes #27973
2015-08-23Add Send/Sync traits on LookupHost structGuillaume Gomez-0/+3