]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup
flip1995 [Mon, 23 Nov 2020 12:51:04 +0000 (13:51 +0100)]
Merge commit '3e7c6dec244539970b593824334876f8b6ed0b18' into clippyup

3 years agoAuto merge of #77893 - petertodd:2020-impl-default-for-phantompinned, r=dtolnay
bors [Mon, 23 Nov 2020 07:00:30 +0000 (07:00 +0000)]
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>,
}
```

3 years agoAuto merge of #76226 - CDirkx:const-ipaddr, r=dtolnay
bors [Mon, 23 Nov 2020 04:47:25 +0000 (04:47 +0000)]
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.

3 years agoAuto merge of #79172 - a1phyr:cold_abort, r=Mark-Simulacrum
bors [Mon, 23 Nov 2020 02:25:13 +0000 (02:25 +0000)]
Auto merge of #79172 - a1phyr:cold_abort, r=Mark-Simulacrum

Add #[cold] attribute to `std::process::abort` and `alloc::alloc::handle_alloc_error`

3 years agoBump version to 1.50.0
Christiaan Dirkx [Mon, 23 Nov 2020 00:40:26 +0000 (01:40 +0100)]
Bump version to 1.50.0

3 years agoStabilize `IpAddr::is_ipv4` and `is_ipv6` as const
Christiaan Dirkx [Wed, 2 Sep 2020 00:05:42 +0000 (02:05 +0200)]
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.

3 years agoAuto merge of #79319 - m-ou-se:rollup-d9n5viq, r=m-ou-se
bors [Sun, 22 Nov 2020 23:59:48 +0000 (23:59 +0000)]
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

3 years agoRollup merge of #79299 - varkor:stabilise-then, r=m-ou-se
Mara Bos [Sun, 22 Nov 2020 22:01:08 +0000 (23:01 +0100)]
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`.

3 years agoRollup merge of #79297 - ssomers:btree_post_redux, r=Mark-Simulacrum
Mara Bos [Sun, 22 Nov 2020 22:01:07 +0000 (23:01 +0100)]
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`

3 years agoRollup merge of #79295 - ssomers:btree_fix_78903, r=Mark-Simulacrum
Mara Bos [Sun, 22 Nov 2020 22:01:05 +0000 (23:01 +0100)]
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`

3 years agoRollup merge of #79293 - Havvy:test-eval-order-compound-assign, r=Mark-Simulacrum
Mara Bos [Sun, 22 Nov 2020 22:01:03 +0000 (23:01 +0100)]
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.

