summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2015-10-16Make function pointers implement traits for up to 12 parametersManish Goregaokar-0/+7
(12 was chosen to be consistent with what we do for tuples) Fixes #28559
2015-10-16Reject "+" and "-" when parsing floats.Robin Kruppe-1/+6
Fixes #29042
2015-09-15Auto merge of #28268 - petrochenkov:fnptr, r=alexcrichtonbors-69/+71
Closes https://github.com/rust-lang/rust/issues/26082
2015-09-14Auto merge of #28248 - PeterReid:master, r=alexcrichtonbors-15/+11
Overflows in integer pow() computations would be missed if they preceded a 0 bit of the exponent being processed. This made calls such as 2i32.pow(1024) not trigger an overflow. Fixes #28012
2015-09-14Auto merge of #28358 - dotdash:nounwind, r=alexcrichtonbors-0/+2
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/+2
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-14Auto merge of #28368 - lfairy:write-impl, r=alexcrichtonbors-0/+15
There is already a corresponding impl for `std::io::Write`. This change will make the two traits more consistent.
2015-09-13Auto merge of #28339 - alexcrichton:stabilize-1.4, r=aturonbors-8/+11
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-13Implement more traits for function pointersVadim Petrochenkov-69/+71
2015-09-13Add a blanket impl for &mut std::fmt::WriteChris Wong-0/+15
There is already a corresponding impl for `std::io::Write`. This change will make the two traits more consistent.
2015-09-12Stop a private method on `SipHasher` from shadowing `Hasher::write`Tobias Bucher-8/+3
2015-09-11std: Stabilize/deprecate features for 1.4Alex Crichton-8/+11
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-10Optimize string comparison by using memcmpErick Tryzelaar-15/+20
llvm seems to be having some trouble optimizing the iterator-based string comparsion method into some equivalent to memcmp. This explicitly calls out to the memcmp intrinisic in order to allow llvm to generate better code. In some manual benchmarking, this memcmp-based approach is 20 times faster than the iterator approach.
2015-09-08some more clippy-based improvementsAndre Bogus-3/+3
2015-09-07Use unsafe more idiomaticallySteve Klabnik-1/+3
Generally, including everything that makes an unsafe block safe in the block is good style. Since the assert! is what makes this safe, it should go inside the block. I also added a few bits of whitespace.
2015-09-04Fix for issue #28012: pow overflow inconsistencyPeter Reid-15/+11
Overflows in integer pow() computations would be missed if they preceded a 0 bit of the exponent being processed. This made calls such as 2i32.pow(1024) not trigger an overflow.
2015-09-04Auto merge of #28197 - petrochenkov:borrow, r=alexcrichtonbors-0/+15
2015-09-04Auto merge of #28119 - nagisa:bytesderef, r=alexcrichtonbors-30/+3
2015-09-03std: Account for CRLF in {str, BufRead}::linesAlex Crichton-4/+10
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-04Rollup merge of #28191 - llogiq:iter, r=ManishearthManish Goregaokar-6/+6
Nothing too big, a few needless returns and a few closures eliminated (the latter may improve performance in some cases, at least compilation should be a bit faster).
2015-09-04Rollup merge of #28188 - Manishearth:elide-core, r=alexcrichtonManish Goregaokar-72/+72
Makes things more greppable. This change was made automatically by clippy + bash scripts, though I will run test passes, please review carefully.
2015-09-03Implement `Borrow` for fixed-size arraysVadim Petrochenkov-0/+15
2015-09-03take mapped function by mutable referencellogiq-4/+4
2015-09-03Elide lifetimes in libcoreManish Goregaokar-72/+72
2015-09-03clippy improvements to iteratorsllogiq-6/+6
2015-09-03Make `null()` and `null_mut()` const functionsVadim Petrochenkov-4/+4
2015-09-01Auto merge of #28088 - tbu-:pr_fixed_size_array, r=alexcrichtonbors-12/+12
2015-08-31Change explicit BytesDeref impl into Cloned iteratorSimonas Kazlauskas-30/+3
2015-08-31Auto merge of #28101 - ijks:24214-str-bytes, r=alexcrichtonbors-0/+15
Specifically, `count`, `last`, and `nth` are implemented to use the methods of the underlying slice iterator. Partially closes #24214.
2015-08-31Implement `FixedSizeArray` for all fixed size arraysTobias Bucher-12/+12
Do so by using the fact that fixed size arrays (like `[u8; 8]` can be coerced to slices `&[u8]`, this is expressed through the trait `Unsize<[T]>` that all fixed size arrays implement.
2015-08-30Add overrides to iterator methods for `str::Bytes`Daan Rijks-0/+15
Specifically, `count`, `last`, and `nth` are implemented to use the methods of the underlying slice iterator. Partially closes #24214.
2015-08-28Add .as_str() to str::Chars and str::CharIndices. See #27775.Simon Sapin-0/+24
2015-08-28Auto merge of #28038 - durka:grep-unstable-issue-refs, r=alexcrichtonbors-2/+4
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-28Rollup merge of #28048 - steveklabnik:doc_unimplemented, r=alexcrichtonManish Goregaokar-0/+45
2015-08-28Rollup merge of #28039 - birkenfeld:option_result_ref_intoiter, r=alexcrichtonManish Goregaokar-0/+40
Fixes #27996. Does this need any `#[stable]`/`#[unstable]` attributes?
2015-08-27Auto merge of #28031 - durka:patch-6, r=alexcrichtonbors-1/+1
It was pointing at the issue for `placement_new_protocol`.
2015-08-27Some extra examples for the unimplemented! macroSteve Klabnik-0/+45
2015-08-27core: Implement IntoIterator for Option and Result referencesGeorg Brandl-0/+40
Fixes #27996.
2015-08-27fix some more unstable issue annotationsAlex Burka-2/+4
2015-08-27Auto merge of #28016 - ranma42:mini-rem-in-core, r=alexcrichtonbors-2/+24
The implementation of the remainder operation belongs to librustc_trans, but it is also stubbed out in libcore in order to expose it as a trait on primitive types. Instead of exposing some implementation details (like the upcast to `f64` in MSVC), use a minimal implementation just like that of the `Div` trait.
2015-08-27Auto merge of #28028 - tshepang:add-size_hint-example, r=alexcrichtonbors-0/+7
2015-08-27Auto merge of #28027 - tshepang:improve-sentence, r=alexcrichtonbors-1/+1
2015-08-27Restore removed code and mark it for usage in stage0Andrea Canciani-0/+41
The old code is temporarily needed in order to keep the MSVC build working. It should be possible to remove this code after the bootstrap compiler is updated to contain the MSVC workaround from #27875.
2015-08-27Auto merge of #27975 - sfackler:iter-order-methods, r=aturonbors-96/+219
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-96/+219
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-0/+110
* 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-26fix unstable issue ref for UnsizeAlex Burka-1/+1
It was pointing at the issue for `placement_new_protocol`.
2015-08-26doc: add Iterator::size_hint exampleTshepang Lekhonkhobe-0/+7
2015-08-26doc: I had to read this twice before understanding itTshepang Lekhonkhobe-1/+1
2015-08-26Any docs: as_ref doesn't exist anymoreSteve Klabnik-5/+6
Fixes #27958