Commit graph

10433 commits

Author SHA1 Message Date
Igor Aleksanov
f720469fd0 Use matches macro in libcore and libstd 2020-01-08 07:10:28 +03:00
Dylan DPC
34716a31db
Rollup merge of #67915 - lzutao:Self, r=Centril
Use Self instead of $type

r? @Dylan-DPC
2020-01-06 12:00:23 +05:30
Lzu Tao
c7dbf5ad54 Use Self instead of $type 2020-01-06 04:33:31 +00:00
Lucas Pardue
cb8c071eb5
macros: typo fix
spotted while reviewing the todo!macro docs
2020-01-06 01:55:24 +00:00
jumbatm
525cd2d7c1 Re-add comment about behaviour of inline. 2020-01-05 08:01:32 +10:00
Dylan DPC
cce055daef
Rollup merge of #67137 - anp:tracked-panic-internals, r=eddyb
libstd uses `core::panic::Location` where possible.

cc @eddyb
2020-01-04 23:52:44 +05:30
Adam Perry
eaccda009f core and std macros and panic internals use panic::Location::caller. 2020-01-04 10:02:17 -08:00
Mazdak Farrokhzad
745f771484
Rollup merge of #67845 - jumbatm:also-unconst-hack-abs, r=oli-obk
Also remove const-hack for abs

Closes #67842.

r? @oli-obk
2020-01-04 02:19:55 +01:00
Mazdak Farrokhzad
85277ff772
Rollup merge of #67531 - RalfJung:tame-promotion, r=nikomatsakis
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-04 02:19:46 +01:00
jumbatm
ae002c1d84 Also remove const-hack for abs 2020-01-04 08:42:22 +10:00
bors
30ddb5a8c1 Auto merge of #67828 - JohnTitor:rollup-qmswkkl, r=JohnTitor
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-03 09:07:05 +00:00
Yuki Okushi
14c96ce48c
Rollup merge of #67825 - petertodd:2020-mem-take-grammar, r=steveklabnik
Minor: change take() docs grammar to match other docs

Eg. mem::replace()
2020-01-03 17:56:33 +09:00
Yuki Okushi
ed80f49be9
Rollup merge of #67736 - taralx:patch-1, r=sfackler
Less-than is asymmetric, not antisymmetric

This has bothered me for a while. It's such a small nit, but...
2020-01-03 17:56:24 +09:00
bors
4877e164a1 Auto merge of #67768 - wesleywiser:dnm_test_perf_65244, r=Mark-Simulacrum
Revert #65244 for performance reasons

This reverts commit f35517ee86.

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-03 05:51:04 +00:00
Peter Todd
4a48818433
Minor: change take() docs grammar to match other docs
Eg. mem::replace()
2020-01-03 00:40:04 -05:00
MOZGIII
5446cc99bb Add Iterator::try_find 2020-01-02 00:59:26 +03:00
Wesley Wiser
717702dffd Revert "core: add IntoFuture trait and support for await"
This reverts commit f35517ee86.
2019-12-31 19:18:08 -05:00
Mazdak Farrokhzad
89fbed98c2
Rollup merge of #67685 - lukaslueg:const_result, r=oli-obk
Constify Result

r? @oli-obk