3 years agoRollup merge of #79267 - ssomers:btree_namespaces, r=Mark-Simulacrum
Mara Bos [Sun, 22 Nov 2020 22:01:02 +0000 (23:01 +0100)]
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`

3 years agoRollup merge of #78793 - camelid:fixup-structuraleq, r=jyn514
Mara Bos [Sun, 22 Nov 2020 22:01:00 +0000 (23:01 +0100)]
Rollup merge of #78793 - camelid:fixup-structuraleq, r=jyn514

Clean up `StructuralEq` docs

3 years agoRollup merge of #78608 - ThinkChaos:stabilize_refcell_take, r=m-ou-se
Mara Bos [Sun, 22 Nov 2020 22:00:58 +0000 (23:00 +0100)]
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.

3 years agoRollup merge of #78305 - ChrisDenton:const-layout, r=oli-obk
Mara Bos [Sun, 22 Nov 2020 22:00:56 +0000 (23:00 +0100)]
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.

3 years agoRollup merge of #77697 - WaffleLapkin:iter_split_adaptors, r=m-ou-se
Mara Bos [Sun, 22 Nov 2020 22:00:55 +0000 (23:00 +0100)]
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``

3 years agoRollup merge of #76941 - clarfonthey:is_subnormal, r=m-ou-se
Mara Bos [Sun, 22 Nov 2020 22:00:48 +0000 (23:00 +0100)]
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).

3 years agoStabilize `alloc::Layout const` functions
Chris Denton [Sun, 22 Nov 2020 21:21:46 +0000 (21:21 +0000)]
Stabilize `alloc::Layout const` functions

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

* size
* align
* from_size_align

3 years agoAuto merge of #79219 - shepmaster:beta-bump, r=Mark-Simulacrum
bors [Sun, 22 Nov 2020 21:38:03 +0000 (21:38 +0000)]
Auto merge of #79219 - shepmaster:beta-bump, r=Mark-Simulacrum

Bump bootstrap compiler version

r? `@Mark-Simulacrum`

/cc `@pietroalbini`

3 years agoAdd f{32,64}::is_subnormal
ltdk [Sat, 19 Sep 2020 20:31:47 +0000 (16:31 -0400)]
Add f{32,64}::is_subnormal

3 years agoStabilize refcell_take
ThinkChaos [Sat, 31 Oct 2020 18:06:25 +0000 (19:06 +0100)]
Stabilize refcell_take

3 years agoAuto merge of #79243 - Nadrieril:consolidate-tests, r=varkor
bors [Sun, 22 Nov 2020 18:29:38 +0000 (18:29 +0000)]
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

3 years agoAuto merge of #79306 - GuillaumeGomez:rollup-4cnudfj, r=GuillaumeGomez
bors [Sun, 22 Nov 2020 15:40:03 +0000 (15:40 +0000)]
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

3 years agoAuto merge of #6361 - integer32llc:doc-style, r=carols10cents
bors [Sun, 22 Nov 2020 15:34:56 +0000 (15:34 +0000)]
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.

3 years agoApply suggestions from code review to change "that" to "which"
Carol (Nichols || Goulding) [Sun, 22 Nov 2020 15:12:41 +0000 (10:12 -0500)]
Apply suggestions from code review to change "that" to "which"

Co-authored-by: oliver <16816606+o752d@users.noreply.github.com>
3 years agoSmall grammar, punctuation, and code style improvements to docs
Carol (Nichols || Goulding) [Sat, 21 Nov 2020 20:00:03 +0000 (15:00 -0500)]
Small grammar, punctuation, and code style improvements to docs

3 years agoRollup merge of #79302 - est31:issue_73899_test, r=lcnr
Guillaume Gomez [Sun, 22 Nov 2020 15:15:15 +0000 (16:15 +0100)]
Rollup merge of #79302 - est31:issue_73899_test, r=lcnr

Add regression test for issue 73899

Closes #73899

3 years agoRollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514
Guillaume Gomez [Sun, 22 Nov 2020 15:15:13 +0000 (16:15 +0100)]
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`

3 years agoRollup merge of #79292 - nico-abram:master, r=jonas-schievink
Guillaume Gomez [Sun, 22 Nov 2020 15:15:12 +0000 (16:15 +0100)]
Rollup merge of #79292 - nico-abram:master, r=jonas-schievink

Fix typo in doc comment for report_too_many_hashes

"to big" -> "too big"

