about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2015-09-20Auto merge of #28499 - semmaz:doc-anchor-fix, r=steveklabnikbors-1/+1
This changes how rustic generate `id` and `href` attributes for section header anchor. Now they are more github-like. Also fixes breakage in docs caused by this and broken links in "Error Handling" section of book. r? @steveklabnik cc @alexcrichton
2015-09-20Miscellaneous cleanup for old issues.Lee Jeffery-55/+23
2015-09-20doc: Fix broken linksSimon Mazur-1/+1
2015-09-19added panic docs for print\! and println\! macrosllogiq-0/+8
2015-09-14Auto merge of #28256 - petrochenkov:conv, r=alexcrichtonbors-27/+96
This patch transforms functions of the form ``` fn f<Generic: AsRef<Concrete>>(arg: Generic) { let arg: &Concrete = arg.as_ref(); // Code using arg } ``` to the next form: ``` #[inline] fn f<Generic: AsRef<Concrete>>(arg: Generic) { fn f_inner(arg: &Concrete) { // Code using arg } f_inner(arg.as_ref()); } ``` Therefore, most of the code is concrete and not duplicated during monomorphisation (unless inlined) and only the tiny bit of conversion code is duplicated. This method was mentioned by @aturon in the Conversion Traits RFC (https://github.com/rust-lang/rfcs/blame/master/text/0529-conversion-traits.md#L249) and similar techniques are not uncommon in C++ template libraries. This patch goes to the extremes and applies the transformation even to smaller functions<sup>1</sup> for purity of the experiment. *Some of them can be rolled back* if considered too ridiculous. <sup>1</sup> However who knows how small are these functions are after inlining and everything. The functions in question are mostly `fs`/`os` functions and not used especially often with variety of argument types, so the code size reduction is rather small (but consistent). Here are the sizes of stage2 artifacts before and after the patch: https://gist.github.com/petrochenkov/e76a6b280f382da13c5d https://gist.github.com/petrochenkov/6cc28727d5256dbdfed0 Note: All the `inner` functions are concrete and unavailable for cross-crate inlining, some of them may need `#[inline]` annotations in the future. r? @aturon
2015-09-14Drop upper bounds on net timeout testsSteven Fackler-4/+0
Windows's scheduler apparently has "problems" unblocking calls in the asked for time period.
2015-09-14Auto merge of #28358 - dotdash:nounwind, r=alexcrichtonbors-0/+7
This allows to skip the codegen for all the unneeded landing pads, reducing code size across the board by about 2-5%, depending on the crate. Compile times seem to be pretty unaffected though :-/
2015-09-14Mark all extern functions as nounwindBjörn Steinbrink-0/+7
Unwinding across an FFI boundary is undefined behaviour, so we can mark all external function as nounwind. The obvious exception are those functions that actually perform the unwinding.
2015-09-13Auto merge of #28339 - alexcrichton:stabilize-1.4, r=aturonbors-40/+59
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the libs team decision for all library features this cycle. Stabilized APIs: * `<Box<str>>::into_string` * `Arc::downgrade` * `Arc::get_mut` * `Arc::make_mut` * `Arc::try_unwrap` * `Box::from_raw` * `Box::into_raw` * `CStr::to_str` * `CStr::to_string_lossy` * `CString::from_raw` * `CString::into_raw` * `IntoRawFd::into_raw_fd` * `IntoRawFd` * `IntoRawHandle::into_raw_handle` * `IntoRawHandle` * `IntoRawSocket::into_raw_socket` * `IntoRawSocket` * `Rc::downgrade` * `Rc::get_mut` * `Rc::make_mut` * `Rc::try_unwrap` * `Result::expect` * `String::into_boxed_slice` * `TcpSocket::read_timeout` * `TcpSocket::set_read_timeout` * `TcpSocket::set_write_timeout` * `TcpSocket::write_timeout` * `UdpSocket::read_timeout` * `UdpSocket::set_read_timeout` * `UdpSocket::set_write_timeout` * `UdpSocket::write_timeout` * `Vec::append` * `Vec::split_off` * `VecDeque::append` * `VecDeque::retain` * `VecDeque::split_off` * `rc::Weak::upgrade` * `rc::Weak` * `slice::Iter::as_slice` * `slice::IterMut::into_slice` * `str::CharIndices::as_str` * `str::Chars::as_str` * `str::split_at_mut` * `str::split_at` * `sync::Weak::upgrade` * `sync::Weak` * `thread::park_timeout` * `thread::sleep` Deprecated APIs * `BTreeMap::with_b` * `BTreeSet::with_b` * `Option::as_mut_slice` * `Option::as_slice` * `Result::as_mut_slice` * `Result::as_slice` * `f32::from_str_radix` * `f64::from_str_radix` Closes #27277 Closes #27718 Closes #27736 Closes #27764 Closes #27765 Closes #27766 Closes #27767 Closes #27768 Closes #27769 Closes #27771 Closes #27773 Closes #27775 Closes #27776 Closes #27785 Closes #27792 Closes #27795 Closes #27797
2015-09-11Auto merge of #28306 - alexcrichton:less-rt, r=brsonbors-397/+244
This commit does some refactoring to make almost all of the `std::rt` private. Specifically, the following items are no longer part of its API: * DEFAULT_ERROR_CODE * backtrace * unwind * args * at_exit * cleanup * heap (this is just alloc::heap) * min_stack * util The module is now tagged as `#[doc(hidden)]` as the only purpose it's serve is an entry point for the `panic!` macro via the `begin_unwind` and `begin_unwind_fmt` reexports.
2015-09-11std: Internalize almost all of `std::rt`Alex Crichton-397/+244
This commit does some refactoring to make almost all of the `std::rt` private. Specifically, the following items are no longer part of its API: * DEFAULT_ERROR_CODE * backtrace * unwind * args * at_exit * cleanup * heap (this is just alloc::heap) * min_stack * util The module is now tagged as `#[doc(hidden)]` as the only purpose it's serve is an entry point for the `panic!` macro via the `begin_unwind` and `begin_unwind_fmt` reexports.
2015-09-11std: Stabilize/deprecate features for 1.4Alex Crichton-40/+59
The FCP is coming to a close and 1.4 is coming out soon, so this brings in the libs team decision for all library features this cycle. Stabilized APIs: * `<Box<str>>::into_string` * `Arc::downgrade` * `Arc::get_mut` * `Arc::make_mut` * `Arc::try_unwrap` * `Box::from_raw` * `Box::into_raw` * `CStr::to_str` * `CStr::to_string_lossy` * `CString::from_raw` * `CString::into_raw` * `IntoRawFd::into_raw_fd` * `IntoRawFd` * `IntoRawHandle::into_raw_handle` * `IntoRawHandle` * `IntoRawSocket::into_raw_socket` * `IntoRawSocket` * `Rc::downgrade` * `Rc::get_mut` * `Rc::make_mut` * `Rc::try_unwrap` * `Result::expect` * `String::into_boxed_slice` * `TcpSocket::read_timeout` * `TcpSocket::set_read_timeout` * `TcpSocket::set_write_timeout` * `TcpSocket::write_timeout` * `UdpSocket::read_timeout` * `UdpSocket::set_read_timeout` * `UdpSocket::set_write_timeout` * `UdpSocket::write_timeout` * `Vec::append` * `Vec::split_off` * `VecDeque::append` * `VecDeque::retain` * `VecDeque::split_off` * `rc::Weak::upgrade` * `rc::Weak` * `slice::Iter::as_slice` * `slice::IterMut::into_slice` * `str::CharIndices::as_str` * `str::Chars::as_str` * `str::split_at_mut` * `str::split_at` * `sync::Weak::upgrade` * `sync::Weak` * `thread::park_timeout` * `thread::sleep` Deprecated APIs * `BTreeMap::with_b` * `BTreeSet::with_b` * `Option::as_mut_slice` * `Option::as_slice` * `Result::as_mut_slice` * `Result::as_slice` * `f32::from_str_radix` * `f64::from_str_radix` Closes #27277 Closes #27718 Closes #27736 Closes #27764 Closes #27765 Closes #27766 Closes #27767 Closes #27768 Closes #27769 Closes #27771 Closes #27773 Closes #27775 Closes #27776 Closes #27785 Closes #27792 Closes #27795 Closes #27797
2015-09-09Reduce code bloat from conversion traits in function parametersVadim Petrochenkov-27/+96
2015-09-09Rollup merge of #28289 - shepmaster:include_bytes-docs, r=alexcrichtonManish Goregaokar-2/+2
This can be shown with the example code ```rust fn main() { let () = include_bytes!("/etc/hosts"); } Which will have the error: expected `&[u8; 195]`, found `()`
2015-09-09Auto merge of #28198 - alexcrichton:from-raw-mut, r=aturonbors-8/+5
Conventionally in C `*mut T` is a transfer of ownership where `*const T` is a loan, so `*mut T` is likely the more appropriate return type for these functions. Additionally, this more closely mirrors the APIs on `Box` for this sort of functionality. cc #27769
2015-09-08Let's see if lifetime elision works in this casellogiq-1/+1
2015-09-08Fixed required type coercionllogiq-1/+2
I'd have thought that the types of the slice::Split would have been inferred, but this appears not to be the case. Reverted this one change.
2015-09-07Clarify that `include_bytes!` returns a reference to an array, not just a sliceJake Goulding-2/+2
This can be shown with the example code ```rust fn main() { let () = include_bytes!("/etc/hosts"); } Which will have the error: expected `&[u8; 195]`, found `()`
2015-09-08fixes/improvements thanks to @ManishearthAndre Bogus-2/+1
2015-09-08some more clippy-based improvementsAndre Bogus-64/+47
2015-09-07at_exit: fix a typo of the doc commentRyo Munakata-1/+1
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-03std: Update CString::{into,from}_raw with `*mut T`Alex Crichton-8/+5
Conventionally in C `*mut T` is a transfer of ownership where `*const T` is a loan, so `*mut T` is likely the more appropriate return type for these functions. Additionally, this more closely mirrors the APIs on `Box` for this sort of functionality. cc #27769
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