]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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`

3 years agoRollup merge of #78854 - the8472:workaround-normalization-regression-master, r=Mark...
Jonas Schievink [Tue, 10 Nov 2020 13:45:19 +0000 (14:45 +0100)]
Rollup merge of #78854 - the8472:workaround-normalization-regression-master, r=Mark-Simulacrum

Workaround for "could not fully normalize" ICE

Workaround for "could not fully normalize" ICE (#78139) by removing the `needs_drop::<T>()` calls triggering it.
Corresponding beta PR: #78845

Fixes #78139 -- the underlying bug is likely not fixed but we don't have another test case isolated for now, so closing.

3 years agoRollup merge of #78847 - tmiasko:inline-return-place, r=matthewjasper
Jonas Schievink [Tue, 10 Nov 2020 13:45:17 +0000 (14:45 +0100)]
Rollup merge of #78847 - tmiasko:inline-return-place, r=matthewjasper

Assert that a return place is not used for indexing during integration

The inliner integrates call destination place with callee return place
by remapping the local and adding extra projections as necessary.

If a call destination place contains any projections (which is already
possible) and a return place is used in an indexing projection (most
likely doesn't happen yet) the end result would be incorrect.

Add an assertion to ensure that potential issue won't go unnoticed in
the presence of more sophisticated copy propagation scheme.

3 years agoRollup merge of #78669 - sasurau4:test/check-pass-consts, r=jyn514
Jonas Schievink [Tue, 10 Nov 2020 13:45:15 +0000 (14:45 +0100)]
Rollup merge of #78669 - sasurau4:test/check-pass-consts, r=jyn514

Use check-pass instead of build-pass in some consts ui test suits

Helps with #62277

Changed tests modified by https://github.com/rust-lang/rust/pull/57175 because of the stabilization `#![feature(const_let)]`.
They should be compile-fail because the feature gate checking disallow the feature before stabilization. So the feature gate checking have nothing to do with codegen according to https://rustc-dev-guide.rust-lang.org/feature-gate-ck.html.

3 years agoRollup merge of #78574 - sasurau4:test/check-pass-regions, r=jyn514
Jonas Schievink [Tue, 10 Nov 2020 13:45:13 +0000 (14:45 +0100)]
Rollup merge of #78574 - sasurau4:test/check-pass-regions, r=jyn514

Use check-pass instead of build-pass in regions ui test suite

## Overview

Helps with #62277

Region inference have nothing to do with codegen because they are erased before codegen.
Ref: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20region.20inference.20.20nothing.20to.20do.20with.20codegen.20process.3F/near/215956759

3 years agoRollup merge of #76765 - guswynn:async_return, r=tmandry
Jonas Schievink [Tue, 10 Nov 2020 13:45:09 +0000 (14:45 +0100)]
Rollup merge of #76765 - guswynn:async_return, r=tmandry

Make it more clear what an about async fn's returns when referring to what it returns

see #76547

This is *likely* not the ONLY place that this happens to be unclear, but we can move this fn to rustc_middle or something like that and reuse it if need be, to apply it to more diagnostics

One outstanding question I have is, if the fn returns (), should I make the message more clear (what about `fn f()` vs `fn f() -> ()`, can you tell those apart in the hir?)

R? `@tmandry`

`@rustbot` modify labels +A-diagnostics +T-compiler

3 years agouse check-pass instead of build-pass in consts ui test suits
Daiki Ihara [Tue, 10 Nov 2020 12:34:05 +0000 (21:34 +0900)]
use check-pass instead of build-pass in consts ui test suits

3 years agoadd cross crate test
Bastian Kauschke [Tue, 10 Nov 2020 09:55:34 +0000 (10:55 +0100)]
add cross crate test

3 years agoadd test for where clauses mentioning const params
Bastian Kauschke [Tue, 10 Nov 2020 09:38:36 +0000 (10:38 +0100)]
add test for where clauses mentioning const params