This is just the `Result`-part of #67494 which I'll resubmit once #66254 has landed.
2019-12-31 19:19:33 +01:00
Lukas Lueg
954c432a87 Constify Result 2019-12-31 15:13:37 +01:00
Dylan DPC
2c64475069
Rollup merge of #67430 - tspiteri:minus-inf, r=Dylan-DPC
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-31 18:14:01 +05:30
JP Sugarbroad
d935a26d9d
Less-than is asymmetric, not antisymmetric
This has bothered me for a while. It's such a small nit, but...
2019-12-30 12:17:23 -08:00
Yuki Okushi
dcc30aced0
Rollup merge of #67715 - petertodd:2019-typo-manuallydrop, r=Centril
Typo fix
2019-12-30 14:07:57 +09:00
Yuki Okushi
047a4bb432
Rollup merge of #67657 - jumbatm:cleanup-const-hack, r=oli-obk
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-30 14:07:50 +09:00
Yuki Okushi
97a7b03298
Rollup merge of #67564 - Mark-Simulacrum:iter-adapter-panic, r=LukasKalbertodt
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-30 14:07:47 +09:00
Peter Todd
e4c0eddbdb
Typo fix 2019-12-29 20:50:01 -05:00
Oliver Scherer
335c887721
Rollup merge of #67659 - SimonSapin:matches, r=rkruppe
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-28 00:36:17 +01:00
Oliver Scherer
48efc1e6c2
Rollup merge of #67632 - kraai:remove-collapsed-reference-links, r=steveklabnik
Convert collapsed to shortcut reference links
2019-12-28 00:36:11 +01:00
Oliver Scherer
b371e0fa00
Rollup merge of #67629 - kraai:remove-redundant-link-texts, r=steveklabnik
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-28 00:36:09 +01:00
Oliver Scherer
4cf4fc6cb1
Rollup merge of #67602 - xfix:use-issue-none-instead-of-0-in-intrinsics, r=Centril
Use issue = "none" instead of "0" in intrinsics

`issue = "0"` was incorrectly used in 9ee16e14c5, the project is moving away from issue 0
2019-12-28 00:36:04 +01:00
Oliver Scherer
4b91966501
Rollup merge of #67588 - Kixunil:nonnull-slice-iter, r=rkruppe
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-28 00:36:01 +01:00
Sean McArthur
f35517ee86 core: add IntoFuture trait and support for await 2019-12-27 11:56:11 -08:00
jumbatm
91c2f78b50 Clean up const-hack from #58044 2019-12-27 23:21:32 +10:00
jumbatm
282635f2db Clean up const-hack from #61635 2019-12-27 23:21:32 +10:00
jumbatm
8c494866be Clean up const-hack from #63786 2019-12-27 23:21:32 +10:00
jumbatm
f6faf0b2e7 Clean up const-hack from #63810 2019-12-27 23:21:27 +10:00
Simon Sapin
1c572a2d6e 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-27 14:07:16 +01:00
Martin Habovstiak
2c796ee77c 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>>`.
2019-12-26 20:18:31 +01:00
Matthew Kraai
2f43313834 Convert collapsed to shortcut reference links 2019-12-26 05:27:55 -08:00
Matthew Kraai
21e636f188 Remove redundant link texts 2019-12-26 05:04:46 -08:00
Konrad Borowski
43cb37e152 Use issue = "none" instead of "0" in intrinsics 2019-12-25 11:54:55 +01:00
bors
c5a2a9a99c Auto merge of #67596 - Mark-Simulacrum:tidy-silence-rustfmt, r=Centril
(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-25 00:41:55 +00:00
Mark Rousskov
6891388e66 x.py fmt after previous deignore 2019-12-24 17:38:22 -05:00
bors
a5bc786399 Auto merge of #67445 - llogiq:todo, r=dtolnay
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-24 21:16:45 +00:00
Andre Bogus
f4d0a04c64 Differentiate todo! and unimplemented! 2019-12-24 13:53:32 +01:00
Ohad Ravid
811bdeee00 Show value for consts in the documentation 2019-12-24 10:10:36 +01:00
Mark Rousskov
df4d490038 Minimize unsafety in encode_utf8
Use slice patterns to avoid having to skip bounds checking
2019-12-23 20:46:42 -05:00
Mark Rousskov
65e366064f docs: Iterator adapters have unspecified results after a panic 2019-12-23 11:56:08 -05:00
Mazdak Farrokhzad
68a9a2d648
Rollup merge of #67559 - Mark-Simulacrum:drop-doc, r=RalfJung
Document that calling Drop, even after it panics, is UB

Fixes #60822.

r? @gnzlbg
2019-12-23 15:16:32 +01:00
Mazdak Farrokhzad
1de2705c79
Rollup merge of #67466 - oli-obk:const_intrinsic, r=Centril
Require const stability attributes on intrinsics to be able to use them in constant contexts

r? @Centril

finally fixes #61495

cc @RalfJung
2019-12-23 15:16:23 +01:00
Oliver Scherer
63d28221c6
Fix typo 2019-12-23 15:11:09 +01:00