about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2019-09-30Rollup merge of #64923 - lzutao:improve-doc-needs_drop, r=jonas-schievinkTyler Mandry-4/+6
Add missing links for mem::needs_drop r? @jonas-schievink
2019-09-30Rollup merge of #64911 - hman523:64844, r=Dylan-DPCTyler Mandry-1/+1
Fixed a misleading documentation issue #64844 Made the suggested change from @steveklabnik on issue #64844
2019-09-30Add missing links for mem::needs_dropLzu Tao-4/+6
2019-09-30Auto merge of #64600 - scottmcm:no-slice-tryfold-unroll, r=blussbors-68/+1
Remove manual unrolling from slice::Iter(Mut)::try_fold While this definitely helps sometimes (particularly for trivial closures), it's also a pessimization sometimes, so it's better to leave this to (hypothetical) future LLVM improvements instead of forcing this on everyone. I think it's better for the advice to be that sometimes you need to unroll manually than you sometimes need to not-unroll manually (like #64545). --- For context see https://github.com/rust-lang/rust/pull/64572#issuecomment-532961046
2019-09-30Fixed a misleading documentation issue #64844hman523-1/+1
2019-09-28Rollup merge of #64837 - nliberg:patch-2, r=CentrilMazdak Farrokhzad-6/+6
Improve wording in documentation of MaybeUninit Changes > variables are properly initialized **at** their respective type into > variables are properly initialized **as** their respective type
2019-09-28Improve wording in documentation of MaybeUninitNils Liberg-6/+6
2019-09-27pin.rs: fix links to primitives in documentationrusty-snake-0/+2
2019-09-26Auto merge of #62661 - arielb1:never-reserve, r=nikomatsakisbors-0/+12
reserve `impl<T> From<!> for T` this is necessary for never-type stabilization. cc #57012 #35121 I think we wanted a crater run for this @nikomatsakis? r? @nikomatsakis
2019-09-25address rebase damageAriel Ben-Yehuda-1/+1
2019-09-25Rollup merge of #64764 - Mark-Simulacrum:snap, r=CentrilMazdak Farrokhzad-92/+11
Master is now 1.40 r? @pietroalbini
2019-09-25Rollup merge of #64386 - tspiteri:const-abs2, r=oli-obkMazdak Farrokhzad-3/+26
use `sign` variable in abs and wrapping_abs methods This also makes the code easier to understand by hinting at the significance of `self >> ($BITS - 1)`. Also, now `overflowing_abs` simply uses `wrapping_abs`, which is clearer and avoids a potential performance regression in the LLVM IR. This PR follows from the discussion from #63786. r? @eddyb cc @nikic
2019-09-25Snap cfgs to new betaMark Rousskov-92/+11
2019-09-24Rollup merge of #64717 - andrewbanchich:master, r=joshtriplettMazdak Farrokhzad-3/+3
update mem::discriminant test to use assert_eq and assert_ne over comparison operators Use assert_eq and assert_ne over comparison operators.
2019-09-24Rollup merge of #64296 - KodrAus:chore/iter_order_by, r=CentrilMazdak Farrokhzad-3/+3
Document the unstable iter_order_by library feature Tracking issue: #64295 Follow-up for: #62205 References the tracking issue and adds a page to the unstable book for the new unstable `iter_order_by` feature.
2019-09-24add a rustdoc comment to the reservation implNiko Matsakis-0/+5
2019-09-24nit: update error text to cite tracking issueNiko Matsakis-6/+2
2019-09-24add error message for caseAriel Ben-Yehuda-1/+6
2019-09-24reserve `impl<T> From<!> for T`Ariel Ben-Yehuda-0/+6
this is necessary for never-type stabilization
2019-09-24Stabilize `str::len`, `[T]::len`, `is_empty` and `str::as_bytes` as const fnOliver Scherer-8/+12
2019-09-23Just delete the overrides now that they match the default implementationsScott McMurray-62/+1
2019-09-23update testAndrew Banchich-3/+3
Use assert_eq and assert_ne over comparison operators.
2019-09-23Fix rebase conflictsAlex Crichton-1/+1
2019-09-23Move `--cfg bootstrap` out of `rustc.rs`Alex Crichton-33/+33
Instead let's do this via `RUSTFLAGS` in `builder.rs`. Currently requires a submodule update of `stdarch` to fix a problem with previous compilers.
2019-09-21Remove manual unrolling from slice::Iter(Mut)::try_foldScott McMurray-13/+7
While this definitely helps sometimes (particularly for trivial closures), it's also a pessimization sometimes, so it's better to leave this to (hypothetical) future LLVM improvements instead of forcing this on everyone. I think it's better for the advice to be that sometimes you need to unroll manually than you sometimes need to not-unroll manually (like #64545).
2019-09-21Rollup merge of #64641 - cuviper:extern-rust-ctypes, r=estebankMazdak Farrokhzad-1/+1
Exempt extern "Rust" from improper_ctypes It should be fine for Rust ABIs to involve any Rust type. Fixes #64593.
2019-09-21Auto merge of #64047 - timvermeulen:cmp_min_max_by, r=cuviperbors-34/+129
Add `cmp::{min_by, min_by_key, max_by, max_by_key}` This adds the following functions to `core::cmp`: - `min_by` - `min_by_key` - `max_by` - `max_by_key` `min_by` and `max_by` are somewhat trivial to implement, but not entirely because `min_by` returns the first value in case the two are equal (and `max_by` the second). `min` and `max` can be implemented in terms of `min_by` and `max_by`, but not as easily the other way around. To give an example of why I think these functions could be useful: the `Iterator::{min_by, min_by_key, max_by, max_by_key}` methods all currently hard-code the behavior mentioned above which is an ever so small duplication of logic. If we delegate them to `cmp::{min_by, max_by}` methods instead, we get the correct behavior for free. (edit: this is now included in the PR) I added `min_by_key` / `max_by_key` for consistency's sake but I wouldn't mind removing them. I don't have a particular use case in mind for them, and `min_by` / `max_by` seem to be more useful. Tracking issue: #64460
2019-09-20Exempt extern "Rust" from improper_ctypesJosh Stone-1/+1
It should be fine for Rust ABIs to involve any Rust type.
2019-09-18Rollup merge of #64348 - arnohaase:pr_documentation_spin_loop_hint, ↵Tyler Mandry-29/+20
r=alexcrichton PR: documentation spin loop hint The documentation for 'spin loop hint' explains that yield is better if the lock holder is running on the same CPU. I suggest that 'CPU or core' would be clearer.
2019-09-18broken hyperlinks in documentationArno Haase-2/+2
2019-09-18doc: Format some primitives examplesLzu Tao-12/+18
2019-09-17Rollup merge of #64529 - taiki-e:docs-pin-as-mut, r=RalfJungTyler Mandry-0/+21
Add an example to Pin::as_mut https://github.com/taiki-e/pin-project/issues/89#issuecomment-531701172 r? @RalfJung
2019-09-17Rollup merge of #64436 - llogiq:transmute-docs, r=RalfJungTyler Mandry-11/+17
improve Vec example soundness in mem::transmute docs The previous version of the `Vec` example had a case of questionable soundness, because at one point `v_orig` was aliased. r? @RalfJung
2019-09-17improve Vec example soundness in mem::transmute docsAndre Bogus-11/+17
2019-09-17Update src/libcore/pin.rsTaiki Endo-1/+1
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-09-17Add an example to Pin::as_mutTaiki Endo-0/+21
2019-09-17newly phrased documentation for spin loop hintsArno Haase-29/+20
2019-09-17Rollup merge of #64531 - taiki-e:pin-self, r=CentrilMazdak Farrokhzad-9/+9
Use shorthand syntax in the self parameter of methods of Pin
2019-09-17Rollup merge of #64530 - taiki-e:docs-pin-lifetimes, r=CentrilMazdak Farrokhzad-4/+4
Elide lifetimes in `Pin<&(mut) Self>`
2019-09-17Use shorthand syntax in the self parameter of methods of PinTaiki Endo-9/+9
2019-09-17Elide lifetimes in `Pin<&(mut) Self>`Taiki Endo-4/+4
2019-09-16Make some adjustments to the documentation for `std::convert::identity`varkor-8/+9
Fixes some extra blank lines and makes some minor tweaks to the wording.
2019-09-14Simplify Iterator::{min_by, max_by} using cmp::{min_by, max_by}Tim Vermeulen-31/+17
2019-09-14Add cmp::{min_by, min_by_key, max_by, max_by_key}Tim Vermeulen-3/+112
2019-09-14Rollup merge of #64203 - alexreg:rush-pr-2, r=centrilMazdak Farrokhzad-8/+8
A few cosmetic improvements to code & comments in liballoc and libcore Factored out from hacking on rustc for work on the REPL. r? @Centril
2019-09-13use `sign` variable in abs and wrapping_abs methodsTrevor Spiteri-3/+26
This also makes the code easier to understand by hinting at the significance of `self >> ($BITS - 1)` and by including an explanation in the comments. Also, now overflowing_abs simply uses wrapping_abs, which is clearer and avoids a potential performance regression in the LLVM IR.
2019-09-11Rollup merge of #64349 - arnohaase:pr_documentation_atomicptr, r=cramertjMazdak Farrokhzad-4/+2
documentation for AtomicPtr CAS operations The examples in the documentation for AtomicPtr CAS operations only show code that does *not* perform the CAS operation. I suggest to change them so that they actually do exchange the AtomicPtr's value.
2019-09-10Rollup merge of #63786 - tspiteri:const-abs, r=alexcrichtonMazdak Farrokhzad-21/+9
Make `abs`, `wrapping_abs`, `overflowing_abs` const functions This makes `abs`, `wrapping_abs` and `overflowing_abs` const functions like #58044 makes `wrapping_neg` and `overflowing_neg` const functions. `abs` is made const by returning `(self ^ -1) - -1` = `!self + 1` = `-self` for negative numbers and `(self ^ 0) - 0` = `self` for non-negative numbers. The subexpression `self >> ($BITS - 1)` evaluates to `-1` for negative numbers and `0` otherwise. The subtraction overflows when `self` is `min_value()`, as we would be subtracting `max_value() - -1`; this is when `abs` should overflow. `wrapping_abs` and `overflowing_abs` make use of `wrapping_sub` and `overflowing_sub` instead of the subtraction operator.
2019-09-10fixed linter errorArno Haase-14/+14
2019-09-10documentation for AtomicPtr CAS operationsArno Haase-4/+2