]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #78683 - Nemo157:issue-78673, r=lcnr
bors [Fri, 13 Nov 2020 23:12:01 +0000 (23:12 +0000)]
Auto merge of #78683 - Nemo157:issue-78673, r=lcnr

Check predicates from blanket trait impls while testing if they apply

fixes #78673

3 years agoAuto merge of #78888 - richkadel:llvm-coverage-tests, r=tmandry
bors [Fri, 13 Nov 2020 20:06:46 +0000 (20:06 +0000)]
Auto merge of #78888 - richkadel:llvm-coverage-tests, r=tmandry

Fix and re-enable two coverage tests on MacOS

Note, in the coverage-reports test, the comment about MacOS was wrong.
The setting is based on config.toml llvm `optimize` setting. There
doesn't appear to be any environment variable I can check, and I
don't think we should add one. Testing the binary itself is a more
reliable way to check anyway.

For the coverage-spanview test, I removed the dependency on sed
altogether, which is much less ugly than trying to work around the
MacOS sed differences.

I tested these changes on Linux, Windows, and Mac.

r? `@tmandry`
FYI `@wesleywiser`

3 years agoAuto merge of #79011 - ehuss:update-cargo, r=ehuss
bors [Fri, 13 Nov 2020 17:35:56 +0000 (17:35 +0000)]
Auto merge of #79011 - ehuss:update-cargo, r=ehuss

Update cargo

Fixing an important publish bug.