3 years agoconst param in async
Bastian Kauschke [Tue, 10 Nov 2020 09:31:33 +0000 (10:31 +0100)]
const param in async

3 years agotry referencing outer params
Bastian Kauschke [Tue, 10 Nov 2020 09:21:11 +0000 (10:21 +0100)]
try referencing outer params

3 years agoAuto merge of #78904 - Dylan-DPC:rollup-8d2w3vu, r=Dylan-DPC
bors [Tue, 10 Nov 2020 10:43:14 +0000 (10:43 +0000)]
Auto merge of #78904 - Dylan-DPC:rollup-8d2w3vu, r=Dylan-DPC

Rollup of 12 pull requests

Successful merges:

 - #74754 (Add `#[cfg(panic = '...')]`)
 - #76468 (Improve lifetime name annotations for closures & async functions)
 - #77016 (Test clippy on PR CI on changes)
 - #78480 (BTreeMap: fix pointer provenance rules)
 - #78502 (Update Chalk to 0.36.0)
 - #78513 (Infer the default host target from the host toolchain if possible)
 - #78566 (Enable LLVM Polly via llvm-args.)
 - #78580 (inliner: Break inlining cycles)
 - #78710 (rustc_ast: Do not panic by default when visiting macro calls)
 - #78746 (Demote i686-unknown-freebsd to tier 2 compiler target)
 - #78830 (fix `super_visit_with` for `Terminator`)
 - #78844 (Monomorphize a type argument of size-of operation during codegen)

Failed merges:

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

3 years agoexhaustively enumerate all values of a const param
Bastian Kauschke [Tue, 10 Nov 2020 09:08:51 +0000 (10:08 +0100)]
exhaustively enumerate all values of a const param

3 years agoadd associated type bounds test
Bastian Kauschke [Tue, 10 Nov 2020 09:02:19 +0000 (10:02 +0100)]
add associated type bounds test

3 years agoadd macro_rules test regarding braces
Bastian Kauschke [Tue, 10 Nov 2020 08:48:04 +0000 (09:48 +0100)]
add macro_rules test regarding braces

3 years agoAdd macro test for min-const-generics
kadmin [Mon, 9 Nov 2020 21:18:04 +0000 (21:18 +0000)]
Add macro test for min-const-generics

3 years agoadd generic param mismatch test
Bastian Kauschke [Tue, 10 Nov 2020 08:35:02 +0000 (09:35 +0100)]
add generic param mismatch test

3 years agoconst param macro test
Bastian Kauschke [Tue, 10 Nov 2020 08:29:27 +0000 (09:29 +0100)]
const param macro test

3 years agoUpdate src/test/ui/issues/issue-76547.rs
Tyler Mandry [Tue, 10 Nov 2020 01:44:03 +0000 (17:44 -0800)]
Update src/test/ui/issues/issue-76547.rs

Co-authored-by: Camelid <camelidcamel@gmail.com>
3 years agoadd nll compare mode stderr file
Gus Wynn [Tue, 10 Nov 2020 00:27:15 +0000 (16:27 -0800)]
add nll compare mode stderr file

3 years ago(rustdoc) [src] link for types defined by macros shows invocation
Florian Warzecha [Mon, 9 Nov 2020 18:58:19 +0000 (19:58 +0100)]
(rustdoc) [src] link for types defined by macros shows invocation

Previously the [src] link on types defined by a macro
pointed to the macro definition.
This commit makes the Clean-Implementation for Spans
aware of macro defined types,
so that the link points to the invocation instead.

3 years agoAdd flags customizing behaviour of MIR inlining
Tomasz Miąsko [Tue, 10 Nov 2020 00:00:00 +0000 (00:00 +0000)]
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.

3 years agoAdd comments to explain memory usage optimization
Camelid [Sun, 8 Nov 2020 21:52:15 +0000 (13:52 -0800)]
Add comments to explain memory usage optimization

