about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2020-01-05Add more nuanced advice about spin_loop_hintAleksey Kladov-2/+4
2020-01-04Result's panics have `#[track_caller]`.Adam Perry-0/+5
2020-01-04Option's panics are all #[track_caller].Adam Perry-0/+6
Also includes a simple test with a custom panic hook to ensure we don't regress.
2020-01-04Fix incremental builds of core by allowing unused attribute.Adam Perry-0/+3
The same problem as in https://github.com/rust-lang/rust/issues/65023 was introduced by https://github.com/rust-lang/rust/pull/67657. This works around the current incrcomp issue with these attributes by allowing it here.
2020-01-05Re-add comment about behaviour of inline.jumbatm-0/+3
2020-01-04Rollup merge of #67137 - anp:tracked-panic-internals, r=eddybDylan DPC-11/+6
libstd uses `core::panic::Location` where possible. cc @eddyb
2020-01-04core and std macros and panic internals use panic::Location::caller.Adam Perry-11/+6
2020-01-04Rollup merge of #67845 - jumbatm:also-unconst-hack-abs, r=oli-obkMazdak Farrokhzad-18/+6
Also remove const-hack for abs Closes #67842. r? @oli-obk
2020-01-04Rollup merge of #67531 - RalfJung:tame-promotion, r=nikomatsakisMazdak Farrokhzad-3/+0
no longer promote non-pattern const functions This is trying to pack-pedal a bit on promotion feature creep, as proposed by @eddyb [here](https://github.com/rust-lang/const-eval/issues/19#issuecomment-472799062): possibly, a sane subset of `const fn` that we could promote are those that are just constructors -- the same subset that we might want to allow in pattern position at some point. So, this removes the `rustc_promotable` attribute from the three functions they identified that do not fit this pattern. The first step is to run crater to see if there is code in the wild that relies on this being promotable. r? @oli-obk
2020-01-04Also remove const-hack for absjumbatm-18/+6
2020-01-03Auto merge of #67828 - JohnTitor:rollup-qmswkkl, r=JohnTitorbors-3/+3
Rollup of 10 pull requests Successful merges: - #67450 (Allow for setting a ThinLTO import limit during bootstrap) - #67595 (Suggest adding a lifetime constraint for opaque type) - #67636 (allow rustfmt key in [build] section) - #67736 (Less-than is asymmetric, not antisymmetric) - #67762 (Add missing links for insecure_time) - #67783 (Warn for bindings named same as variants when matching against a borrow) - #67796 (Ensure that we process projections during MIR inlining) - #67807 (Use drop instead of the toilet closure `|_| ()`) - #67816 (Clean up err codes) - #67825 (Minor: change take() docs grammar to match other docs) Failed merges: r? @ghost
2020-01-03Rollup merge of #67825 - petertodd:2020-mem-take-grammar, r=steveklabnikYuki Okushi-1/+1
Minor: change take() docs grammar to match other docs Eg. mem::replace()
2020-01-03Rollup merge of #67736 - taralx:patch-1, r=sfacklerYuki Okushi-2/+2
Less-than is asymmetric, not antisymmetric This has bothered me for a while. It's such a small nit, but...
2020-01-03Auto merge of #67768 - wesleywiser:dnm_test_perf_65244, r=Mark-Simulacrumbors-28/+0
Revert #65244 for performance reasons This reverts commit f35517ee861dc012ccc26083dd4520045e2c4f6f. Revert #65244 so we can see if it is the cause of the performance issue in #67706 cc https://github.com/rust-lang/rust/issues/67644
2020-01-03Minor: change take() docs grammar to match other docsPeter Todd-1/+1
Eg. mem::replace()
2020-01-02Remove wrong advice about spin locks from `spin_loop_hint` docsAleksey Kladov-10/+2
Using a pure spin lock for a critical section in a preemptable thread is always wrong, however short the critical section may be. The thread might be preempted, which will cause all other threads to hammer busily at the core for the whole quant. Moreover, if threads have different priorities, this might lead to a priority inversion problem and a deadlock. More generally, a spinlock is not more efficient than a well-written mutex, which typically does several spin iterations at the start anyway. The advise about UP vs SMP is also irrelevant in the context of preemptive threads.
2020-01-02Add Iterator::try_findMOZGIII-0/+79
2020-01-01Reset Formatter flags on exit from pad_integralMark Rousskov-3/+21
This fixes a bug where after calling pad_integral with appropriate flags, the fill and alignment flags would be set to '0' and 'Right' and left as such even after exiting pad_integral, which meant that future calls on the same Formatter would get incorrect flags reported. This is quite difficult to observe in practice, as almost all formatting implementations in practice don't call `Display::fmt` directly, but rather use `write!` or a similar macro, which means that they cannot observe the effects of the wrong flags (as `write!` creates a fresh Formatter instance). However, we include a test case.
2019-12-31Revert "core: add IntoFuture trait and support for await"Wesley Wiser-28/+0
This reverts commit f35517ee861dc012ccc26083dd4520045e2c4f6f.
2019-12-31Rollup merge of #67685 - lukaslueg:const_result, r=oli-obkMazdak Farrokhzad-3/+7
Constify Result r? @oli-obk This is just the `Result`-part of #67494 which I'll resubmit once #66254 has landed.
2019-12-31Constify ResultLukas Lueg-3/+7
2019-12-31Rollup merge of #67430 - tspiteri:minus-inf, r=Dylan-DPCDylan DPC-2/+2
doc: minus (U+2212) instead of dash (U+002D) for negative infinity The documentation for [`f32::NEG_INFINITY`](https://doc.rust-lang.org/std/f32/constant.NEG_INFINITY.html) contains “-∞” with a dash instead of a minus sign, “−∞” with a proper minus sign looks better with the used Source Serif Pro font. Similarly for [`f64::NEG_INFINITY`](https://doc.rust-lang.org/std/f64/constant.NEG_INFINITY.html).
2019-12-30Less-than is asymmetric, not antisymmetricJP Sugarbroad-2/+2
This has bothered me for a while. It's such a small nit, but...
2019-12-30Rollup merge of #67715 - petertodd:2019-typo-manuallydrop, r=CentrilYuki Okushi-1/+1
Typo fix
2019-12-30Rollup merge of #67657 - jumbatm:cleanup-const-hack, r=oli-obkYuki Okushi-16/+20
Clean up const-hack PRs now that const if / match exist. Closes #67627. Cleans up these merged PRs tagged with `const-hack`: - #63810 - #63786 - #61635 - #58044 reverting their contents to have the match or if expressions they originally contained. r? @oli-obk There's one more PR in those tagged with `const-hack` that originally wasn't merged (#65107). Reading the thread, it looks like it was originally closed because the `const-hack` for the checked arithmetic non-negligibly hurt performance, and because there was no way to manipulate the returned Option at compile time anyway (with neither const if nor const match). Would you like me to add these changes to the changes from this PR here too, now that we have the necessary features?
2019-12-30Rollup merge of #67564 - Mark-Simulacrum:iter-adapter-panic, r=LukasKalbertodtYuki Okushi-0/+5
docs: Iterator adapters have unspecified results after a panic Fixes #58170. That issue also has rough consensus from 3 members of the library team for this being the behavior we would like to specify.
2019-12-29Typo fixPeter Todd-1/+1
2019-12-28Rollup merge of #67659 - SimonSapin:matches, r=rkruppeOliver Scherer-3/+1
Stabilize the `matches!` macro Fixes https://github.com/rust-lang/rust/issues/65721 FCP: https://github.com/rust-lang/rust/issues/65721#issuecomment-569118119
2019-12-28Rollup merge of #67632 - kraai:remove-collapsed-reference-links, r=steveklabnikOliver Scherer-5/+5
Convert collapsed to shortcut reference links
2019-12-28Rollup merge of #67629 - kraai:remove-redundant-link-texts, r=steveklabnikOliver Scherer-3/+3
Remove redundant link texts Most of these links are followed by a parenthesized expression. I think that the redundant link texts were added to prevent interpretation as an inline link. This is unnecessary since the closing square bracket and opening parenthesis are separated by whitespace.
2019-12-28Rollup merge of #67602 - xfix:use-issue-none-instead-of-0-in-intrinsics, ↵Oliver Scherer-6/+6
r=Centril Use issue = "none" instead of "0" in intrinsics `issue = "0"` was incorrectly used in https://github.com/rust-lang/rust/commit/9ee16e14c51668309f446636e8960b7fbbac066d, the project is moving away from issue 0
2019-12-28Rollup merge of #67588 - Kixunil:nonnull-slice-iter, r=rkruppeOliver Scherer-22/+25
Use NonNull in slice::Iter and slice::IterMut. `ptr` of `slice::Iter` and `slice::IterMut` can never be null, but this fact wasn't exploited for layout optimizations. By changing `ptr` from `*<mutability> T` to `NonNull<T>`, the compiler can now optimize layout of `Option<Iter<'a, T>>`. Closes #67228
2019-12-27core: add IntoFuture trait and support for awaitSean McArthur-0/+28
2019-12-27Clean up const-hack from #58044jumbatm-1/+6
2019-12-27Clean up const-hack from #61635jumbatm-1/+5
2019-12-27Clean up const-hack from #63786jumbatm-10/+6
2019-12-27Clean up const-hack from #63810jumbatm-4/+3
2019-12-27Stabilize the `matches!` macroSimon Sapin-3/+1
Fixes https://github.com/rust-lang/rust/issues/65721 FCP: https://github.com/rust-lang/rust/issues/65721#issuecomment-569118119
2019-12-26Use NonNull in slice::Iter and slice::IterMut.Martin Habovstiak-22/+25
`ptr` of `slice::Iter` and `slice::IterMut` can never be null, but this fact wasn't exploited for layout optimizations. By changing `ptr` from `*<mutability> T` to `NonNull<T>`, the compiler can now optimize layout of `Option<Iter<'a, T>>`.
2019-12-26Convert collapsed to shortcut reference linksMatthew Kraai-5/+5
2019-12-26Remove redundant link textsMatthew Kraai-3/+3
2019-12-25Use issue = "none" instead of "0" in intrinsicsKonrad Borowski-6/+6
2019-12-25Auto merge of #67596 - Mark-Simulacrum:tidy-silence-rustfmt, r=Centrilbors-414/+713
(Mostly) finish formatting the repository Silences tidy line length warnings on rustfmt-controlled files. This leaves two things out of formatting: CloudABI (mostly because it's not really ours to control, it's upstream code that's mostly generated), and tests. The latter is a hard problem and maybe not one to worry too much about, we rarely edit old tests and reformatting them as we go if possible isn't too bad (they're generally small).
2019-12-24x.py fmt after previous deignoreMark Rousskov-414/+713
2019-12-24Auto merge of #67445 - llogiq:todo, r=dtolnaybors-20/+25
Differentiate todo! and unimplemented! This updates the panic message and docs to make it clear that `todo!` is for unfinished code and `unimplemented!` is for partial trait or enum impls. r? @Centril
2019-12-24Differentiate todo! and unimplemented!Andre Bogus-20/+25
2019-12-24Show value for consts in the documentationOhad Ravid-1/+1
2019-12-23Minimize unsafety in encode_utf8Mark Rousskov-30/+30
Use slice patterns to avoid having to skip bounds checking
2019-12-23docs: Iterator adapters have unspecified results after a panicMark Rousskov-0/+5
2019-12-23Rollup merge of #67559 - Mark-Simulacrum:drop-doc, r=RalfJungMazdak Farrokhzad-0/+6
Document that calling Drop, even after it panics, is UB Fixes #60822. r? @gnzlbg