2 commits in 8662ab427a8d6ad8047811cc4d78dbd20dd07699..2af662e22177a839763ac8fb70d245a680b15214
2020-11-12 03:47:53 +0000 to 2020-11-12 19:04:56 +0000
- Fix publishing with optional dependencies. (rust-lang/cargo#8853)
- Minor typo in features.md (rust-lang/cargo#8851)

3 years agoAuto merge of #79017 - GuillaumeGomez:rollup-5orhudd, r=GuillaumeGomez
bors [Fri, 13 Nov 2020 14:53:55 +0000 (14:53 +0000)]
Auto merge of #79017 - GuillaumeGomez:rollup-5orhudd, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #77151 (Add regression test for issue #76042)
 - #77996 (Doc change: Remove mention of `fnv` in HashMap)
 - #78463 (Add type to `ConstKind::Placeholder`)
 - #78984 (Rustdoc check option)
 - #78985 (add dropck test for const params)
 - #78996 (add explicit test for const param promotion)

Failed merges:

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

3 years agoRollup merge of #78996 - lcnr:cg-promotion, r=RalfJung
Guillaume Gomez [Fri, 13 Nov 2020 14:26:20 +0000 (15:26 +0100)]
Rollup merge of #78996 - lcnr:cg-promotion, r=RalfJung

add explicit test for const param promotion

r? `@RalfJung`

3 years agoRollup merge of #78985 - lcnr:cg-drop-test, r=nikomatsakis
Guillaume Gomez [Fri, 13 Nov 2020 14:26:18 +0000 (15:26 +0100)]
Rollup merge of #78985 - lcnr:cg-drop-test, r=nikomatsakis

add dropck test for const params

r? `@nikomatsakis` or `@varkor`

3 years agoRollup merge of #78984 - GuillaumeGomez:rustdoc-check-option, r=jyn514
Guillaume Gomez [Fri, 13 Nov 2020 14:26:16 +0000 (15:26 +0100)]
Rollup merge of #78984 - GuillaumeGomez:rustdoc-check-option, r=jyn514

Rustdoc check option

The ultimate goal behind this option would be to have `rustdoc --check` being run when you use `cargo check` as a second step.

r? `@jyn514`

3 years agoRollup merge of #78463 - varkor:placeholder-const, r=nikomatsakis
Guillaume Gomez [Fri, 13 Nov 2020 14:26:14 +0000 (15:26 +0100)]
Rollup merge of #78463 - varkor:placeholder-const, r=nikomatsakis

Add type to `ConstKind::Placeholder`

I simply threaded `<'tcx>` through everything that required it. I'm not sure whether this is the correct thing to do, but it seems to work.

r? `@nikomatsakis`

3 years agoRollup merge of #77996 - tkaitchuck:master, r=m-ou-se
Guillaume Gomez [Fri, 13 Nov 2020 14:26:10 +0000 (15:26 +0100)]
Rollup merge of #77996 - tkaitchuck:master, r=m-ou-se

Doc change: Remove mention of `fnv` in HashMap

Disclaimer: I am the author of [aHash](https://github.com/tkaitchuck/aHash).

This changes the Rustdoc in `HashMap` from mentioning the `fnv` crate to mentioning the `aHash` crate, as an alternative `Hasher` implementation.

### Why

Fnv [has poor hash quality](https://github.com/rurban/smhasher), is [slow for larger keys](https://github.com/tkaitchuck/aHash/blob/master/compare/readme.md#speed), and does not provide dos resistance, because it is unkeyed (this can also cause [other problems](https://accidentallyquadratic.tumblr.com/post/153545455987/rust-hash-iteration-reinsertion)).

Fnv has acceptable performance for integers and has very poor performance with keys >32 bytes. This is the reason it was removed from the standard library in https://github.com/rust-lang/rust/pull/37229 .

Because regardless of which dimension you value, there are better alternatives, it does not make sense for anyone to consider using `fnv`.

The text mentioning `fnv` in the standard library continues to create confusion: https://github.com/rust-lang/hashbrown/issues/153  https://github.com/rust-lang/hashbrown/issues/9 . There are also a number of [crates using it](https://crates.io/crates/fnv/reverse_dependencies) a great many of which are hashing strings (Which is when Fnv is the [worst](https://github.com/cbreeden/fxhash#benchmarks), [possible](https://github.com/tkaitchuck/aHash#speed), [choice](http://cglab.ca/~abeinges/blah/hash-rs/).)

I think aHash makes the most sense to mention as an alternative because it is the most credible option (in my obviously biased opinion). It offers [good performance on numbers and strings](https://github.com/tkaitchuck/aHash/blob/master/compare/readme.md#speed), is [of high quality](https://github.com/tkaitchuck/aHash#hash-quality), and [provides dos resistance](https://github.com/tkaitchuck/aHash/wiki/How-aHash-is-resists-DOS-attacks). It is popular (see [stats](https://crates.io/crates/ahash)) and is the default hasher for [hashbrown](https://crates.io/crates/hashbrown) and [dashmap](https://crates.io/crates/dashmap) which are the most popular alternative hashmaps. Finally it does not have any of the [`gotcha` cases](https://github.com/tkaitchuck/aHash#fxhash) that `FxHash` suffers from. (Which is the other popular hashing option when DOS attacks are not a concern)

Signed-off-by: Tom Kaitchuck <tom.kaitchuck@emc.com>
3 years agoRollup merge of #77151 - rust-lang:LeSeulArtichaut-patch-1, r=pnkfelix
Guillaume Gomez [Fri, 13 Nov 2020 14:26:06 +0000 (15:26 +0100)]
Rollup merge of #77151 - rust-lang:LeSeulArtichaut-patch-1, r=pnkfelix

Add regression test for issue #76042

Originally posted in https://github.com/rust-lang/rust/issues/76042#issuecomment-683272710.
r? `@pnkfelix`

3 years agoAuto merge of #77990 - bugadani:copies, r=lcnr
bors [Fri, 13 Nov 2020 11:49:33 +0000 (11:49 +0000)]
Auto merge of #77990 - bugadani:copies, r=lcnr

Eliminate some temporary vectors

This PR changes `get_item_attrs` and `get_item_variances` to return iterator impls instead of vectors. On top of that, this PR replaces some seemingly unnecessary vectors with iterators or SmallVec, and also reserves space where we know (the minimum) number of elements that will be inserted. This change hopes to remove a few heap allocations and unnecessary copies.

3 years agoPush to result vector instead of allocating
Dániel Buga [Thu, 22 Oct 2020 13:06:24 +0000 (15:06 +0200)]
Push to result vector instead of allocating

Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
3 years agoReuse vector
Dániel Buga [Wed, 14 Oct 2020 08:54:17 +0000 (10:54 +0200)]
Reuse vector

3 years agoReserve space in advance
Dániel Buga [Fri, 16 Oct 2020 09:43:39 +0000 (11:43 +0200)]
Reserve space in advance

3 years agoAllocate less in lower_block_noalloc
Dániel Buga [Fri, 16 Oct 2020 14:43:42 +0000 (16:43 +0200)]
Allocate less in lower_block_noalloc

3 years agoEliminate some temporary vectors & Remove unnecessary mark_attr_used
Dániel Buga [Thu, 15 Oct 2020 19:20:00 +0000 (21:20 +0200)]
Eliminate some temporary vectors & Remove unnecessary mark_attr_used

3 years agoAuto merge of #79014 - pietroalbini:1.50, r=pietroalbini
bors [Fri, 13 Nov 2020 09:07:29 +0000 (09:07 +0000)]
Auto merge of #79014 - pietroalbini:1.50, r=pietroalbini

Bump version number to 1.50.0

First PR of the release process of Rust 1.48.0. All PRs landed after this one will be included in Rust 1.50.0.

r? `@ghost`
cc `@rust-lang/release`

3 years agobump version to 1.50.0
Pietro Albini [Fri, 13 Nov 2020 08:47:16 +0000 (09:47 +0100)]
bump version to 1.50.0

3 years agoAuto merge of #78826 - petrochenkov:mrscopes2, r=eddyb
bors [Fri, 13 Nov 2020 05:40:37 +0000 (05:40 +0000)]
Auto merge of #78826 - petrochenkov:mrscopes2, r=eddyb

resolve: Collapse `macro_rules` scope chains on the fly

Otherwise they grow too long and you have to endlessly walk through them when resolving macros or imports.
Addresses https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/Slow.20Builtin.20Derives/near/215750815

3 years agoUpdate library/std/src/collections/hash/map.rs
Tom Kaitchuck [Fri, 13 Nov 2020 04:14:57 +0000 (20:14 -0800)]
Update library/std/src/collections/hash/map.rs

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
3 years agoUpdate cargo
Eric Huss [Fri, 13 Nov 2020 02:39:16 +0000 (18:39 -0800)]
Update cargo

3 years agoAuto merge of #78990 - RalfJung:miri, r=RalfJung
bors [Fri, 13 Nov 2020 02:04:53 +0000 (02:04 +0000)]
Auto merge of #78990 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agoAuto merge of #78998 - m-ou-se:rollup-6r4pt9m, r=m-ou-se
bors [Thu, 12 Nov 2020 23:23:56 +0000 (23:23 +0000)]
Auto merge of #78998 - m-ou-se:rollup-6r4pt9m, r=m-ou-se

Rollup of 7 pull requests

Successful merges:

 - #76730 (Fix rustdoc rendering of by-value mutable arguments in async fn)
 - #78836 (Implement destructuring assignment for structs and slices)
 - #78857 (Improve BinaryHeap performance)
 - #78950 (Add asm register information for SPIR-V)
 - #78970 (update rustfmt to v1.4.25)
 - #78972 (Update cargo)
 - #78987 (extend min_const_generics param ty tests)

Failed merges:

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

3 years agoEnsure that INVALID_CODEBLOCK_ATTRIBUTES lint is emitted
Guillaume Gomez [Thu, 12 Nov 2020 20:55:26 +0000 (21:55 +0100)]
Ensure that INVALID_CODEBLOCK_ATTRIBUTES lint is emitted

3 years agoRollup merge of #78987 - lcnr:integer-sizes, r=varkor
Mara Bos [Thu, 12 Nov 2020 18:46:19 +0000 (19:46 +0100)]
Rollup merge of #78987 - lcnr:integer-sizes, r=varkor

extend min_const_generics param ty tests

Apparently we never tested for `u128` and `i128` before this, so I added a test for all types which are allowed.

r? ``@varkor``

3 years agoRollup merge of #78972 - ehuss:update-cargo, r=ehuss
Mara Bos [Thu, 12 Nov 2020 18:46:17 +0000 (19:46 +0100)]
Rollup merge of #78972 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in d5556aeb8405b1fe696adb6e297ad7a1f2989b62..8662ab427a8d6ad8047811cc4d78dbd20dd07699
2020-11-04 22:20:36 +0000 to 2020-11-12 03:47:53 +0000
- Check if rust-src contains a vendor dir, and patch it in (rust-lang/cargo#8834)
- Improve performance of almost fresh builds (rust-lang/cargo#8837)
- Use u32/64::to/from_le_bytes instead of bit fiddling (rust-lang/cargo#8847)
- Avoid constructing an anyhow::Error when not necessary (rust-lang/cargo#8844)
- Skip extracting .cargo-ok files from packages (rust-lang/cargo#8835)

3 years agoRollup merge of #78970 - calebcartwright:update-rustfmt, r=Aaron1011
Mara Bos [Thu, 12 Nov 2020 18:46:16 +0000 (19:46 +0100)]
Rollup merge of #78970 - calebcartwright:update-rustfmt, r=Aaron1011

update rustfmt to v1.4.25

Contains changes from https://github.com/rust-lang/rustfmt/pull/4507

r? ``@Aaron1011``

3 years agoRollup merge of #78950 - khyperia:spirv-asm, r=Amanieu
Mara Bos [Thu, 12 Nov 2020 18:46:14 +0000 (19:46 +0100)]
Rollup merge of #78950 - khyperia:spirv-asm, r=Amanieu

Add asm register information for SPIR-V

As discussed in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Defining.20asm!.20for.20new.20architecture), we at [rust-gpu](https://github.com/EmbarkStudios/rust-gpu) would like to support `asm!` for our SPIR-V backend. However, we cannot do so purely without frontend support: [this match](https://github.com/rust-lang/rust/blob/d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f/compiler/rustc_target/src/asm/mod.rs#L185) fails and so `asm!` is not supported ([error reported here](https://github.com/rust-lang/rust/blob/d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f/compiler/rustc_ast_lowering/src/expr.rs#L1095)). To resolve this, we need to stub out register information for SPIR-V to support getting the `asm!` content all the way to [`AsmBuilderMethods::codegen_inline_asm`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/trait.AsmBuilderMethods.html#tymethod.codegen_inline_asm), at which point the rust-gpu backend can do all the parsing and codegen that is needed.

This is a pretty weird PR - adding support for a backend that isn't in-tree feels pretty gross to me, but I don't see an easy way around this. ``@Amanieu`` said I should submit it anyway, so, here we are! Let me know if this needs to go through a more formal process (MCP?) and what I should do to help this along.

I based this off the [wasm asm PR](https://github.com/rust-lang/rust/pull/78684), which unfortunately this PR conflicts with that one quite a bit, sorry for any merge conflict pain :(

---

Some open questions:

- What do we call the register class? Some context, SPIR-V is an SSA-based IR, there are "instructions" that create IDs (referred to as `<id>` in the spec), which can be referenced by other instructions. So, `reg` isn't exactly accurate, they're SSA IDs, not re-assignable registers.
- What happens when a SPIR-V register gets to the LLVM backend? Right now it's a `bug!`, but should that be a `sess.fatal()`? I'm not sure if it's even possible to reach that point, maybe there's a check that prevents the `spirv` target from even reaching that codepath.

3 years agoRollup merge of #78857 - SkiFire13:bheap-opt, r=KodrAus
Mara Bos [Thu, 12 Nov 2020 18:46:11 +0000 (19:46 +0100)]
Rollup merge of #78857 - SkiFire13:bheap-opt, r=KodrAus

Improve BinaryHeap performance

By changing the condition in the loops from `child < end` to `child < end - 1` we're guaranteed that `right = child + 1 < end` and since finding the index of the biggest sibling can be done with an arithmetic operation we can remove a branch from the loop body. The case where there's no right child, i.e. `child == end - 1` is instead handled outside the loop, after it ends; note that if the loops ends early we can use `return` instead of `break` since the check `child == end - 1` will surely fail.

I've also removed a call to `<[T]>::swap` that was hiding a bound check that [wasn't being optimized by LLVM](https://godbolt.org/z/zrhdGM).

A quick benchmarks on my pc shows that the gains are pretty significant:

|name                 |before ns/iter  |after ns/iter  |diff ns/iter  |diff %    |speedup |
|---------------------|----------------|---------------|--------------|----------|--------|
|find_smallest_1000   | 352,565        | 260,098       |     -92,467  | -26.23%  | x 1.36 |
|from_vec             | 676,795        | 473,934       |    -202,861  | -29.97%  | x 1.43 |
|into_sorted_vec      | 469,511        | 304,275       |    -165,236  | -35.19%  | x 1.54 |
|pop                  | 483,198        | 373,778       |    -109,420  | -22.64%  | x 1.29 |

The other 2 benchmarks for `BinaryHeap` (`peek_mut_deref_mut` and `push`) weren't impacted and as such didn't show any significant change.

3 years agoRollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov
Mara Bos [Thu, 12 Nov 2020 18:46:09 +0000 (19:46 +0100)]
Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov

Implement destructuring assignment for structs and slices

This is the second step towards implementing destructuring assignment (RFC: rust-lang/rfcs#2909, tracking issue: #71126). This PR is the second part of #71156, which was split up to allow for easier review.

Note that the first PR (#78748) is not merged yet, so it is included as the first commit in this one. I thought this would allow the review to start earlier because I have some time this weekend to respond to reviews. If ``@petrochenkov`` prefers to wait until the first PR is merged, I totally understand, of course.

This PR implements destructuring assignment for (tuple) structs and slices. In order to do this, the following *parser change* was necessary: struct expressions are not required to have a base expression, i.e. `Struct { a: 1, .. }` becomes legal (in order to act like a struct pattern).

Unfortunately, this PR slightly regresses the diagnostics implemented in #77283. However, it is only a missing help message in `src/test/ui/issues/issue-77218.rs`. Other instances of this diagnostic are not affected. Since I don't exactly understand how this help message works and how to fix it yet, I was hoping it's OK to regress this temporarily and fix it in a follow-up PR.

Thanks to ``@varkor`` who helped with the implementation, particularly around the struct rest changes.

r? ``@petrochenkov``

3 years agoRollup merge of #76730 - ebkalderon:rustdoc-fix-mut-args-async-fn, r=tmandry
Mara Bos [Thu, 12 Nov 2020 18:46:08 +0000 (19:46 +0100)]
Rollup merge of #76730 - ebkalderon:rustdoc-fix-mut-args-async-fn, r=tmandry

Fix rustdoc rendering of by-value mutable arguments in async fn

r? `@jyn514`

Fixes #76517.

3 years agocg: add explicit test for const param promotion
Bastian Kauschke [Thu, 12 Nov 2020 18:20:47 +0000 (19:20 +0100)]
cg: add explicit test for const param promotion

3 years agoHandle and test wildcard arguments
Joshua Nelson [Tue, 10 Nov 2020 12:49:06 +0000 (07:49 -0500)]
Handle and test wildcard arguments

3 years agoDon't reuse bindings for `ref mut`
Joshua Nelson [Sun, 8 Nov 2020 16:45:13 +0000 (11:45 -0500)]
Don't reuse bindings for `ref mut`

Reusing bindings causes errors later in lowering:

```
 error[E0596]: cannot borrow `vec` as mutable, as it is not declared as mutable
  --> /checkout/src/test/ui/async-await/argument-patterns.rs:12:20
   |
LL | async fn b(n: u32, ref mut vec: A) {
   |                    ^^^^^^^^^^^
   |                    |
   |                    cannot borrow as mutable
   |                    help: consider changing this to be mutable: `mut vec`
```

3 years agoConsider mutable ident binding patterns to be simple
Eyal Kalderon [Tue, 15 Sep 2020 02:21:59 +0000 (10:21 +0800)]
Consider mutable ident binding patterns to be simple

This should fix `rustdoc` rendering of by-value mutable arguments in
`async fn` contexts.

3 years agoupdate Miri
Ralf Jung [Thu, 12 Nov 2020 15:53:32 +0000 (16:53 +0100)]
update Miri

3 years agoAdd type to `ConstKind::Placeholder`
varkor [Wed, 28 Oct 2020 01:11:03 +0000 (01:11 +0000)]
Add type to `ConstKind::Placeholder`

3 years agoextend min_const_generics param ty tests
Bastian Kauschke [Thu, 12 Nov 2020 15:16:37 +0000 (16:16 +0100)]
extend min_const_generics param ty tests

3 years agoAuto merge of #76256 - tgnottingham:issue-74890, r=nikomatsakis
bors [Thu, 12 Nov 2020 15:34:09 +0000 (15:34 +0000)]
Auto merge of #76256 - tgnottingham:issue-74890, r=nikomatsakis

incr-comp: hash and serialize span end line/column

Hash both the length and the end location (line/column) of a span. If we
hash only the length, for example, then two otherwise equal spans with
different end locations will have the same hash. This can cause a
problem during incremental compilation wherein a previous result for a
query that depends on the end location of a span will be incorrectly
reused when the end location of the span it depends on has changed. A
similar analysis applies if some query depends specifically on the
length of the span, but we only hash the end location. So hash both.

Fix #46744, fix #59954, fix #63161, fix #73640, fix #73967, fix #74890, fix #75900

---

See #74890 for a more in-depth analysis.

I haven't thought about what other problems this root cause could be responsible for. Please let me know if anything springs to mind. I believe the issue has existed since the inception of incremental compilation.

3 years agocheck `Drop` specialization of const params
Bastian Kauschke [Thu, 12 Nov 2020 14:39:21 +0000 (15:39 +0100)]
check `Drop` specialization of const params

3 years agomove dropck tests from ui -> ui/dropck
Bastian Kauschke [Thu, 12 Nov 2020 14:31:52 +0000 (15:31 +0100)]
move dropck tests from ui -> ui/dropck

3 years agoAdd tests for rustdoc --check option
Guillaume Gomez [Thu, 12 Nov 2020 13:58:07 +0000 (14:58 +0100)]
Add tests for rustdoc --check option

3 years agoAdd --check option to rustdoc
Guillaume Gomez [Thu, 12 Nov 2020 13:57:44 +0000 (14:57 +0100)]
Add --check option to rustdoc

3 years agoAuto merge of #78976 - GuillaumeGomez:rollup-endkih3, r=GuillaumeGomez
bors [Thu, 12 Nov 2020 13:10:07 +0000 (13:10 +0000)]
Auto merge of #78976 - GuillaumeGomez:rollup-endkih3, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #78916 (extend const generics test suite)
 - #78921 (Improve the page title switch handling between search and doc)
 - #78933 (Don't print thread ids and names in `tracing` logs)
 - #78960 (Test default values for const parameters.)
 - #78971 (Update books)

Failed merges:

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

3 years agoRollup merge of #78971 - ehuss:update-books, r=ehuss
Guillaume Gomez [Thu, 12 Nov 2020 10:31:53 +0000 (11:31 +0100)]
Rollup merge of #78971 - ehuss:update-books, r=ehuss

Update books

## nomicon

8 commits in 69333eddb1de92fd17e272ce4677cc983d3bd71d..23c49f1d5ce4720bc5b7e3a920f47eccc8da6b63
2020-10-17 15:44:12 -0700 to 2020-11-05 13:30:53 +0900
-  (rust-lang-nursery/nomicon#238)
- Some tweaks (rust-lang-nursery/nomicon#244)
-  (rust-lang-nursery/nomicon#245)
- Update atomics.md (rust-lang-nursery/nomicon#224)
- Update send-and-sync.md (rust-lang-nursery/nomicon#187)
- fix a typo (rust-lang-nursery/nomicon#231)
- Improve formatting of "Transmutes" chapter (rust-lang-nursery/nomicon#242)
- Merge pull request rust-lang-nursery/nomicon#241 from simon-lammes/patch-1

## reference

4 commits in 10c16caebe475d0d11bec0531b95d7697856c13c..a7de763c213292f5b44bf10acb87ffa38724814d
2020-10-25 20:51:26 -0700 to 2020-11-11 19:13:21 -0800
- Referencify tuples (rust-lang-nursery/reference#899)
- Mention Box's partial field moves (rust-lang-nursery/reference#837)
- Enable triagebot (rust-lang-nursery/reference#862)
- Update deprecated GitHub Actions commands. (rust-lang-nursery/reference#896)

## rust-by-example

1 commits in 99eafee0cb14e6ec641bf02a69d7b30f6058349a..1886fda6981b723e4de637074455558f8bc1e83c
2020-10-21 14:21:55 -0300 to 2020-10-28 13:46:54 -0500
- Remove incorrect "lambda" terminology

## edition-guide

1 commits in 7bc9b7a5e800f79df62947cb7d566fd2fbaf19fe..b91a9a881ee007c12e74e844460ec407cf07a50f
2020-10-23 18:31:23 -0500 to 2020-11-02 11:02:03 -0600
- Clarify slice patterns example (rust-lang/edition-guide#223)

3 years agoRollup merge of #78960 - ethanboxx:const-gen-test-default-error, r=lcnr
Guillaume Gomez [Thu, 12 Nov 2020 10:31:51 +0000 (11:31 +0100)]
Rollup merge of #78960 - ethanboxx:const-gen-test-default-error, r=lcnr

Test default values for const parameters.

The last topic on #78433

I originally intended to place these tests in a single file, however, due to them being parser errors that are fatal, they must be in separate files to be detected.

Thanks, ``@lcnr`` for mentoring me on this PR.

r? ``@lcnr``

3 years agoRollup merge of #78933 - jyn514:tracing-output, r=oli-obk
Guillaume Gomez [Thu, 12 Nov 2020 10:31:49 +0000 (11:31 +0100)]
Rollup merge of #78933 - jyn514:tracing-output, r=oli-obk

Don't print thread ids and names in `tracing` logs

Before:

```
2:rustc INFO rustc_interface::passes Pre-codegen
2:rustcTy interner             total           ty lt ct all
2:rustc    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
2:rustc    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
2:rustc    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc                  total   1326         0.2%   0.1%  0.0%  0.0%
2:rustcInternalSubsts interner: #437
2:rustcRegion interner: #355
2:rustcStability interner: #1
2:rustcConst Stability interner: #0
2:rustcAllocation interner: #0
2:rustcLayout interner: #0
```

After:

```
 INFO rustc_interface::passes Post-codegen
Ty interner             total           ty lt ct all
    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
                  total   1326         0.2%   0.1%  0.0%  0.0%
InternalSubsts interner: #437
Region interner: #355
Stability interner: #1
Const Stability interner: #0
Allocation interner: #0
Layout interner: #0
```

Closes https://github.com/rust-lang/rust/issues/78931
r? ``@oli-obk``

3 years agoRollup merge of #78921 - GuillaumeGomez:search-result-title, r=jyn514
Guillaume Gomez [Thu, 12 Nov 2020 10:31:47 +0000 (11:31 +0100)]
Rollup merge of #78921 - GuillaumeGomez:search-result-title, r=jyn514

Improve the page title switch handling between search and doc

The current behavior often "forgets" to update the page title when discarding/putting back the search results. This isn't optimal which is why I wrote this fix.

r? ``@jyn514``

3 years agoRollup merge of #78916 - lcnr:const-generics-tests, r=varkor
Guillaume Gomez [Thu, 12 Nov 2020 10:31:45 +0000 (11:31 +0100)]
Rollup merge of #78916 - lcnr:const-generics-tests, r=varkor

extend const generics test suite

should implement most of #78433, especially all parts of [the hackmd](https://hackmd.io/WnFmN4MjRCqAjGmYfYcu2A?view) which I did not explicitly mention in that issue.

r? ``@varkor``

3 years agoAuto merge of #78773 - GuillaumeGomez:theme-picker-shortcut, r=jyn514
bors [Thu, 12 Nov 2020 10:28:15 +0000 (10:28 +0000)]
Auto merge of #78773 - GuillaumeGomez:theme-picker-shortcut, r=jyn514

Add shortcut for theme picker menu

Follow-up of #78584

Just like you can focus the search input by pressing "S", you can now access the theme picker menu by pressing "T" and navigate through the options only using the keyboard.

cc `@notriddle`

r? `@jyn514`

3 years agoFix and re-enable two coverage tests on MacOS
Rich Kadel [Sun, 8 Nov 2020 19:06:05 +0000 (11:06 -0800)]
Fix and re-enable two coverage tests on MacOS

Note, in the coverage-reports test, the comment about MacOS was wrong.
The setting is based on config.toml llvm `optimize` setting. There
doesn't appear to be any environment variable I can check, and I
don't think we should add one. Testing the binary itself is a more
reliable way to check anyway.

For the coverage-spanview test, I removed the dependency on sed
altogether, which is much less ugly than trying to work around the
MacOS sed differences.

I tested these changes on Linux, Windows, and Mac.

3 years agoAuto merge of #78965 - jryans:emscripten-threads-libc, r=kennytm
bors [Thu, 12 Nov 2020 05:52:17 +0000 (05:52 +0000)]
Auto merge of #78965 - jryans:emscripten-threads-libc, r=kennytm

Update thread and futex APIs to work with Emscripten

This updates the thread and futex APIs in `std` to match the APIs exposed by
Emscripten. This allows threads to run on `wasm32-unknown-emscripten` and the
thread parker to compile without errors related to the missing `futex` module.

To make use of this, Rust code must be compiled with `-C target-feature=atomics`
and Emscripten must link with `-pthread`.

I have confirmed this works well locally when building multithreaded crates.
Attempting to enable `std` thread tests currently fails for seemingly obscure
reasons and Emscripten is currently disabled in CI, so further work is needed to
have proper test coverage here.

3 years agoUpdate cargo
Eric Huss [Thu, 12 Nov 2020 04:41:24 +0000 (20:41 -0800)]
Update cargo

3 years agoFix timeout conversion
J. Ryan Stinnett [Thu, 12 Nov 2020 03:40:15 +0000 (03:40 +0000)]
Fix timeout conversion

3 years agoUpdate books
Eric Huss [Thu, 12 Nov 2020 03:35:50 +0000 (19:35 -0800)]
Update books

3 years agoupdate rustfmt
Caleb Cartwright [Thu, 12 Nov 2020 03:28:24 +0000 (21:28 -0600)]
update rustfmt

3 years agoUpdate thread and futex APIs to work with Emscripten
J. Ryan Stinnett [Wed, 11 Nov 2020 22:25:48 +0000 (22:25 +0000)]
Update thread and futex APIs to work with Emscripten

This updates the thread and futex APIs in `std` to match the APIs exposed by
Emscripten. This allows threads to run on `wasm32-unknown-emscripten` and the
thread parker to compile without errors related to the missing `futex` module.

To make use of this, Rust code must be compiled with `-C target-feature=atomics`
and Emscripten must link with `-pthread`.

I have confirmed this works well locally when building multithreaded crates.
Attempting to enable `std` thread tests currently fails for seemingly obscure
reasons and Emscripten is currently disabled in CI, so further work is needed to
have proper test coverage here.

3 years agoAuto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011
bors [Thu, 12 Nov 2020 00:33:55 +0000 (00:33 +0000)]
Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011

Do not collect tokens for doc comments

Doc comment is a single token and AST has all the information to re-create it precisely.
Doc comments are also responsible for majority of calls to `collect_tokens` (with `num_calls == 1` and `num_calls == 0`, cc https://github.com/rust-lang/rust/pull/78736).

(I also moved token collection into `fn parse_attribute` to deduplicate code a bit.)

r? `@Aaron1011`

3 years agodefault_trait_param
Ethan Brierley [Wed, 11 Nov 2020 22:49:09 +0000 (22:49 +0000)]
default_trait_param

3 years agoAdd test `default_function_param`
Ethan Brierley [Wed, 11 Nov 2020 22:48:52 +0000 (22:48 +0000)]
Add test `default_function_param`

3 years agoAuto merge of #78956 - jonas-schievink:rollup-r53giob, r=jonas-schievink
bors [Wed, 11 Nov 2020 22:20:07 +0000 (22:20 +0000)]
Auto merge of #78956 - jonas-schievink:rollup-r53giob, r=jonas-schievink

Rollup of 11 pull requests

Successful merges:

 - #78216 (Duration::zero() -> Duration::ZERO)
 - #78354 (Support enable/disable sanitizers/profiler per target)
 - #78417 (BTreeMap: split off most code of append)
 - #78832 (look at assoc ct, check the type of nodes)
 - #78873 (Add flags customizing behaviour of MIR inlining)
 - #78899 (Support inlining diverging function calls)
 - #78923 (Cleanup and comment intra-doc link pass)
 - #78929 (rustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_base`)
 - #78930 (rustc_taret: Remove `TargetOptions::is_like_android`)
 - #78942 (Fix typo in comment)
 - #78947 (Ship llvm-cov through llvm-tools)

Failed merges:

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

3 years agoadd error-in-impl-trait const generics test
Bastian Kauschke [Tue, 10 Nov 2020 12:22:28 +0000 (13:22 +0100)]
add error-in-impl-trait const generics test

3 years agoadd rustdoc test
Bastian Kauschke [Tue, 10 Nov 2020 10:53:48 +0000 (11:53 +0100)]
add rustdoc test

3 years agoRollup merge of #78947 - dalance:llvm_cov, r=Mark-Simulacrum
Jonas Schievink [Wed, 11 Nov 2020 19:59:14 +0000 (20:59 +0100)]
Rollup merge of #78947 - dalance:llvm_cov, r=Mark-Simulacrum

Ship llvm-cov through llvm-tools

`llvm-cov` is used to generate coverage report with LLVM InstrProf-based code coverage #34701.
So if `llvm-cov` is shipped through llvm-tools, users can try it easily accorging to the instruction of [The Rust Unstable Book](https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/source-based-code-coverage.html).

3 years agoRollup merge of #78942 - eltociear:patch-1, r=jonas-schievink
Jonas Schievink [Wed, 11 Nov 2020 19:59:12 +0000 (20:59 +0100)]
Rollup merge of #78942 - eltociear:patch-1, r=jonas-schievink

Fix typo in comment

occurences -> occurrences

3 years agoRollup merge of #78930 - petrochenkov:notlikeandroid, r=Mark-Simulacrum
Jonas Schievink [Wed, 11 Nov 2020 19:59:10 +0000 (20:59 +0100)]
Rollup merge of #78930 - petrochenkov:notlikeandroid, r=Mark-Simulacrum

rustc_taret: Remove `TargetOptions::is_like_android`

This option was replaced by more specific options and is no longer used by the compiler.

3 years agoRollup merge of #78929 - petrochenkov:linuxbase, r=joshtriplett
Jonas Schievink [Wed, 11 Nov 2020 19:59:09 +0000 (20:59 +0100)]
Rollup merge of #78929 - petrochenkov:linuxbase, r=joshtriplett

rustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_base`

Follow up to https://github.com/rust-lang/rust/pull/77729.

Changes the target spec hierarchy for Linux from
```
linux_base
├── linux_musl_base
└── linux_uclibc_base
```
where `linux_base` is really `linux_gnu_base` and the inheriting targets replace target env "gnu" with "musl"/"uclibc" to
```
linux_base
├── linux_gnu_base
├── linux_musl_base
└── linux_uclibc_base
```
which is slightly less confusing (I think).

3 years agoRollup merge of #78923 - jyn514:intra-doc-comments, r=Manishearth
Jonas Schievink [Wed, 11 Nov 2020 19:59:07 +0000 (20:59 +0100)]
Rollup merge of #78923 - jyn514:intra-doc-comments, r=Manishearth

Cleanup and comment intra-doc link pass

r? ```@Manishearth```
cc ```@seeplusplus```

3 years agoRollup merge of #78899 - tmiasko:inline-diverging, r=oli-obk
Jonas Schievink [Wed, 11 Nov 2020 19:59:05 +0000 (20:59 +0100)]
Rollup merge of #78899 - tmiasko:inline-diverging, r=oli-obk

Support inlining diverging function calls

The existing heuristic does penalize diverging calls to some degree, but since
it never inlined them previously it might need some further modifications.

Additionally introduce storage markers for all temporaries created by
the inliner. The temporary introduced for destination rebrorrow, didn't
use them previously.

3 years agoRollup merge of #78873 - tmiasko:inline-opts, r=oli-obk
Jonas Schievink [Wed, 11 Nov 2020 19:59:03 +0000 (20:59 +0100)]
Rollup merge of #78873 - tmiasko:inline-opts, r=oli-obk

Add flags customizing behaviour of MIR inlining

* `-Zinline-mir-threshold` to change the default threshold.
* `-Zinline-mir-hint-threshold` to change the threshold used by
  functions with inline hint.

Having those as configurable flags makes it possible to experiment with with
different inlining thresholds and substantially increase test coverage of MIR
inlining when used with increased thresholds (for example, necessary to test
#78844).

3 years agoRollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obk
Jonas Schievink [Wed, 11 Nov 2020 19:59:02 +0000 (20:59 +0100)]
Rollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obk

look at assoc ct, check the type of nodes

an example where types matter are function objects, see the added test which previously passed.

Now does a shallow comparison of unevaluated constants.

r? ```@oli-obk```

3 years agoRollup merge of #78417 - ssomers:btree_chop_up_2, r=Mark-Simulacrum
Jonas Schievink [Wed, 11 Nov 2020 19:59:00 +0000 (20:59 +0100)]
Rollup merge of #78417 - ssomers:btree_chop_up_2, r=Mark-Simulacrum

BTreeMap: split off most code of append

To complete #78056, move the last single-purpose pieces of code out of map.rs into a separate module. Also, tweaked documentation and safeness - I doubt think this code would be safe if the iterators passed in wouldn't be as sorted as the method says they should be - and bounds on MergeIterInner.

r? ```@Mark-Simulacrum```

3 years agoRollup merge of #78354 - 12101111:rustbuild_profiler, r=Mark-Simulacrum
Jonas Schievink [Wed, 11 Nov 2020 19:58:56 +0000 (20:58 +0100)]
Rollup merge of #78354 - 12101111:rustbuild_profiler, r=Mark-Simulacrum

Support enable/disable sanitizers/profiler per target

This PR add options under `[target.*]` of `config.toml` which can enable or disable sanitizers/profiler runtime for corresponding target.
If these options are empty, the global options under `[build]` will take effect.

Fix #78329

3 years agoRollup merge of #78216 - workingjubilee:duration-zero, r=m-ou-se
Jonas Schievink [Wed, 11 Nov 2020 19:58:52 +0000 (20:58 +0100)]
Rollup merge of #78216 - workingjubilee:duration-zero, r=m-ou-se

Duration::zero() -> Duration::ZERO

In review for #72790, whether or not a constant or a function should be favored for `#![feature(duration_zero)]` was seen as an open question. In https://github.com/rust-lang/rust/issues/73544#issuecomment-691701670 an invitation was opened to either stabilize the methods or propose a switch to the constant value, supplemented with reasoning. Followup comments suggested community preference leans towards the const ZERO, which would be reason enough.

ZERO also "makes sense" beside existing associated consts for Duration. It is ever so slightly awkward to have a series of constants specifying 1 of various units but leave 0 as a method, especially when they are side-by-side in code. It seems unintuitive for the one non-dynamic value (that isn't from Default) to be not-a-const, which could hurt discoverability of the associated constants overall. Elsewhere in `std`, methods for obtaining a constant value were even deprecated, as seen with [std::u32::min_value](https://doc.rust-lang.org/std/primitive.u32.html#method.min_value).

Most importantly, ZERO costs less to use. A match supports a const pattern, but const fn can only be used if evaluated through a const context such as an inline `const { const_fn() }` or a `const NAME: T = const_fn()` declaration elsewhere. Likewise, while https://github.com/rust-lang/rust/issues/73544#issuecomment-691949373 notes `Duration::zero()` can optimize to a constant value, "can" is not "will". Only const contexts have a strong promise of such. Even without that in mind, the comment in question still leans in favor of the constant for simplicity. As it costs less for a developer to use, may cost less to optimize, and seems to have more of a community consensus for it, the associated const seems best.

r? ```@LukasKalbertodt```

3 years agoAuto merge of #78946 - jethrogb:linux-x86-llvm-no-gnu-unique, r=Mark-Simulacrum
bors [Wed, 11 Nov 2020 19:37:31 +0000 (19:37 +0000)]
Auto merge of #78946 - jethrogb:linux-x86-llvm-no-gnu-unique, r=Mark-Simulacrum

Linux dist: don't include unique symbols in libLLVM

Fixes #76980

3 years agoEnable thread names in debug logging only for `parallel_compiler`
Joshua Nelson [Wed, 11 Nov 2020 18:28:30 +0000 (13:28 -0500)]
Enable thread names in debug logging only for `parallel_compiler`

3 years agoChange capitalization of Spirv to SpirV
khyperia [Wed, 11 Nov 2020 18:18:06 +0000 (19:18 +0100)]
Change capitalization of Spirv to SpirV

This matches the capitalization of RiscV

3 years agoAdd asm register information for SPIR-V
khyperia [Wed, 11 Nov 2020 16:37:01 +0000 (17:37 +0100)]
Add asm register information for SPIR-V

3 years agoAuto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum
bors [Wed, 11 Nov 2020 16:24:43 +0000 (16:24 +0000)]
Auto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum

Vendor libtest's dependencies in the rust-src component

This is the Rust side of https://github.com/rust-lang/wg-cargo-std-aware/issues/23

Note that this won't produce a useful result for `cargo -Zbuild-std` if there are multiple versions of a crate vendored, but will otherwise produce a valid vendor dir.

See https://github.com/rust-lang/cargo/pull/8834 for the other half of this change.

3 years agoShip llvm-cov through llvm-tools
dalance [Wed, 11 Nov 2020 14:34:01 +0000 (23:34 +0900)]
Ship llvm-cov through llvm-tools

3 years agoLinux dist: don't include unique symbols in libLLVM
Jethro Beekman [Wed, 11 Nov 2020 13:46:04 +0000 (14:46 +0100)]
Linux dist: don't include unique symbols in libLLVM

3 years agoImplement destructuring assignment for structs and slices
Fabian Zaiser [Sat, 7 Nov 2020 14:28:55 +0000 (14:28 +0000)]
Implement destructuring assignment for structs and slices

Co-authored-by: varkor <github@varkor.com>
3 years agoFix typo in comment
Ikko Ashimine [Wed, 11 Nov 2020 11:23:08 +0000 (20:23 +0900)]
Fix typo in comment

occurences -> occurrences

3 years agoAuto merge of #78825 - Nicholas-Baron:unwrap_or_corrected, r=lcnr
bors [Wed, 11 Nov 2020 09:10:30 +0000 (09:10 +0000)]
Auto merge of #78825 - Nicholas-Baron:unwrap_or_corrected, r=lcnr

`unwrap_or` lint corrected

https://github.com/rust-lang/rust/issues/78814#issuecomment-723305713

This pull request fixes the lint from clippy where `unwrap_or` could be better done as a `unwrap_or_else` or a `unwrap_or_default`.

3 years agorustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_base`
Vadim Petrochenkov [Tue, 10 Nov 2020 20:32:58 +0000 (23:32 +0300)]
rustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_base`

3 years agoChanged unwrap_or to unwrap_or_else in some places.
Nicholas-Baron [Fri, 6 Nov 2020 21:24:55 +0000 (13:24 -0800)]
Changed unwrap_or to unwrap_or_else in some places.

The discussion seems to have resolved that this lint is a bit "noisy" in
that applying it in all places would result in a reduction in
readability.

A few of the trivial functions (like `Path::new`) are fine to leave
outside of closures.

The general rule seems to be that anything that is obviously an
allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it
is a 0-sized allocation.

3 years agoAuto merge of #78920 - jonas-schievink:rollup-w2mjsuh, r=jonas-schievink
bors [Wed, 11 Nov 2020 01:18:18 +0000 (01:18 +0000)]
Auto merge of #78920 - jonas-schievink:rollup-w2mjsuh, r=jonas-schievink

Rollup of 14 pull requests

Successful merges:

 - #76765 (Make it more clear what an about async fn's returns when referring to what it returns)
 - #78574 (Use check-pass instead of build-pass in regions ui test suite)
 - #78669 (Use check-pass instead of build-pass in some consts ui test suits)
 - #78847 (Assert that a return place is not used for indexing during integration)
 - #78854 (Workaround for "could not fully normalize" ICE )
 - #78875 (rustc_target: Further cleanup use of target options)
 - #78887 (Add comments to explain memory usage optimization)
 - #78890 (comment attribution fix)
 - #78896 (Clarified description of write! macro)
 - #78897 (Add missing newline to error message of the default OOM hook)
 - #78898 (add regression test for #78892)
 - #78908 ((rustdoc) [src] link for types defined by macros shows invocation, not defintion)
 - #78910 (Fix links to stabilized versions of some intrinsics)
 - #78912 (Add macro test for min-const-generics)

Failed merges:

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

3 years agoDon't print thread ids and names in `tracing` logs
Joshua Nelson [Tue, 10 Nov 2020 22:32:29 +0000 (17:32 -0500)]
Don't print thread ids and names in `tracing` logs

Before:

```
2:rustc INFO rustc_interface::passes Pre-codegen
2:rustcTy interner             total           ty lt ct all
2:rustc    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
2:rustc    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
2:rustc    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc                  total   1326         0.2%   0.1%  0.0%  0.0%
2:rustcInternalSubsts interner: #437
2:rustcRegion interner: #355
2:rustcStability interner: #1
2:rustcConst Stability interner: #0
2:rustcAllocation interner: #0
2:rustcLayout interner: #0
```

After:

```
 INFO rustc_interface::passes Post-codegen
Ty interner             total           ty lt ct all
    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
                  total   1326         0.2%   0.1%  0.0%  0.0%
InternalSubsts interner: #437
Region interner: #355
Stability interner: #1
Const Stability interner: #0
Allocation interner: #0
Layout interner: #0
```

3 years agorustc_taret: Remove `TargetOptions::is_like_android`
Vadim Petrochenkov [Tue, 10 Nov 2020 20:51:34 +0000 (23:51 +0300)]
rustc_taret: Remove `TargetOptions::is_like_android`

3 years agoCleanup and comment intra-doc link pass
Joshua Nelson [Tue, 10 Nov 2020 16:09:34 +0000 (11:09 -0500)]
Cleanup and comment intra-doc link pass

3 years agoImprove the page title switch handling between search and doc
Guillaume Gomez [Tue, 10 Nov 2020 14:01:01 +0000 (15:01 +0100)]
Improve the page title switch handling between search and doc

3 years agoRollup merge of #78912 - JulianKnodt:mcg_macro, r=lcnr
Jonas Schievink [Tue, 10 Nov 2020 13:45:36 +0000 (14:45 +0100)]
Rollup merge of #78912 - JulianKnodt:mcg_macro, r=lcnr

Add macro test for min-const-generics

Adds a test which uses a macro inside a block for a const-expression, as per #78433

r? `@lcnr`

3 years agoRollup merge of #78910 - tmiasko:intrinsics-link, r=jyn514
Jonas Schievink [Tue, 10 Nov 2020 13:45:34 +0000 (14:45 +0100)]
Rollup merge of #78910 - tmiasko:intrinsics-link, r=jyn514

Fix links to stabilized versions of some intrinsics

3 years agoRollup merge of #78908 - liketechnik:fix_macro_expand_src_link, r=jyn514
Jonas Schievink [Tue, 10 Nov 2020 13:45:32 +0000 (14:45 +0100)]
Rollup merge of #78908 - liketechnik:fix_macro_expand_src_link, r=jyn514

(rustdoc) [src] link for types defined by macros shows invocation, not defintion

Previously the [src] link on types defined by a macro pointed to the macro definition.

This pr makes the Clean-Implementation for Spans aware of macro defined types, so that the link points to the invocation instead.

I'm not totally sure if it's okay to add the 'macro awareness' in the Clean-Implementation, because it erases that knowledge for all following code. Maybe it would be more sensible to add the check only for the link generation at https://github.com/rust-lang/rust/blob/25f6938da459a57b43bdf16ed6bdad3225b2a3ce/src/librustdoc/html/render/mod.rs#L1619

Closes #39726.

3 years agoRollup merge of #78898 - SNCPlay42:issue-78892, r=Mark-Simulacrum
Jonas Schievink [Tue, 10 Nov 2020 13:45:30 +0000 (14:45 +0100)]
Rollup merge of #78898 - SNCPlay42:issue-78892, r=Mark-Simulacrum

add regression test for #78892

closes #78892, which was already fixed on nightly.

3 years agoRollup merge of #78897 - hyd-dev:alloc-error-hook-newline, r=m-ou-se
Jonas Schievink [Tue, 10 Nov 2020 13:45:28 +0000 (14:45 +0100)]
Rollup merge of #78897 - hyd-dev:alloc-error-hook-newline, r=m-ou-se

Add missing newline to error message of the default OOM hook

Currently the default OOM hook in libstd does not end the error message with a newline:
```
memory allocation of 4 bytes failedtimeout: the monitored command dumped core
/playground/tools/entrypoint.sh: line 11:     7 Aborted                 timeout --signal=KILL ${timeout} "$`@"`
```
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=030d8223eb57dfe47ef157709aa26542

This is because the `fmt::Arguments` passed to `dumb_print()` does not end with a newline. All other calls to `dumb_print()` in libstd pass a `\n`-ended `fmt::Arguments` to `dumb_print()`. For example:
https://github.com/rust-lang/rust/blob/25f6938da459a57b43bdf16ed6bdad3225b2a3ce/library/std/src/sys_common/util.rs#L18
I think the `\n` was forgotten in #51264.

This PR appends `\n` to the error string.

~~Note that I didn't add a test, because I didn't find tests for functions in ` library/std/src/alloc.rs` or a test that is similar to the test of this change would be.~~ *Edit: CI told me there is an existing test. Sorry.*

3 years agoRollup merge of #78896 - cyqsimon:master, r=m-ou-se
Jonas Schievink [Tue, 10 Nov 2020 13:45:27 +0000 (14:45 +0100)]
Rollup merge of #78896 - cyqsimon:master, r=m-ou-se

Clarified description of write! macro

Reordered the list of arguments in the description to match that in the actual macro.

Suggested and discussed [here](https://discord.com/channels/442252698964721669/443492145567891458/774341262609219624).

3 years agoRollup merge of #78890 - o752d:patch-2, r=jyn514
Jonas Schievink [Tue, 10 Nov 2020 13:45:25 +0000 (14:45 +0100)]
Rollup merge of #78890 - o752d:patch-2, r=jyn514

comment attribution fix

comment means to refer to the macro in its direct scope

3 years agoRollup merge of #78887 - camelid:dataflow-state-decl, r=jonas-schievink
Jonas Schievink [Tue, 10 Nov 2020 13:45:23 +0000 (14:45 +0100)]
Rollup merge of #78887 - camelid:dataflow-state-decl, r=jonas-schievink

Add comments to explain memory usage optimization

Add explanatory comments so that people understand that it's just an optimization and doesn't affect behavior.

3 years agoRollup merge of #78875 - petrochenkov:cleantarg, r=Mark-Simulacrum
Jonas Schievink [Tue, 10 Nov 2020 13:45:21 +0000 (14:45 +0100)]
Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-Simulacrum

rustc_target: Further cleanup use of target options

Follow up to https://github.com/rust-lang/rust/pull/77729.

Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243.

The first commit collapses uses of `target.options.foo` into `target.foo`.

The second commit renames some target options to avoid tautology:
`target.target_endian` -> `target.endian`
`target.target_c_int_width` -> `target.c_int_width`
`target.target_os` -> `target.os`
`target.target_env` -> `target.env`
`target.target_vendor` -> `target.vendor`
`target.target_family` -> `target.os_family`
`target.target_mcount` -> `target.mcount`

r? `@Mark-Simulacrum`