3 years agoRollup merge of #78844 - tmiasko:monomorphize-sizeof, r=oli-obk
Dylan DPC [Mon, 9 Nov 2020 18:07:02 +0000 (19:07 +0100)]
Rollup merge of #78844 - tmiasko:monomorphize-sizeof, r=oli-obk

Monomorphize a type argument of size-of operation during codegen

This wasn't necessary until MIR inliner started to consider drop glue as
a candidate for inlining; introducing for the first time a generic use
of size-of operation.

No test at this point since this only happens with a custom inlining
threshold.

3 years agoRollup merge of #78830 - lcnr:mir-folder, r=oli-obk
Dylan DPC [Mon, 9 Nov 2020 18:06:59 +0000 (19:06 +0100)]
Rollup merge of #78830 - lcnr:mir-folder, r=oli-obk

fix `super_visit_with` for `Terminator`

fixes https://github.com/rust-lang/rust/pull/78182#discussion_r509265149

r? `@oli-obk`

cc `@LeSeulArtichaut`

3 years agoRollup merge of #78746 - pietroalbini:i686-freebsd, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:57 +0000 (19:06 +0100)]
Rollup merge of #78746 - pietroalbini:i686-freebsd, r=Mark-Simulacrum

Demote i686-unknown-freebsd to tier 2 compiler target

While technically the `i686-unknown-freebsd` target has been a tier 2 development platform for a long time, with full toolchain tarballs available on static.rust-lang.org, due to a bug in the manifest generation the target was never available for download through rustup.

The infrastructure team privately inquired the FreeBSD package maintainers, and they weren't relying on those tarballs either, so it's a fair assumption to say practically nobody is using those tarballs.

This PR then removes the CI builder that produces full tarballs for the target, and moves the compilation of `rust-std` for the target in `dist-various-2`. The `x86_64-unknown-freebsd` target is *not* affected.

cc `@rust-lang/infra` `@rust-lang/compiler` `@rust-lang/release`
r? `@Mark-Simulacrum`

3 years agoRollup merge of #78710 - petrochenkov:macvisit, r=davidtwco
Dylan DPC [Mon, 9 Nov 2020 18:06:55 +0000 (19:06 +0100)]
Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco

rustc_ast: Do not panic by default when visiting macro calls

Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them.

The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.

3 years agoRollup merge of #78580 - tmiasko:inline-loop, r=oli-obk
Dylan DPC [Mon, 9 Nov 2020 18:06:53 +0000 (19:06 +0100)]
Rollup merge of #78580 - tmiasko:inline-loop, r=oli-obk

inliner: Break inlining cycles

Keep track of all instances inlined so far. When examining a new call
sites from an inlined body, skip those where callee had been inlined
already to avoid potential inlining cycles.

Fixes #78573.

3 years agoRollup merge of #78566 - JRF63:polly, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:51 +0000 (19:06 +0100)]
Rollup merge of #78566 - JRF63:polly, r=Mark-Simulacrum

Enable LLVM Polly via llvm-args.

I think doing it this way is better than in #51061. Polly has other useful options and we probably don't want to create a `-Z` flag for each one of them.

