about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2019-01-22reposition markdown hyperlink referenceCorey Farwell-2/+2
2019-01-22Mention that core::intrinsics::transmute is available at core::mem::transmute.Johnathan Van Why-0/+4
In #[no_std] environments, std::mem::transmute is unavailable. Searching for transmute in libcore only pulls up core::intrinsics::transmute, which is behind the (unstable) core_intrinsics feature flag. Users wishing to use transmute in #[no_std] environments typically should use core::mem::transmute instead, as it is stable. This documentation makes core::mem::transmute discoverable.
2019-01-22Move trivial constructors to inherent methodsClar Fon-26/+76
2019-01-22Move nontrivial constructors to inherent methodsClar Fon-25/+60
2019-01-22Don't expose ZipImpl to IteratorClar Fon-5/+5
2019-01-22Move super_nth out of ZipImplClar Fon-7/+9
2019-01-22Don't expose FlattenCompat to IteratorClar Fon-13/+24
2019-01-22Don't expose ChainState to IteratorClar Fon-8/+12
2019-01-22Move Flatten and FlatMap to own moduleClar Fon-313/+321
2019-01-22Move Chain and ChainState to own moduleClar Fon-251/+258
2019-01-22Move TrustedRandomAccess into Zip moduleClar Fon-6/+20
2019-01-22Move Zip and ZipImpl to own moduleClar Fon-258/+266
2019-01-22Move FusedIterator, TrustedLen to own moduleClar Fon-45/+46
2019-01-22Move Sum, Product to own moduleClar Fon-226/+227
2019-01-22Move FromIterator, IntoIterator, Extend into own moduleClar Fon-350/+351
2019-01-22Move ExactSizeIterator to own moduleClar Fon-143/+145
2019-01-22Move DoubleEndedIterator to own moduleClar Fon-298/+300
2019-01-22Move core::iter iterator.rs to traits moduleClar Fon-8/+11
2019-01-22Move core::iter adapters to adapters.rsClar Fon-2769/+2790
2019-01-22Stabilize Any::get_type_id and rename to type_idSimon Sapin-10/+6
FCP: https://github.com/rust-lang/rust/issues/27745#issuecomment-373906749
2019-01-22Rollup merge of #57604 - alercah:str-index, r=sfacklerMazdak Farrokhzad-195/+132
Make `str` indexing generic on `SliceIndex`. Fixes #55603
2019-01-22Rollup merge of #57537 - sinkuu:fmt_perf, r=alexcrichtonMazdak Farrokhzad-4/+117
Small perf improvement for fmt Added benchmark is based on #10761
2019-01-22Fixed Deref coercion explanation for DerefMut using shared referencesdanielhenrymantilla-1/+1
2019-01-22Auto merge of #57475 - SimonSapin:signed, r=estebankbors-16/+30
Add signed num::NonZeroI* types Multiple people have asked for them in https://github.com/rust-lang/rust/issues/49137. Given that the unsigned ones already exist, they are very easy to add and not an additional maintenance burden.
2019-01-21un-deprecate mem::zeroedRalf Jung-1/+0
2019-01-21Speed up the fast path for assert_eq! and assert_ne!Björn Steinbrink-4/+16
Currently, the panic!() calls directly borrow the value bindings. This causes those bindings to always be initialized, i.e. they're initialized even before the values are even compared. This causes noticeable overhead in what should be a really cheap operation. By performing a reborrow of the value in the call to panic!(), we allow LLVM to optimize that code, so that the extra borrow only happens in the error case. We could achieve the same result by dereferencing the values passed to panic!(), as the format machinery borrows them anyway, but this causes assertions to fail to compile if one of the values is unsized, i.e. it would be a breaking change.
2019-01-21Auto merge of #55045 - kleimkuhler:add-std-is_sorted, r=KodrAusbors-4/+212
Add `is_sorted` to `Iterator` and `[T]` This is an initial implementation for the first step of [RFC 2351](https://github.com/rust-lang/rfcs/blob/master/text/2351-is-sorted.md) Tracking issue: https://github.com/rust-lang/rust/issues/53485
2019-01-21Rollup merge of #56796 - KrishnaSannasi:try_from_impl_change, r=shepmasterMazdak Farrokhzad-2/+2
Change bounds on `TryFrom` blanket impl to use `Into` instead of `From` This is from this [comment](https://github.com/rust-lang/rust/issues/33417#issuecomment-447111156) I made. This will expand the impls available for `TryFrom` and `TryInto`, without losing anything in the process.
2019-01-19Rollup merge of #57452 - steveklabnik:improve-formatter-docs, r=frewsxcvMazdak Farrokhzad-3/+12
Improve docs for Formatter Some improvements to `std::fmt::Formatter` to make it a bit more consistent with other documentation, as well as calling out that you don't ever instantiate one yourself.
2019-01-19Make `str` indexing generic on `SliceIndex`.Alexis Hunt-195/+132
2019-01-18Rollup merge of #57350 - folex:master, r=estebankMazdak Farrokhzad-0/+30
Better error note on unimplemented Index trait for string fixes #56740 I've tried to compile suggestion from comments in the issue #56740, but unsure of it. So I'm open to advice :) Current output will be like this: ```rust error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:3:17 | LL | let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` | ^^^^ `str` cannot be indexed by `{integer}` | = help: the trait `std::ops::Index<{integer}>` is not implemented for `str` = note: you can use `.chars().nth()` or `.bytes().nth()` see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#indexing-into-strings> error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ``` `x.py test src/test/ui` succeeded and I've also tested output manually by compiling the following code: ```rust fn _f() { let s = std::string::String::from("hello"); let _c = s[0]; let s = std::string::String::from("hello"); let mut _c = s[0]; let s = "hello"; let _c = s[0]; let s = "hello"; let mut _c = &s[0]; } ``` Not sure if some docs should be changed too. I will also fix error message in the [Book :: Indexing into Strings](https://github.com/rust-lang/book/blob/db53e2e3cdf77beac853df6f29db4b3b86ea598c/src/ch08-02-strings.md#indexing-into-strings) if that PR will get approved :)
2019-01-18Rollup merge of #57685 - pthariensflame:enhancement/pin-impl-applicability, ↵Mazdak Farrokhzad-3/+45
r=withoutboats Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`. This allows for comparing for equality or ordering a `Pin<P>` and a `Pin<Q>` as long as `P` and `Q` are correspondingly comparable themselves *even when `P` and `Q` are different types*. An example might be comparing a `Pin<&mut OsString>` to a `Pin<&mut PathBuf>`, which might arise from pin projections from a pair of larger contexts that aren't `Unpin`.
2019-01-18Rollup merge of #57357 - frewsxcv:frewsxcv-partial-eq, r=QuietMisdreavusMazdak Farrokhzad-16/+22
Cleanup PartialEq docs. - Cleanup the `impl PartialEq<BookFormat> for Book` implementation - Implement `impl PartialEq<Book> for BookFormat` so it’s symmetric - Fixes https://github.com/rust-lang/rust/issues/53844. - Removes the last example since it appears to be redundant with the previous two examples.
2019-01-18Rollup merge of #57340 - eqrion:doc/c_variadic, r=Mark-SimulacrumMazdak Farrokhzad-11/+11
Use correct tracking issue for c_variadic Fixes #57306
2019-01-18Rollup merge of #56594 - sdroege:c_void-is-not-never, r=TimNNMazdak Farrokhzad-7/+10
Remove confusing comment about ideally using `!` for `c_void` Using `!` for `c_void` would have the problem that pointers and potentially references to an uninhabited type would be created, and at least for references this is UB. In addition document that newtype wrappers around `c_void` can be used safely in place of `extern type` until the latter is stabilized. ---- I'm not 100% sure about the usage for opaque types as the [nomicon](https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs) still recommends using `#[repr(C)] pub struct Foo { _private: [u8; 0] }` but it seems like these two should be equivalent in the end? Also the `#[repr(C)]` (in both cases) should be unneeded because such types never being passed by value, never being dereferenced but only passed around as pointer or reference, so the representation of (*values* of) the type itself should not matter at all? Also in context of `c_void` and `!` the second unresolved question in the [`extern type`](https://github.com/rust-lang/rust/issues/43467) stabilization ticket seems relevant > In [std's](https://github.com/rust-lang/rust/blob/164619a8cfe6d376d25bd3a6a9a5f2856c8de64d/src/libstd/os/raw.rs#L59-L64) source, it is mentioned that LLVM expects i8* for C's void*. > We'd need to continue to hack this for the two c_voids in std and libc. > But perhaps this should be done across-the-board for all extern types? > Somebody should check what Clang does. Please correct me if my understanding is wrong and everything's actually fine as is.
2019-01-18Auto merge of #56996 - clarcharr:spin_loop_hint, r=KodrAusbors-9/+26
Move spin_loop_hint to core::hint module As mentioned in #55002. The new name is kept unstable to decide whether the function should have `_hint` in its name.
2019-01-17Override `Iterator::is_sorted_by` in `slice::Iter` implLukas Kalbertodt-13/+22
Additionally, the root implementation was changed a bit: it now uses `all` instead of coding that logic manually. To avoid duplicate code, the inherent `[T]::is_sorted_by` method now calls `self.iter().is_sorted_by(...)`. This should always be inlined and not result in overhead.
2019-01-17Compare pairs with `slice::windows`Kevin Leimkuhler-8/+9
2019-01-17Improve documentation and slice implKevin Leimkuhler-11/+18
2019-01-17Add is_sorted unstable documentationKevin Leimkuhler-0/+4
2019-01-17Add is_sorted impl for [T]Kevin Leimkuhler-21/+109
2019-01-17Add initial impl of is_sorted to IteratorKevin Leimkuhler-0/+99
2019-01-17Add signed num::NonZeroI* typesSimon Sapin-16/+30
Multiple people have asked for them, in https://github.com/rust-lang/rust/issues/49137. Given that the unsigned ones already exist, they are very easy to add and not an additional maintenance burden.
2019-01-17Auto merge of #57694 - pietroalbini:revert-beta-on-master, r=pietroalbinibors-20/+0
Revert "Auto merge of #57670 - rust-lang:beta-next, r=Mark-Simulacrum" For whatever reason bors merged this in master `:/` r? @ghost
2019-01-17Revert "Auto merge of #57670 - rust-lang:beta-next, r=Mark-Simulacrum"Pietro Albini-20/+0
This reverts commit 722b4d695964906807b12379577bce5ee3d23e08, reversing changes made to 956dba47d33fc8b2bdabcd50e5bfed264b570382.
2019-01-17Auto merge of #57520 - alexreg:tidy-copyright-lint, r=Mark-Simulacrumbors-15/+14
Add lint for copyright headers to 'tidy' tool r? @Mark-Simulacrum CC @centril
2019-01-16Fix tidy errors.Alexander Ronald Altman-2/+0
2019-01-16Enhance `Pin` impl applicability for `PartialEq` and `PartialOrd`.Alexander Ronald Altman-3/+47
2019-01-16allow unused warnings related to rustc_layout_scalar_valid_range_startPietro Albini-0/+20
2019-01-15demonstrate symmetryCorey Farwell-1/+1