3 years agoRollup merge of #78670 - sasurau4:test/check-pass-incremental, r=jyn514
Guillaume Gomez [Sun, 22 Nov 2020 15:15:10 +0000 (16:15 +0100)]
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`

3 years agoPrevent feature information to be hidden if it's on the impl directly
Guillaume Gomez [Sun, 22 Nov 2020 13:45:54 +0000 (14:45 +0100)]
Prevent feature information to be hidden if it's on the impl directly

3 years agoAdd regression test for issue 73899
est31 [Sun, 22 Nov 2020 13:53:31 +0000 (14:53 +0100)]
Add regression test for issue 73899

Adds regression test for https://github.com/rust-lang/rust/issues/73899

3 years agoAuto merge of #6363 - o752d:patch-2, r=flip1995
bors [Sun, 22 Nov 2020 14:08:01 +0000 (14:08 +0000)]
Auto merge of #6363 - o752d:patch-2, r=flip1995

a typo

typo

changelog: none

3 years agoAuto merge of #6364 - o752d:master, r=flip1995
bors [Sun, 22 Nov 2020 13:48:02 +0000 (13:48 +0000)]
Auto merge of #6364 - o752d:master, r=flip1995

revisiting a typo

changelog: none

3 years agoStabilise `then`
varkor [Sun, 22 Nov 2020 13:25:19 +0000 (13:25 +0000)]
Stabilise `then`

3 years agoAuto merge of #78816 - SkiFire13:fix-slice-pointer-provenance, r=RalfJung
bors [Sun, 22 Nov 2020 13:10:15 +0000 (13:10 +0000)]
Auto merge of #78816 - SkiFire13:fix-slice-pointer-provenance, r=RalfJung

<[T]>::reverse: Fix pointer provenance rules

Should fix #78749

3 years agoBTreeMap: swap the names of NodeRef::new and Root::new_leaf
Stein Somers [Sun, 22 Nov 2020 11:29:48 +0000 (12:29 +0100)]
BTreeMap: swap the names of NodeRef::new and Root::new_leaf

3 years agoBTreeMap: fix minor testing mistakes in #78903
Stein Somers [Sun, 22 Nov 2020 12:06:12 +0000 (13:06 +0100)]
BTreeMap: fix minor testing mistakes in #78903

3 years agoAdd test for eval order for a+=b
Havvy (Ryan Scheel) [Sun, 22 Nov 2020 10:48:14 +0000 (02:48 -0800)]
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.

3 years agoAuto merge of #77872 - Xaeroxe:stabilize-clamp, r=scottmcm
bors [Sun, 22 Nov 2020 10:50:04 +0000 (10:50 +0000)]
Auto merge of #77872 - Xaeroxe:stabilize-clamp, r=scottmcm

Stabilize clamp

Tracking issue: https://github.com/rust-lang/rust/issues/44095

Clamp has been merged and unstable for about a year and a half now. How do we feel about stabilizing this?

3 years agoFix typo in doc comment for report_too_many_hashes
Nicolas [Sun, 22 Nov 2020 10:02:58 +0000 (07:02 -0300)]
Fix typo in doc comment for report_too_many_hashes

"to big" -> "too big"

3 years agoAuto merge of #79275 - integer32llc:doc-style, r=jonas-schievink
bors [Sun, 22 Nov 2020 08:30:23 +0000 (08:30 +0000)]
Auto merge of #79275 - integer32llc:doc-style, r=jonas-schievink

More consistently use spaces after commas in lists in docs

This PR changes instances of lists that didn't use spaces after commas, like `vec![1,2,3]`, to `vec![1, 2, 3]` to be more consistent with idiomatic Rust style (the way these were looks strange to me, especially because there are often lists that *do* use spaces after the commas later in the same code block ðŸ˜¬).

I noticed one of these in an example in the stdlib docs and went looking for more, but as far as I can see, I'm only changing those spots in user-facing documentation or rustc output, and the changes make no semantic difference.

3 years agoupdate
oliver [Sun, 22 Nov 2020 04:50:09 +0000 (00:50 -0400)]
update

3 years agoa typo
oliver [Sun, 22 Nov 2020 04:44:47 +0000 (04:44 +0000)]
a typo

typo

3 years agoAuto merge of #79229 - sdroege:slice-fill-memset, r=dtolnay
bors [Sun, 22 Nov 2020 04:27:03 +0000 (04:27 +0000)]
Auto merge of #79229 - sdroege:slice-fill-memset, r=dtolnay

Add "memset" as doc alias to slice::fill()

Similar to 53f969dfd1b5c128145c24653c668193e8c50f85 and should make it easier for people coming from C to find this function.

3 years agoAuto merge of #78752 - jyn514:html-diff, r=GuillaumeGomez
bors [Sun, 22 Nov 2020 01:09:04 +0000 (01:09 +0000)]
Auto merge of #78752 - jyn514:html-diff, r=GuillaumeGomez

Give a better error when rustdoc tests fail

- Run the default rustdoc against the current rustdoc
- Diff output recursively
- Colorize diff output

Closes https://github.com/rust-lang/rust/issues/78750.

## Resolved questions

- Should this be opt-in instead of on by default?
  + No
- Should this call through to `delta`? That's not a very common program to have installed, but I'm not sure how to do diffs after the fact. Maybe `compiletest` can take a `--syntax-highlighter` parameter or something?
  + I decided to use `delta` if available and `diff --color` otherwise. It prints a warning if delta isn't installed so you know you can get nicer diffs

## Open questions.

- What version of rustdoc would this compare against? Ideally it would compare against `$(git merge-base HEAD origin/master)` - maybe that's feasible if we install those artifacts from CI?
- Does it always make sense to compare the tests? Especially for new tests, I'm not sure how useful it would be ... but then again, one of the questions I want to know most as a reviewer is 'did it break before?'.

r? `@GuillaumeGomez`
cc `@Mark-Simulacrum`

3 years agoRemove multiline `use`s
Waffle [Thu, 8 Oct 2020 17:08:40 +0000 (20:08 +0300)]
Remove multiline `use`s

3 years agoFix UI tests
Waffle [Thu, 8 Oct 2020 15:18:28 +0000 (18:18 +0300)]
Fix UI tests

Some UI tests started failing after moving iterator adapters to different modules.

3 years agoFix doc links in core::iter::sources
Waffle [Thu, 8 Oct 2020 11:02:28 +0000 (14:02 +0300)]
Fix doc links in core::iter::sources

3 years agoMerge `use`s in core::iter
Waffle [Wed, 7 Oct 2020 23:26:29 +0000 (02:26 +0300)]
Merge `use`s in core::iter

3 years agoSplit iterator sources into different modules
Waffle [Wed, 7 Oct 2020 22:08:01 +0000 (01:08 +0300)]
Split iterator sources into different modules

3 years agoSplit iterator adaptors into individual modules
Waffle [Wed, 7 Oct 2020 21:14:11 +0000 (00:14 +0300)]
Split iterator adaptors into individual modules

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

3 years agoAuto merge of #78461 - TimDiekmann:vec-alloc, r=Amanieu
bors [Sat, 21 Nov 2020 22:46:50 +0000 (22:46 +0000)]
Auto merge of #78461 - TimDiekmann:vec-alloc, r=Amanieu

Add support for custom allocators in `Vec`

This follows the [roadmap](https://github.com/rust-lang/wg-allocators/issues/7) of the allocator WG to add custom allocators to collections.

r? `@Amanieu`

This pull request requires a crater run.

### Prior work:
- #71873: Crater-test to solve rust-lang/wg-allocators#1
- [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate

3 years agoAuto merge of #79273 - Dylan-DPC:rollup-zd10xlt, r=Dylan-DPC
bors [Sat, 21 Nov 2020 20:18:11 +0000 (20:18 +0000)]
Auto merge of #79273 - Dylan-DPC:rollup-zd10xlt, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #77844 (clarify rules for ZST Boxes)
 - #79067 (Refactor the abi handling code a bit)
 - #79182 (Fix links to extern types in rustdoc (fixes #78777))
 - #79231 (Exhaustively match in variant count instrinsic)
 - #79238 (Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout.)
 - #79256 (Fix typos)
 - #79264 (Get rid of some doctree items)
 - #79272 (Support building clone shims for arrays with generic size)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoMore consistently use spaces after commas in lists in docs
Carol (Nichols || Goulding) [Sat, 21 Nov 2020 19:43:34 +0000 (14:43 -0500)]
More consistently use spaces after commas in lists in docs

3 years agoRollup merge of #79272 - tmiasko:array-clone, r=jonas-schievink
Dylan DPC [Sat, 21 Nov 2020 18:44:20 +0000 (19:44 +0100)]
Rollup merge of #79272 - tmiasko:array-clone, r=jonas-schievink

Support building clone shims for arrays with generic size

Fixes #79269.

3 years agoRollup merge of #79264 - jyn514:less-doctree, r=GuillaumeGomez
Dylan DPC [Sat, 21 Nov 2020 18:44:18 +0000 (19:44 +0100)]
Rollup merge of #79264 - jyn514:less-doctree, r=GuillaumeGomez

Get rid of some doctree items

They can be derived directly from the `hir::Item`, there's no special logic.

- TypeDef
- OpaqueTy
- Constant
- Static
- TraitAlias
- Enum
- Union
- Struct

Part of #78082 (the easiest part, I'm still debugging some other changes).
r? `@GuillaumeGomez`

3 years agoRollup merge of #79256 - bugadani:query-typo, r=jonas-schievink
Dylan DPC [Sat, 21 Nov 2020 18:44:16 +0000 (19:44 +0100)]
Rollup merge of #79256 - bugadani:query-typo, r=jonas-schievink

Fix typos

3 years agoRollup merge of #79238 - eddyb:rustc-log-stderr, r=jyn514
Dylan DPC [Sat, 21 Nov 2020 18:44:15 +0000 (19:44 +0100)]
Rollup merge of #79238 - eddyb:rustc-log-stderr, r=jyn514

Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout.

Looks like this got missed in the initial implementation, AFAIK the old behavior was to output on stderr.
(Hit this while trying to debug `rustc` running inside a build script which was only letting stderr through)

r? ``@oli-obk`` cc ``@davidbarsky`` ``@hawkw``

3 years agoRollup merge of #79231 - wusyong:issue-79137, r=lcnr
Dylan DPC [Sat, 21 Nov 2020 18:44:13 +0000 (19:44 +0100)]
Rollup merge of #79231 - wusyong:issue-79137, r=lcnr

Exhaustively match in variant count instrinsic

Fix #79137

3 years agoRollup merge of #79182 - lochsh:78777-fix-extern-types-ref, r=jyn514
Dylan DPC [Sat, 21 Nov 2020 18:44:11 +0000 (19:44 +0100)]
Rollup merge of #79182 - lochsh:78777-fix-extern-types-ref, r=jyn514

Fix links to extern types in rustdoc (fixes #78777)

 r? `@jyn514`
 Fixes #78777.
The initial fix we tried was:
```diff
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 8be9482acff..c4b7086fdb1 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
`@@` -433,8 +433,9 `@@` impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
             Res::PrimTy(prim) => Some(
                 self.resolve_primitive_associated_item(prim, ns, module_id, item_name, item_str),
             ),
