Commit graph

133936 commits

Author SHA1 Message Date
flip1995 99b9459a77
Fix ICE in utils::implements_trait
This only happend when debug_assertions were enabled in rustc
2020-11-23 13:52:27 +01:00
flip1995 dfac9be082
Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup 2020-11-23 13:51:04 +01:00
bors 068320b39e Auto merge of #77893 - petertodd:2020-impl-default-for-phantompinned, r=dtolnay
Impl Default for PhantomPinned

`PhantomPinned` is just a marker type, with an obvious default value (the only value). So I can't think of a reason not to do this. Sure, it's used in exotic situations with unsafe code. But the people writing that code can decide for themselves if they can derive `Default`, and in many situations the derived impl will make sense:

```rust
#[derive(Default)]
struct NeedsPin {
   marker: PhantomPinned,
   buf: [u8; 1024],
   ptr_to_data: Option<*const u8>,
}
```
2020-11-23 07:00:30 +00:00
bors 1823a87986 Auto merge of #76226 - CDirkx:const-ipaddr, r=dtolnay
Stabilize `IpAddr::is_ipv4` and `is_ipv6` as const

Insta-stabilize the methods `is_ipv4` and `is_ipv6` of `std::net::IpAddr` as const, in the same way as [PR#76198](https://github.com/rust-lang/rust/pull/76198).

Possible because of the recent stabilization of const control flow.

Part of #76225 and #76205.
2020-11-23 04:47:25 +00:00
LingMan cd8973250d Use Option::map instead of open coding it 2020-11-23 04:58:21 +01:00
oliver a804e38dde
doc typo
plus a small edit for clarity
2020-11-23 02:47:45 +00:00
bors f32459c7ba Auto merge of #79172 - a1phyr:cold_abort, r=Mark-Simulacrum
Add #[cold] attribute to `std::process::abort` and `alloc::alloc::handle_alloc_error`
2020-11-23 02:25:13 +00:00
Camelid b196bec236 Add comment and remove obsolete special case 2020-11-22 17:39:15 -08:00
Joshua Nelson 432a33e1e2 Fix typo in comment 2020-11-22 20:32:36 -05:00
Trevor Spiteri a6bcf7a2b6 const_int_pow will be stabilized in 1.50.0, not in 1.49.0
Same for constctlz.
2020-11-23 02:04:37 +01:00
Trevor Spiteri aca37b65f1 stabilize const_int_pow
Also stabilize constctlz for const ctlz_nonzero.

The public methods stabilized const by this commit are:

  * `{i*,u*}::checked_pow`
  * `{i*,u*}::saturating_pow`
  * `{i*,u*}::wrapping_pow`
  * `{i*,u*}::overflowing_pow`
  * `{i*,u*}::pow`
  * `u*::next_power_of_two`
  * `u*::checked_next_power_of_two`
  * `u*::wrapping_next_power_of_two` (the method itself is still unstable)
2020-11-23 01:58:27 +01:00
Christiaan Dirkx 4613bc96a4 Bump version to 1.50.0 2020-11-23 01:40:26 +01:00
Christiaan Dirkx 3f8fdf83ff Stabilize IpAddr::is_ipv4 and is_ipv6 as const
Insta-stabilize the methods `is_ipv4` and `is_ipv6` of `IpAddr`.

Possible because of the recent stabilization of const control flow.

Also adds a test for these methods in a const context.
2020-11-23 01:33:46 +01:00
Tomasz Miąsko fafe3cd682 Allow using -Z fewer-names=no to retain value names
Change `-Z fewer-names` into an optional boolean flag and allow using it
to either discard value names when true or retain them when false,
regardless of other settings.
2020-11-23 00:00:00 +00:00
bors 32da90b431 Auto merge of #79319 - m-ou-se:rollup-d9n5viq, r=m-ou-se
Rollup of 10 pull requests

Successful merges:

 - #76941 (Add f{32,64}::is_subnormal)
 - #77697 (Split each iterator adapter and source into individual modules)
 - #78305 (Stabilize alloc::Layout const functions)
 - #78608 (Stabilize refcell_take)
 - #78793 (Clean up `StructuralEq` docs)
 - #79267 (BTreeMap: address namespace conflicts)
 - #79293 (Add test for eval order for a+=b)
 - #79295 (BTreeMap: fix minor testing mistakes in #78903)
 - #79297 (BTreeMap: swap the names of NodeRef::new and Root::new_leaf)
 - #79299 (Stabilise `then`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-22 23:59:48 +00:00
LingMan e0871cc0be Reduce boilerplate with the ? operator 2020-11-23 00:58:53 +01:00
LingMan 674f196c50 Use Option::and_then instead of open-coding it 2020-11-22 23:44:05 +01:00
Camelid 0b6537a9ea Accept '!' in intra-doc links
This will allow linking to things like `Result<T, !>`.
2020-11-22 14:25:50 -08:00
kadmin a9915581d7 Change slice::to_vec to not use extend_from_slice
This also required adding a loop guard in case clone panics

Add specialization for copy

There is a better version for copy, so I've added specialization for that function
and hopefully that should speed it up even more.

Switch FromIter<slice::Iter> to use `to_vec`

Test different unrolling version for to_vec

Revert to impl

From benchmarking, it appears this version is faster
2020-11-22 22:22:03 +00:00
Lzu Tao 6bfe27a3e0 Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
Mara Bos 41c033b2f7
Rollup merge of #79299 - varkor:stabilise-then, r=m-ou-se
Stabilise `then`

Stabilises the lazy variant of https://github.com/rust-lang/rust/issues/64260 now that the FCP [has ended](https://github.com/rust-lang/rust/issues/64260#issuecomment-731636203).

I've kept the original feature gate `bool_to_option` for the strict variant (`then_some`), and created a new insta-stable feature gate `lazy_bool_to_option` for `then`.
2020-11-22 23:01:08 +01:00
Mara Bos d39e095331
Rollup merge of #79297 - ssomers:btree_post_redux, r=Mark-Simulacrum
BTreeMap: swap the names of NodeRef::new and Root::new_leaf

#78104 preserved the name of Root::new_leaf to minimize changes, but the resulting names are confusing.

r? `@Mark-Simulacrum`
2020-11-22 23:01:07 +01:00
Mara Bos b54838f960
Rollup merge of #79295 - ssomers:btree_fix_78903, r=Mark-Simulacrum
BTreeMap: fix minor testing mistakes in #78903

Mostly a duplicate test case
r? `@Mark-Simulacrum`
2020-11-22 23:01:05 +01:00
Mara Bos 138845d43c
Rollup merge of #79293 - Havvy:test-eval-order-compound-assign, r=Mark-Simulacrum
Add test for eval order for a+=b

Yes, the order of evaluation *does* change depending on the types of
the operands. Cursed, I know.

I've elected to place this test into `expr/compound-assignment` creating
both the `expr` directory and the `compound-assignment` directory. I
plan in a future PR to also move the `if` directory and the loose `if`
tests into `expr/if` and other similar cleanups of the `test/ui`
directory.

Future work: Test more than just `+=`, but all operators. I don't know
if using a macro to generate these tests cases would be okay or not,
but it'd be boilerplatey without it. I'm also confident you cannot
change the evaluation order of one operator without changing all of
them.

Future work: Additionally, test more than just `i32 += i32` for the
primitive version. I don't actually know the full set of primitive
implementations, but I imagine there's enough to cause a combinatorial
explosion with the previous future work item. Somewhere on the order of
one to two hundred individual functions.
2020-11-22 23:01:03 +01:00
Mara Bos 5793fa9cda
Rollup merge of #79267 - ssomers:btree_namespaces, r=Mark-Simulacrum
BTreeMap: address namespace conflicts

Fix an annoyance popping up whenever synchronizing the test cases with a version capable of miri-track-raw-pointers.

r? `@Mark-Simulacrum`
2020-11-22 23:01:02 +01:00
Mara Bos 8a623e6f98
Rollup merge of #78793 - camelid:fixup-structuraleq, r=jyn514
Clean up `StructuralEq` docs
2020-11-22 23:01:00 +01:00
Mara Bos b249844c33
Rollup merge of #78608 - ThinkChaos:stabilize_refcell_take, r=m-ou-se
Stabilize refcell_take

Tracking Issue: #71395

``@KodrAus`` nominated this for FCP, so here's a PR!
I've never made a stabilization PR, so please mention if there's anything I can improve, thanks.
2020-11-22 23:00:58 +01:00
Mara Bos 186ec64947
Rollup merge of #78305 - ChrisDenton:const-layout, r=oli-obk
Stabilize alloc::Layout const functions

Stabilizes #67521. In particular the following stable methods are stabilized as `const fn`:

* `size`
* `align`
* `from_size_align`

Stabilizing `size` and `align` should not be controversial as they are simple (usize and NonZeroUsize) fields and I don't think there's any reason to make them not const compatible in the future. That being true, the other methods are trivially `const`. The only other issue being returning a `Result` from a `const fn` but this has been made more usable by recent stabilizations.
2020-11-22 23:00:56 +01:00
Mara Bos 4407049fcb
Rollup merge of #77697 - WaffleLapkin:iter_split_adaptors, r=m-ou-se
Split each iterator adapter and source into individual modules

This PR creates individual modules for each iterator adapter and iterator source.

This is done to enhance the readability of corresponding modules (`adapters/mod.rs` and `sources.rs`) which were hard to navigate and read because of lots of repeated lines (e.g.: `adapters/mod.rs` was 3k lines long). This is also in line with some adapters which already had their own modules (`Flatten`, `FlatMap`, `Chain`, `Zip`, `Fuse`).

This PR also makes `Take`s adapter fields private (I have no idea why they were `pub(super)` before).

r? ``@LukasKalbertodt``
2020-11-22 23:00:55 +01:00
Mara Bos 9b98f1d226
Rollup merge of #76941 - clarfonthey:is_subnormal, r=m-ou-se
Add f{32,64}::is_subnormal

The docs recommend that you use dedicated methods instead of calling `classify` directly, although there isn't actually a way of checking if a number is subnormal without calling classify. There are dedicated methods for all other forms, excluding `is_zero` (which is just `== 0.0` anyway).
2020-11-22 23:00:48 +01:00
Chris Denton 9050d12714
Stabilize alloc::Layout const functions
Stabilizes #67521. In particular the following stable methods are stabilized as const fn:

* size
* align
* from_size_align
2020-11-22 21:43:30 +00:00
bors a0d664bae6 Auto merge of #79219 - shepmaster:beta-bump, r=Mark-Simulacrum
Bump bootstrap compiler version

r? `@Mark-Simulacrum`

/cc `@pietroalbini`
2020-11-22 21:38:03 +00:00
ltdk cf26f2f00e Add f{32,64}::is_subnormal 2020-11-22 15:37:46 -05:00
ThinkChaos 5c6689baff Stabilize refcell_take 2020-11-22 20:13:31 +01:00
Joshua Nelson 0043fc9ce6 Get rid of doctree::Impl 2020-11-22 13:52:31 -05:00
bors c643dd2ec8 Auto merge of #79243 - Nadrieril:consolidate-tests, r=varkor
Consolidate exhaustiveness-related tests

I hunted for tests that only exercised the match exhaustiveness algorithm and regrouped them. I also improved integer-range tests since I had found them lacking while hacking around.
The interest is mainly so that one can pass `--test-args patterns` and catch most relevant tests.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking
2020-11-22 18:29:38 +00:00
Joshua Nelson ab1e634295 Make fold_item_recur non-nullable
This gets rid of a bunch of `unwrap()`s and makes it a little more clear
what's going on.

Originally I wanted to make `fold_item` non-nullable too, which would
have been a lot nicer to work with, but unfortunately `stripper` does
actually return `None` in some places. I might make a follow-up moving
stripper to be special and not a pass so that passes can be
non-nullable.
2020-11-22 12:59:01 -05:00
bors 52e3cf13aa Auto merge of #79306 - GuillaumeGomez:rollup-4cnudfj, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #78670 (Remove FIXME comment in some incremental test suite)
 - #79292 (Fix typo in doc comment for report_too_many_hashes)
 - #79300 (Prevent feature information to be hidden if it's on the impl directly)
 - #79302 (Add regression test for issue 73899)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-22 15:40:03 +00:00
bors 3e7c6dec24 Auto merge of #6361 - integer32llc:doc-style, r=carols10cents
Small grammar, punctuation, and code style improvements to docs

changelog: Made small grammar, punctuation, and code style improvements to docs

I recently found some places in rust-lang/rust that had lists without spaces after commas, which led me to look for more places, which led me over here to find:

- Some similar lists in code examples that could use spaces after commas to be idiomatic Rust style
- Some lists in documentation text that didn't have spaces after commas, needed an Oxford comma (fight me), or were otherwise misformatted
- Some other grammar improvements in the area of the other changes

These changes should only be in user-facing documentation or output.
2020-11-22 15:34:56 +00:00
Carol (Nichols || Goulding) 445466e567
Apply suggestions from code review to change "that" to "which"
Co-authored-by: oliver <16816606+o752d@users.noreply.github.com>
2020-11-22 10:17:34 -05:00
Carol (Nichols || Goulding) 034244f108
Small grammar, punctuation, and code style improvements to docs 2020-11-22 10:17:34 -05:00
Guillaume Gomez 749fe400c8
Rollup merge of #79302 - est31:issue_73899_test, r=lcnr
Add regression test for issue 73899

Closes #73899
2020-11-22 16:15:15 +01:00
Guillaume Gomez 70a839fd8f
Rollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514
Prevent feature information to be hidden if it's on the impl directly

Fixes #79279.

So when a `#[doc(cfg...)]` is used on a trait impl directly, it's not hidden by the toggle.

![Screenshot from 2020-11-22 14-40-11](https://user-images.githubusercontent.com/3050060/99905528-997fab00-2cd1-11eb-83be-ed06b0cb97df.png)

r? `@jyn514`
2020-11-22 16:15:13 +01:00
Guillaume Gomez 5c982b7ca2
Rollup merge of #79292 - nico-abram:master, r=jonas-schievink
Fix typo in doc comment for report_too_many_hashes

"to big" -> "too big"
2020-11-22 16:15:12 +01:00
Guillaume Gomez 876024dad5
Rollup merge of #78670 - sasurau4:test/check-pass-incremental, r=jyn514
Remove FIXME comment in some incremental test suite

Helps with #62277

I removed FIXME comment in some incremental tests with [rustc_partition_codegened](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_incremental/assert_module_sources/index.html). This seems using codegen process. So it uses intentionally `build-pass`
2020-11-22 16:15:10 +01:00
Guillaume Gomez 28a94a3ae5 Prevent feature information to be hidden if it's on the impl directly 2020-11-22 16:10:16 +01:00
Jonas Schievink cb406848ec Add some more tests 2020-11-22 15:51:05 +01:00
est31 c2a1dfacb4 Add regression test for issue 73899
Adds regression test for https://github.com/rust-lang/rust/issues/73899
2020-11-22 15:36:37 +01:00
bors 831aa9607a Auto merge of #6363 - o752d:patch-2, r=flip1995
a typo

typo

changelog: none
2020-11-22 14:08:01 +00:00
bors 4284ec3859 Auto merge of #6364 - o752d:master, r=flip1995
revisiting a typo

changelog: none
2020-11-22 13:48:02 +00:00