![results](https://user-images.githubusercontent.com/7283601/97695555-338f7180-1adf-11eb-82bd-5130e0e6fa89.png)

[Benchmark](https://gist.github.com/JRF63/9a6268b91720958e90dbe7abffe20298)

I noticed that `-lto` seems to interfere with polly in this specific microbenchmark, as enabling it causes the perf to drop to that of non-polly builds.

Other related PRs: #75615

3 years agoRollup merge of #78513 - jyn514:rustup-toolchain, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:49 +0000 (19:06 +0100)]
Rollup merge of #78513 - jyn514:rustup-toolchain, r=Mark-Simulacrum

Infer the default host target from the host toolchain if possible

- `beta-x86_64-unknown-linux-gnu` has beta stripped
- `rustc2` is ignored

This fixes ongoing issues where x.py will detect the wrong host triple
between MSVC and GNU.

I don't think this will break anyone's workflow - I'd be very surprised if you a) had no `[build]` section in `config.toml`, b) had rustc installed, and c) expected the default target to be something other than the default target used by `rustc`. But I could be wrong - I'm happy to hear user stories :)

Fixes https://github.com/rust-lang/rust/issues/78150.

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

3 years agoRollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis
Dylan DPC [Mon, 9 Nov 2020 18:06:46 +0000 (19:06 +0100)]
Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis

Update Chalk to 0.36.0

This PR updates Chalk and fixes a number of bugs in the chalk integration code.

cc `@rust-lang/wg-traits`
r? `@nikomatsakis`

3 years agoRollup merge of #78480 - ssomers:btree-alias, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:44 +0000 (19:06 +0100)]
Rollup merge of #78480 - ssomers:btree-alias, r=Mark-Simulacrum

BTreeMap: fix pointer provenance rules

Fixes #78477 and includes #78476

r? `@Mark-Simulacrum`

3 years agoRollup merge of #77016 - Mark-Simulacrum:clippy-tests, r=pietroalbini
Dylan DPC [Mon, 9 Nov 2020 18:06:42 +0000 (19:06 +0100)]
Rollup merge of #77016 - Mark-Simulacrum:clippy-tests, r=pietroalbini

Test clippy on PR CI on changes

This runs the tools builder (which builds and tests tools, including clippy) when the clippy submodule changes. This essentially returns us to the prior state when clippy was a submodule; it makes sense for us to test it on CI when it changes. It might make sense for it to be tested regardless of changing but it is somewhat rare for it to fail and we don't want to add to CI time for the majority of PRs which don't affect it.

Fixes #76999.

3 years agoRollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:39 +0000 (19:06 +0100)]
Rollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum

Improve lifetime name annotations for closures & async functions