-            Res::Def(DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::TyAlias, did) => {
+            Res::Def(kind, did) if kind.ns() == Some(Namespace::TypeNS) => {
                 debug!("looking for associated item named {} for item {:?}", item_name, did);
+
                 // Checks if item_name belongs to `impl SomeItem`
                 let assoc_item = cx
                     .tcx
```

However, this caused traits to be matched, resulting in a panic when `resolve_associated_trait_item` is called further down in this function.

This PR also adds an error message for that panic. Currently it will look something like:
```rust
thread 'rustc' panicked at 'Not a type: DefIndex(8624)', compiler/rustc_metadata/src/rmeta/decoder.rs:951:32
```
I wasn't sure how to get a better debug output than `DefIndex(...)`, and am open to suggestions.

3 years agoRollup merge of #79067 - bjorn3:abi_refactor, r=nagisa
Dylan DPC [Sat, 21 Nov 2020 18:44:10 +0000 (19:44 +0100)]
Rollup merge of #79067 - bjorn3:abi_refactor, r=nagisa

Refactor the abi handling code a bit

I am not quite sure if all changes are improvements.

3 years agoRollup merge of #77844 - RalfJung:zst-box, r=nikomatsakis
Dylan DPC [Sat, 21 Nov 2020 18:44:07 +0000 (19:44 +0100)]
Rollup merge of #77844 - RalfJung:zst-box, r=nikomatsakis

clarify rules for ZST Boxes

LLVM's rules around `getelementptr inbounds` with offset 0 are a bit annoying, and as a consequence we have no choice but say that a `Box<()>` pointing to previously allocated memory that has since been freed is UB. Clarify the docs to reflect this.

This is based on conversations on the LLVM mailing list.
* Here's my initial mail: https://lists.llvm.org/pipermail/llvm-dev/2019-February/130452.html
* The first email of the March part of that thread: https://lists.llvm.org/pipermail/llvm-dev/2019-March/130831.html
* First email of the April part: https://lists.llvm.org/pipermail/llvm-dev/2019-April/131693.html

The conclusion for me at least was that `getelementptr inbounds` with offset 0 is *not* the identity function, but can sometimes return `poison` even when the input is a regular pointer -- specifically, it returns `poison` when this pointer points into something that LLVM "knows has been deallocated", i.e., a former LLVM-managed allocation. It is however the identity function on pointers obtained by casting integers.

Note that there [are formal proposals](https://people.mpi-sws.org/~jung/twinsem/twinsem.pdf) for LLVM semantics where `getelementptr inbounds` with offset 0 isn't quite the identity function but never returns `poison` (it affects the provenance of the pointer but in a way that doesn't matter if this pointer is never used for memory accesses), and indeed this is likely necessary to consistently describe LLVM semantics. But with the informal LLVM LangRef that we have right now, and with LLVM devs insisting otherwise, it seems unwise to rely on this.

3 years agoReplace sext() and zext() with single ext() method
bjorn3 [Sat, 21 Nov 2020 18:06:35 +0000 (19:06 +0100)]
Replace sext() and zext() with single ext() method

3 years agoRename prefix_chunk to prefix_chunk_size
bjorn3 [Sun, 15 Nov 2020 09:12:10 +0000 (10:12 +0100)]
Rename prefix_chunk to prefix_chunk_size

3 years agoRemove StructRet arg attr
bjorn3 [Sat, 14 Nov 2020 18:16:43 +0000 (19:16 +0100)]
Remove StructRet arg attr

It is applied exactly when the return value has an indirect pass mode.
Except for InReg on x86 fastcall, arg attrs are now only used for
optimization purposes and thus are fine to ignore.

3 years agoReplace ByVal attribute with on_stack field for Indirect
bjorn3 [Sat, 14 Nov 2020 13:29:40 +0000 (14:29 +0100)]
Replace ByVal attribute with on_stack field for Indirect

This makes it clearer that only PassMode::Indirect allows ByVal

3 years agoReplace ZExt and SExt flags with ArgExtension enum
bjorn3 [Sat, 14 Nov 2020 11:27:57 +0000 (12:27 +0100)]
Replace ZExt and SExt flags with ArgExtension enum

Both flags are mutually exclusive

3 years agoAuto merge of #79237 - alexcrichton:update-backtrace, r=Mark-Simulacrum
bors [Sat, 21 Nov 2020 18:05:07 +0000 (18:05 +0000)]
Auto merge of #79237 - alexcrichton:update-backtrace, r=Mark-Simulacrum

std: Update the bactrace crate submodule

This commit updates the `library/backtrace` submodule which primarily
pulls in support for split-debuginfo on macOS, avoiding the need for
`dsymutil` to get run to get line numbers and filenames in backtraces.

3 years agox.py test --bless
Joshua Nelson [Sat, 21 Nov 2020 16:08:58 +0000 (11:08 -0500)]
x.py test --bless

3 years agoAuto merge of #79115 - cuviper:rust-description, r=Mark-Simulacrum
bors [Sat, 21 Nov 2020 15:43:09 +0000 (15:43 +0000)]
Auto merge of #79115 - cuviper:rust-description, r=Mark-Simulacrum

x.py: allow a custom string appended to the version

This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.

3 years agoFix wrong names when inlining
Joshua Nelson [Sat, 21 Nov 2020 15:10:03 +0000 (10:10 -0500)]
Fix wrong names when inlining

3 years agoAdd more tests for renamed items
Joshua Nelson [Sat, 21 Nov 2020 15:16:07 +0000 (10:16 -0500)]
Add more tests for renamed items

3 years agoGet rid of some doctree items
Joshua Nelson [Sat, 21 Nov 2020 04:50:13 +0000 (23:50 -0500)]
Get rid of some doctree items

They can be derived directly from the `hir::Item`, there's no special
logic.

- TypeDef
- OpaqueTy
- Constant
- Static
- TraitAlias
- Enum
- Union
- Struct

3 years agoBTreeMap: address namespace conflicts
Stein Somers [Thu, 5 Nov 2020 12:23:11 +0000 (13:23 +0100)]
BTreeMap: address namespace conflicts

3 years agoAuto merge of #77805 - JohnTitor:non-standard-char-sugg, r=Dylan-DPC
bors [Sat, 21 Nov 2020 13:11:35 +0000 (13:11 +0000)]
Auto merge of #77805 - JohnTitor:non-standard-char-sugg, r=Dylan-DPC

lint: Do not provide suggestions for non standard characters

Fixes #77273

Only provide suggestions if the case-fixed result is different than the original.

3 years agoAuto merge of #79250 - RalfJung:miri, r=RalfJung
bors [Sat, 21 Nov 2020 10:53:56 +0000 (10:53 +0000)]
Auto merge of #79250 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/79226
Cc `@rust-lang/miri` r? `@ghost`

3 years agoAuto merge of #79222 - yoshuawuyts:slice-fill-with, r=m-ou-se
bors [Sat, 21 Nov 2020 08:15:16 +0000 (08:15 +0000)]
Auto merge of #79222 - yoshuawuyts:slice-fill-with, r=m-ou-se

Add `core::slice::fill_with`

Tracking issue https://github.com/rust-lang/rust/issues/79221.

As suggested by `@m-ou-se` in https://github.com/rust-lang/rust/issues/70758#issuecomment-726838099 this implements `slice::fill_with` as a counterpart to `slice::fill`. This mirrors `Vec::resize` and `Vec::resize_with`. Thanks!

r? `@m-ou-se`

3 years agoFix typos
Dániel Buga [Sat, 21 Nov 2020 08:06:45 +0000 (09:06 +0100)]
Fix typos

3 years agoAuto merge of #79003 - petrochenkov:innertest, r=estebank
bors [Sat, 21 Nov 2020 05:52:16 +0000 (05:52 +0000)]
Auto merge of #79003 - petrochenkov:innertest, r=estebank

rustc_expand: Mark inner `#![test]` attributes as soft-unstable

Custom inner attributes are feature gated (https://github.com/rust-lang/rust/issues/54726) except for attributes having name `test` literally, which are not gated for historical reasons.

`#![test]` is an inner proc macro attribute, so it has all the issues described in https://github.com/rust-lang/rust/issues/54726 too.
This PR gates it with the `soft_unstable` lint.

3 years agoFix comments of toogeneris test
Ngo Iok Ui [Sat, 21 Nov 2020 05:47:09 +0000 (13:47 +0800)]
Fix comments of toogeneris test

3 years agoList all variants of TyKind
Ngo Iok Ui [Sat, 21 Nov 2020 05:45:59 +0000 (13:45 +0800)]
List all variants of TyKind

3 years agoMove from bash to rust
Joshua Nelson [Sat, 21 Nov 2020 03:58:46 +0000 (22:58 -0500)]
Move from bash to rust

3 years agoImprove integer range tests
Nadrieril [Fri, 20 Nov 2020 19:03:56 +0000 (19:03 +0000)]
Improve integer range tests

3 years agoAuto merge of #78588 - HeroicKatora:sccc, r=nikomatsakis
bors [Sat, 21 Nov 2020 01:30:26 +0000 (01:30 +0000)]
Auto merge of #78588 - HeroicKatora:sccc, r=nikomatsakis

Reworks Sccc computation to iteration instead of recursion

Linear graphs, producing as many scc's as nodes, would recurse once for every node when entered from the start of the list. This adds a test that exhausted the stack at least on my machine with error:

```
thread 'graph::scc::tests::test_deep_linear' has overflowed its stack
fatal runtime error: stack overflow
```

This may or may not be connected to #78567. I was only reminded that I started this rework some time ago. It might be plausible as borrow checking a long function with many borrow regions around each other—((((((…))))))— may produce the linear list setup to trigger this stack overflow ? I don't know enough about borrow check to say for sure.

This is best read in two separate commits. The first addresses only `find_state` internally. This is classical union phase from union-find. There's also a common solution of using the parent pointers in the (virtual) linked list to track the backreferences while traversing upwards and then following them backwards in a second path compression phase.

The second is more involved as it rewrites the mutually recursive `walk_node` and `walk_unvisited_node`. Firstly, the caller is required to handle the unvisited case of `walk_node` so a new `start_walk_from` method is added to handle that by walking the unvisited node if necessary. Then `walk_unvisited_node`, where we would previously recurse into in the missing case, is rewritten to construct a manual stack of its frames. The state fields consist of the previous stack slots.

3 years agoSupport building clone shims for arrays with generic size
Tomasz MiÄ…sko [Sat, 21 Nov 2020 00:00:00 +0000 (00:00 +0000)]
Support building clone shims for arrays with generic size

3 years agoupdate miri
Ralf Jung [Fri, 20 Nov 2020 23:35:48 +0000 (00:35 +0100)]
update miri

3 years agoAuto merge of #78569 - bugadani:arena-spec, r=Mark-Simulacrum
bors [Fri, 20 Nov 2020 23:21:34 +0000 (23:21 +0000)]
Auto merge of #78569 - bugadani:arena-spec, r=Mark-Simulacrum

Arena: use specialization to avoid copying data

In several cases, a `Vec` or `SmallVec` is passed to `Arena::alloc_from_iter` directly. This PR makes sure those cases don't copy their data unnecessarily, by specializing the `alloc_from_iter` implementation.

3 years agoUse specialization to avoid copying
Dániel Buga [Fri, 30 Oct 2020 10:42:44 +0000 (11:42 +0100)]
Use specialization to avoid copying

3 years agostd: Update the backtrace crate submodule
Alex Crichton [Fri, 20 Nov 2020 17:12:14 +0000 (09:12 -0800)]
std: Update the backtrace crate submodule

This commit updates the `library/backtrace` submodule which primarily
pulls in support for split-debuginfo on macOS, avoiding the need for
`dsymutil` to get run to get line numbers and filenames in backtraces.

3 years agoWe missed 1.49.0, so bump version to 1.50.0
Jacob Kiesel [Fri, 20 Nov 2020 17:37:22 +0000 (10:37 -0700)]
We missed 1.49.0, so bump version to 1.50.0

3 years agoDirect RUSTC_LOG (tracing/log) output to stderr instead of stdout.
Eduard-Mihai Burtescu [Fri, 20 Nov 2020 17:34:44 +0000 (19:34 +0200)]
Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout.

3 years agoAuto merge of #6354 - Daniel-B-Smith:refcell_ref_await, r=flip1995
bors [Fri, 20 Nov 2020 16:51:41 +0000 (16:51 +0000)]
Auto merge of #6354 - Daniel-B-Smith:refcell_ref_await, r=flip1995

Downgrade the await holding lints from correctness

We found a false positive in these lints (see https://github.com/rust-lang/rust-clippy/issues/6353 for more details). As a short-term mitigation, this downgrades the lints from correctness to limit the noise.

changelog: downgrade AWAIT_HOLDING_REFCELL_REF and AWAIT_HOLDING_LOCK to pedantic. From rustup earlier, where I forgot the changlog: deprecate [`panic_params`] (uplifted)

3 years agoRevert "Convert the await holding lints to correctness"
Daniel Smith [Fri, 20 Nov 2020 16:35:15 +0000 (11:35 -0500)]
Revert "Convert the await holding lints to correctness"

This reverts commit d8c6bce4407b1c99ed961f75a093ffe767818069.

3 years agorustc_expand: Mark inner `#![test]` attributes as soft-unstable
Vadim Petrochenkov [Thu, 12 Nov 2020 20:42:42 +0000 (23:42 +0300)]
rustc_expand: Mark inner `#![test]` attributes as soft-unstable

3 years agoAuto merge of #78104 - ssomers:btree_root_redux, r=Mark-Simulacrum
bors [Fri, 20 Nov 2020 16:12:35 +0000 (16:12 +0000)]
Auto merge of #78104 - ssomers:btree_root_redux, r=Mark-Simulacrum

BTreeMap: replace Root with NodeRef<Owned, ...>

`NodeRef<marker::Owned, â€¦>` already exists as a representation of root nodes, and it makes more sense to alias `Root` to that than to reuse the space-efficient `BoxedNode` that is oblivious to height, where height is required.

r? `@Mark-Simulacrum`

3 years agoExhaustively match in variant count instrinsic
Ngo Iok Ui [Fri, 20 Nov 2020 13:49:49 +0000 (21:49 +0800)]
Exhaustively match in variant count instrinsic

3 years agoAuto merge of #79205 - rust-lang:jdm-patch-1, r=m-ou-se
bors [Fri, 20 Nov 2020 13:42:44 +0000 (13:42 +0000)]
Auto merge of #79205 - rust-lang:jdm-patch-1, r=m-ou-se

Extend meta parameters to all generated code in compat_fn.

Fixes https://github.com/rust-lang/rust/issues/79203. This addresses a regression from 7e2032390cf34f3ffa726b7bd890141e2684ba63 for UWP targets.

3 years agoAdd "memset" as doc alias to slice::fill()
Sebastian Dröge [Fri, 20 Nov 2020 13:18:41 +0000 (15:18 +0200)]
Add "memset" as doc alias to slice::fill()

3 years agoAdd `core::slice::fill_with`
Yoshua Wuyts [Fri, 20 Nov 2020 00:42:43 +0000 (01:42 +0100)]
Add `core::slice::fill_with`