* Don't refer to async functions as "generators" in error output
* Where possible, emit annotations pointing exactly at the `&` in the return type of closures (when they have explicit return types) and async functions, like we do for arguments.
Addresses #74072, but I wouldn't call that *closed* until annotations are identical for async and non-async functions.
* Emit a better annotation when the lifetime doesn't appear in the full name type, which currently happens for opaque types like `impl Future`. Addresses #74497, but further improves could probably be made (why *doesn't* it appear in the type as `impl Future + '1`?)
This is included in the same PR because the changes to `give_name_if_anonymous_region_appears_in_output` would introduce ICE otherwise (it would return `None` in cases where it didn't previously, which then gets `unwrap`ped)

3 years agoRollup merge of #74754 - davidhewitt:cfg-panic, r=ecstatic-morse
Dylan DPC [Mon, 9 Nov 2020 18:06:37 +0000 (19:06 +0100)]
Rollup merge of #74754 - davidhewitt:cfg-panic, r=ecstatic-morse

Add `#[cfg(panic = '...')]`

This PR adds conditional compilation according to the panic strategy.

I've come across a need for a flag like this a couple of times while writing tests: #74301 , https://github.com/rust-lang/rust/pull/73670#issuecomment-653629031

I'm not sure if I need to add a feature gate for this flag?

3 years agoVendor libtest's dependencies in the rust-src component
Alexis Beingessner [Thu, 5 Nov 2020 22:18:14 +0000 (17:18 -0500)]
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

3 years agoAdd missing newline to error message of the default OOM hook
hyd-dev [Mon, 9 Nov 2020 14:32:58 +0000 (22:32 +0800)]
Add missing newline to error message of the default OOM hook

3 years agouse RegionNameHighlight for async fn and closure returns
SNCPlay42 [Tue, 8 Sep 2020 04:35:24 +0000 (05:35 +0100)]
use RegionNameHighlight for async fn and closure returns

3 years agoBad grammar
cyqsimon [Mon, 9 Nov 2020 15:52:33 +0000 (23:52 +0800)]
Bad grammar

3 years agoadd regression test for #78892
SNCPlay42 [Mon, 9 Nov 2020 15:43:33 +0000 (15:43 +0000)]
add regression test for #78892

3 years agoAdd `#[cfg(panic = "...")]`
David Hewitt [Sat, 25 Jul 2020 18:02:49 +0000 (19:02 +0100)]
Add `#[cfg(panic = "...")]`

3 years agoClarified description of write! macro
cyqsimon [Mon, 9 Nov 2020 15:00:31 +0000 (23:00 +0800)]
Clarified description of write! macro

3 years agoAuto merge of #78201 - joshtriplett:rustc-tls-model, r=Mark-Simulacrum
bors [Mon, 9 Nov 2020 11:08:07 +0000 (11:08 +0000)]
Auto merge of #78201 - joshtriplett:rustc-tls-model, r=Mark-Simulacrum

Compile rustc crates with the initial-exec TLS model

This should produce more efficient code, with fewer calls to
__tls_get_addr. The tradeoff is that libraries using it won't work with
dlopen, but that shouldn't be a problem for rustc's internal libraries.

3 years agoBTreeMap: fix pointer provenance rules, make borrowing explicit
Stein Somers [Wed, 28 Oct 2020 10:58:06 +0000 (11:58 +0100)]
BTreeMap: fix pointer provenance rules, make borrowing explicit

3 years agocomment attribution fix
o752d [Mon, 9 Nov 2020 03:42:10 +0000 (03:42 +0000)]
comment attribution fix

comment means to refer to the macro in its direct scope

3 years agoAuto merge of #78889 - Dylan-DPC:rollup-6zjhahf, r=Dylan-DPC
bors [Mon, 9 Nov 2020 00:36:58 +0000 (00:36 +0000)]
Auto merge of #78889 - Dylan-DPC:rollup-6zjhahf, r=Dylan-DPC

Rollup of 12 pull requests

Successful merges:

 - #77640 (Refactor IntErrorKind to avoid "underflow" terminology)
 - #78026 (Define `fs::hard_link` to not follow symlinks.)
 - #78114 (Recognize `private_intra_doc_links` as a lint)
 - #78228 (Promote aarch64-unknown-linux-gnu to Tier 1)
 - #78345 (Fix handling of item names for HIR)
 - #78437 (BTreeMap: stop mistaking node for an orderly place)
 - #78476 (fix some incorrect aliasing in the BTree)
 - #78674 (inliner: Use substs_for_mir_body)
 - #78748 (Implement destructuring assignment for tuples)
 - #78868 (Fix tab focus on restyled switches)
 - #78878 (Avoid overlapping cfg attributes when both macOS and aarch64)
 - #78882 (Nicer hunk headers for rust files)

Failed merges:

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

3 years agoRollup merge of #78882 - bjorn3:nicer_hunk_headers, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 00:13:50 +0000 (01:13 +0100)]
Rollup merge of #78882 - bjorn3:nicer_hunk_headers, r=Mark-Simulacrum

Nicer hunk headers for rust files

I found this trick at <https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more>

Before the hunk headers for changes in methods would refer to the impl:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -678,7 +678,7 ``@@`` impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckResults<'tcx> {
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

After the hunk headers refer to the actual function signature:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -678,7 +678,7 ``@@`` fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

When the function signature is visible, it will use the function
signature of the previous method as hunk header:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..63058dfc837 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -992,6 +992,7 ``@@`` pub fn typeck_opt_const_arg(
     }

     pub fn alloc_steal_mir(self, mir: Body<'tcx>) -> &'tcx Steal<Body<'tcx>> {
+        // foo
         self.arena.alloc(Steal::new(mir))
     }
```

3 years agoRollup merge of #78878 - shepmaster:intersecting-ignores, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 00:13:48 +0000 (01:13 +0100)]
Rollup merge of #78878 - shepmaster:intersecting-ignores, r=Mark-Simulacrum

Avoid overlapping cfg attributes when both macOS and aarch64

r? ``@Mark-Simulacrum``