]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdd test for idents merge
Guillaume Gomez [Thu, 8 Apr 2021 09:49:28 +0000 (11:49 +0200)]
Add test for idents merge

3 years agoMerge idents if they are part of a path
Guillaume Gomez [Thu, 8 Apr 2021 09:49:17 +0000 (11:49 +0200)]
Merge idents if they are part of a path

3 years agoAuto merge of #83981 - nagisa:nagisa/revert-cfg-wasm, r=Mark-Simulacrum
bors [Thu, 8 Apr 2021 07:23:04 +0000 (07:23 +0000)]
Auto merge of #83981 - nagisa:nagisa/revert-cfg-wasm, r=Mark-Simulacrum

Remove the insta-stable `cfg(wasm)`

The addition of `cfg(wasm)` was an oversight on my end that turns out to have a number
of downsides:

* It was introduced as an insta-stable addition, forgoing the usual
  staging mechanism we use for potentially far-reaching changes;
* It is a breaking change for people who are using `--cfg wasm` either
  directly or via cargo for other purposes;
* It is not entirely clear if a bare `wasm` cfg is a right option or
  whether `wasm` family of targets are special enough to warrant
  special-casing these targets specifically.

As for the last point, there appears to be a fair amount of support for
reducing the boilerplate in specifying architectures from the same
family, while ignoring their pointer width. The suggested way forward
would be to propose such a change as a separate RFC as it is potentially
a quite contentious addition.

cc #83879 `@devsnek`

3 years agoAuto merge of #83866 - jyn514:disambiguator-error, r=camelid
bors [Thu, 8 Apr 2021 05:08:08 +0000 (05:08 +0000)]
Auto merge of #83866 - jyn514:disambiguator-error, r=camelid

rustdoc: Link to the docs on namespaces when an unknown disambiguator is found

cc https://github.com/rust-lang/rust/issues/83859

`@lopopolo` does this look about like what you expected?

r? `@camelid`

3 years agoAuto merge of #82958 - camelid:res-docs, r=petrochenkov
bors [Thu, 8 Apr 2021 02:43:31 +0000 (02:43 +0000)]
Auto merge of #82958 - camelid:res-docs, r=petrochenkov

Document `Res` and its friends

I noticed [this Zulip conversation][z] and thought it would be a good idea to
document `Res` and the other types near it.

[z]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.2382516.20-.20Add.20inherent.20associated.20types/near/227914819

3 years agoFix some typos in docs for `-C split-debuginfo`
Camelid [Thu, 25 Mar 2021 22:44:37 +0000 (15:44 -0700)]
Fix some typos in docs for `-C split-debuginfo`

3 years agoDocument `Res` and its friends
Camelid [Wed, 10 Mar 2021 03:37:21 +0000 (19:37 -0800)]
Document `Res` and its friends

3 years agoAuto merge of #83986 - Dylan-DPC:rollup-51vygcj, r=Dylan-DPC
bors [Thu, 8 Apr 2021 00:15:36 +0000 (00:15 +0000)]
Auto merge of #83986 - Dylan-DPC:rollup-51vygcj, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #82497 (Fix handling of `--output-format json` flag)
 - #83689 (Add more info for common trait resolution and async/await errors)
 - #83952 (Account for `ExprKind::Block` when suggesting .into() and deref)
 - #83965 (Add Debug implementation for hir::intravisit::FnKind)
 - #83974 (Fix outdated crate names in `rustc_interface::callbacks`)

Failed merges:

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

3 years agoRollup merge of #83974 - pierwill:fix-callbacks-names, r=jyn514
Dylan DPC [Wed, 7 Apr 2021 23:01:47 +0000 (01:01 +0200)]
Rollup merge of #83974 - pierwill:fix-callbacks-names, r=jyn514

Fix outdated crate names in `rustc_interface::callbacks`

3 years agoRollup merge of #83965 - rust-lang:debug-intravisit-fnkind, r=lqd
Dylan DPC [Wed, 7 Apr 2021 23:01:46 +0000 (01:01 +0200)]
Rollup merge of #83965 - rust-lang:debug-intravisit-fnkind, r=lqd

Add Debug implementation for hir::intravisit::FnKind

3 years agoRollup merge of #83952 - estebank:issue-83943, r=petrochenkov
Dylan DPC [Wed, 7 Apr 2021 23:01:45 +0000 (01:01 +0200)]
Rollup merge of #83952 - estebank:issue-83943, r=petrochenkov

Account for `ExprKind::Block` when suggesting .into() and deref

Fix #83943.

3 years agoRollup merge of #83689 - estebank:cool-bears-hot-tip, r=davidtwco
Dylan DPC [Wed, 7 Apr 2021 23:01:43 +0000 (01:01 +0200)]
Rollup merge of #83689 - estebank:cool-bears-hot-tip, r=davidtwco

Add more info for common trait resolution and async/await errors

* Suggest `Pin::new`/`Box::new`/`Arc::new`/`Box::pin` in more cases
* Point at `impl` and type defs introducing requirements on E0277

3 years agoRollup merge of #82497 - jyn514:json, r=CraftSpider
Dylan DPC [Wed, 7 Apr 2021 23:01:42 +0000 (01:01 +0200)]
Rollup merge of #82497 - jyn514:json, r=CraftSpider

Fix handling of `--output-format json` flag

- Don't treat it as deprecated on stable and beta channels. Before, it
  would give confusing and incorrect output:

  ```
  warning: the 'output-format' flag is considered deprecated
    |
    = warning: see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more information

  error: json output format isn't supported for doc generation
  ```
  Both of those are wrong: output-format isn't deprecated, and json
  output is supported.

- Require -Z unstable-options for `--output-format json`

  Previously, it was allowed by default on nightly, which made it hard
  to realize the flag wouldn't be accepted on beta or stable.

To get the test working I had to remove `-Z unstable-options`, which x.py passed to compiletest unconditionally. It was first added in https://github.com/rust-lang/rust/commit/8c2ec689c159e7f021d5913efb991aff875be967 so `-Z miri` would be allowed. -Z miri is no longer passed unconditionally, so hopefully removing it won't break anything.

r? ```@aDotInTheVoid``` cc ```@HeroicKatora``` ```@CraftSpider```

Thanks to ```@memoryruins``` for pointing it out on Discord!

cc ```@Mark-Simulacrum``` for the change to compiletest.

3 years agoAuto merge of #82451 - jyn514:defaults, r=Mark-Simulacrum
bors [Wed, 7 Apr 2021 20:44:37 +0000 (20:44 +0000)]
Auto merge of #82451 - jyn514:defaults, r=Mark-Simulacrum

Cleanup option parsing and config.toml.example

- Add an assertion that `link-shared = true` when `thin-lto = true`.
  Previously, link-shared would be silently overwritten.

- Get rid of `Option<bool>` in bootstrap/config.rs. Set defaults
  immediately instead of delaying until later in bootstrap. This makes
  it easier to find what the default value is.

- Remove redundant `config.x = false` when the default was already false
- Set defaults for `bindir` in `default_opts()` instead of `parse()`
- Update `download-ci-llvm = if-supported` option to match bootstrap.py
- Remove redundant check for link_shared. Previously, it was checked twice.

- Update various options in config.toml.example to their defaults.
  Previously, some options showed an example value instead of the
  default value.

- Fix incorrect defaults in config.toml.example
  + `use-libcxx` defaults to false
  + Add missing `check-stage = 0`
  + Update several defaults to be conditional (e.g. `if incremental { 10 } else { 100 }`)

- Remove redundant defaults in prose
- Use the same comment for the default and target-dependent `musl-root`
- Fix typos
- Link to `cc_detect` for `cc` and `cxx`, since the logic is ... complicated.
- Update more defaults to better reflect how they actually get set
- Remove ignored `gpg-password-file` option

  This stopped being used in
  7704d35,
  but was never removed from config.toml.

- Remove unused flags from `config.toml`
    + Disallow `infodir` and `localstatedir` in `config.toml`
    + Allow the flags in `./configure`, but give a warning that they will be
      ignored.
    + Fix incorrect comment that `datadir` will be ignored.

    Example output:

    ```
    $ ./configure --set install.infodir=xxx
    configure: processing command line
    configure:
    configure: install.infodir      := xxx
    configure: build.configure-args := ['--set', 'install.infodir=xxx']
    warning: infodir will be ignored
    configure:
    configure: writing `config.toml` in current directory
    configure:
    configure: run `python /home/joshua/rustc3/x.py --help`
    configure:
    ```

- Update CHANGELOG

cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/bootstrap.20defaults

3 years agoRemove the insta-stable `cfg(wasm)`
Simonas Kazlauskas [Wed, 7 Apr 2021 19:49:33 +0000 (22:49 +0300)]
Remove the insta-stable `cfg(wasm)`

The addition of `cfg(wasm)` was an oversight on my end that has a number
of downsides:

* It was introduced as an insta-stable addition, forgoing the usual
  staging mechanism we use for potentially far-reaching changes;
* It is a breaking change for people who are using `--cfg wasm` either
  directly or via cargo for other purposes;
* It is not entirely clear if a bare `wasm` cfg is a right option or
  whether `wasm` family of targets are special enough to warrant
  special-casing these targets specifically.

As for the last point, there appears to be a fair amount of support for
reducing the boilerplate in specifying architectures from the same
family, while ignoring their pointer width. The suggested way forward
would be to propose such a change as a separate RFC as it is potentially
a quite contentious addition.

3 years agoCleanup option parsing and config.toml.example
Joshua Nelson [Tue, 23 Feb 2021 18:01:39 +0000 (13:01 -0500)]
Cleanup option parsing and config.toml.example

- Add an assertion that `link-shared = true` when `thin-lto = true`.
  Previously, link-shared would be silently overwritten.

- Get rid of `Option<bool>` in bootstrap/config.rs. Set defaults
  immediately instead of delaying until later in bootstrap. This makes
  it easier to find what the default value is.

- Remove redundant `config.x = false` when the default was already false
- Set defaults for `bindir` in `default_opts()` instead of `parse()`
- Update `download-ci-llvm = if-supported` option to match bootstrap.py
- Remove redundant check for link_shared. Previously, it was checked twice.

- Update various options in config.toml.example to their defaults.
  Previously, some options showed an example value instead of the
  default value.

- Fix incorrect defaults in config.toml.example
  + `use-libcxx` defaults to false
  + Add missing `check-stage = 0`
  + Update several defaults to be conditional (e.g. `if incremental { 10 } else { 100 }`)

- Remove redundant defaults in prose
- Use the same comment for the default and target-dependent `musl-root`
- Fix typos
- Link to `cc_detect` for `cc` and `cxx`, since the logic is ... complicated.
- Update more defaults to better reflect how they actually get set
- Remove ignored `gpg-password-file` option

  This stopped being used in
  https://github.com/rust-lang/rust/commit/7704d35accfe1b587ce41ea09ca3bf6a47aca117,
  but was never removed from config.toml.

- Remove unused flags from `config.toml`
    + Disallow `infodir` and `localstatedir` in `config.toml`
    + Allow the flags in `./configure`, but give a warning that they will be
      ignored.
    + Fix incorrect comment that `datadir` will be ignored.

    Example output:

    ```
    $ ./configure --set install.infodir=xxx
    configure: processing command line
    configure:
    configure: install.infodir      := xxx
    configure: build.configure-args := ['--set', 'install.infodir=xxx']
    warning: infodir will be ignored
    configure:
    configure: writing `config.toml` in current directory
    configure:
    configure: run `python /home/joshua/rustc3/x.py --help`
    configure:
    ```

- Update CHANGELOG
- Add "as an example" where appropriate
- Link to an issue instead of to ephemeral chats

3 years agoAuto merge of #81047 - glittershark:stabilize-cmp-min-max-by, r=kodraus
bors [Wed, 7 Apr 2021 18:02:21 +0000 (18:02 +0000)]
Auto merge of #81047 - glittershark:stabilize-cmp-min-max-by, r=kodraus

Stabilize cmp_min_max_by

I would like to propose cmp::{min_by, min_by_key, max_by, max_by_key}
for stabilization.

These are relatively simple and seemingly uncontroversial functions and
have been unchanged in unstable for a while now.

Closes: #64460
3 years agoFix outdated crate names in `rustc_interface::callbacks`
pierwill [Wed, 7 Apr 2021 16:45:27 +0000 (11:45 -0500)]
Fix outdated crate names in `rustc_interface::callbacks`

3 years agoAdded additional comments and minor edits
K [Wed, 7 Apr 2021 16:35:39 +0000 (12:35 -0400)]
Added additional comments and minor edits

3 years agoUpdate library/core/src/iter/traits/iterator.rs
lukaslueg [Wed, 7 Apr 2021 16:02:46 +0000 (18:02 +0200)]
Update library/core/src/iter/traits/iterator.rs

Co-authored-by: Yuki Okushi <jtitor@2k36.org>
3 years agoUpdate library/core/src/iter/traits/iterator.rs
lukaslueg [Wed, 7 Apr 2021 16:02:39 +0000 (18:02 +0200)]
Update library/core/src/iter/traits/iterator.rs

Co-authored-by: Yuki Okushi <jtitor@2k36.org>
3 years agoAuto merge of #83964 - Dylan-DPC:rollup-9kinaiv, r=Dylan-DPC
bors [Wed, 7 Apr 2021 15:33:46 +0000 (15:33 +0000)]
Auto merge of #83964 - Dylan-DPC:rollup-9kinaiv, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #83476 (Add strong_count mutation methods to Rc)
 - #83634 (Do not emit the advanced diagnostics on macros)
 - #83816 (Trigger `unused_doc_comments` on macros at once)
 - #83916 (Use AnonConst for asm! constants)
 - #83935 (forbid `impl Trait` in generic param defaults)
 - #83936 (Disable using non-ascii identifiers in extern blocks.)
 - #83945 (Add suggestion to reborrow mutable references when they're moved in a for loop)
 - #83954 (Do not ICE when closure is involved in Trait Alias Impl Trait)

Failed merges:

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

3 years agorebase and update tests
Esteban Küber [Wed, 7 Apr 2021 15:31:38 +0000 (08:31 -0700)]
rebase and update tests

3 years agoStabilize cmp_min_max_by
Griffin Smith [Fri, 15 Jan 2021 17:20:54 +0000 (12:20 -0500)]
Stabilize cmp_min_max_by

I would like to propose cmp::{min_by, min_by_key, max_by, max_by_key}
for stabilization.

These are relatively simple and seemingly uncontroversial functions and
have been unchanged in unstable for a while now.

3 years agoReuse logic for determining the channel in the rest of rustdoc
Joshua Nelson [Tue, 6 Apr 2021 18:51:36 +0000 (14:51 -0400)]
Reuse logic for determining the channel in the rest of rustdoc

This doesn't update main.js because it's included as a fixed string.

3 years agorustdoc: Link to the docs on namespaces when an unknown disambiguator is found
Joshua Nelson [Mon, 5 Apr 2021 00:02:32 +0000 (20:02 -0400)]
rustdoc: Link to the docs on namespaces when an unknown disambiguator is found

3 years agoAuto merge of #83932 - lcnr:probe-perf, r=estebank
bors [Wed, 7 Apr 2021 12:52:33 +0000 (12:52 +0000)]
Auto merge of #83932 - lcnr:probe-perf, r=estebank

use a `SmallVec` in `impl_or_trait_item`

#83293 showed that this is fairly hot, slightly improves max-rss and cpu cycles, does not noticeably improve instruction counts

3 years agoAdd Debug implementation for hir::intravisit::FnKind
Guillaume Gomez [Wed, 7 Apr 2021 11:30:37 +0000 (13:30 +0200)]
Add Debug implementation for hir::intravisit::FnKind

3 years agoRollup merge of #83954 - estebank:issue-83613, r=varkor
Dylan DPC [Wed, 7 Apr 2021 11:07:18 +0000 (13:07 +0200)]
Rollup merge of #83954 - estebank:issue-83613, r=varkor

Do not ICE when closure is involved in Trait Alias Impl Trait

Fix #83613.

3 years agoRollup merge of #83945 - SkiFire13:fix-83924, r=estebank
Dylan DPC [Wed, 7 Apr 2021 11:07:17 +0000 (13:07 +0200)]
Rollup merge of #83945 - SkiFire13:fix-83924, r=estebank

Add suggestion to reborrow mutable references when they're moved in a for loop

Address #83924

3 years agoRollup merge of #83936 - crlf0710:disallow_extern_block_non_ascii, r=Manishearth
Dylan DPC [Wed, 7 Apr 2021 11:07:16 +0000 (13:07 +0200)]
Rollup merge of #83936 - crlf0710:disallow_extern_block_non_ascii, r=Manishearth

Disable using non-ascii identifiers in extern blocks.

Fixes #83923.

3 years agoRollup merge of #83935 - SNCPlay42:param-default-impl-trait, r=varkor
Dylan DPC [Wed, 7 Apr 2021 11:07:15 +0000 (13:07 +0200)]
Rollup merge of #83935 - SNCPlay42:param-default-impl-trait, r=varkor

forbid `impl Trait` in generic param defaults

Fixes #83929

Forbid using `impl Trait` in the default types of generic parameters, e.g. `struct Foo<T = impl Trait>`. I assume this was never supposed to be allowed - it seems no UI test used it.

Note that using `impl Trait` in this position did not hit a feature gate error; however, this *shouldn't* be a breaking change as any attempt to use it should have hit the ICE in #83929 and/or failed to provide a defining use of the `impl Trait`.

3 years agoRollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov
Dylan DPC [Wed, 7 Apr 2021 11:07:14 +0000 (13:07 +0200)]
Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov

Use AnonConst for asm! constants

This replaces the old system which used explicit promotion. See #83169 for more background.

The syntax for `const` operands is still the same as before: `const <expr>`.

Fixes #83169

Because the implementation is heavily based on inline consts, we suffer from the same issues:
- We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`.
- We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.

3 years agoRollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov
Dylan DPC [Wed, 7 Apr 2021 11:07:14 +0000 (13:07 +0200)]
Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov

Use AnonConst for asm! constants

This replaces the old system which used explicit promotion. See #83169 for more background.

The syntax for `const` operands is still the same as before: `const <expr>`.

Fixes #83169

Because the implementation is heavily based on inline consts, we suffer from the same issues:
- We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`.
- We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.

3 years agoRollup merge of #83816 - JohnTitor:unused-doc-comments-on-macros, r=varkor
Dylan DPC [Wed, 7 Apr 2021 11:07:12 +0000 (13:07 +0200)]
Rollup merge of #83816 - JohnTitor:unused-doc-comments-on-macros, r=varkor

Trigger `unused_doc_comments` on macros at once

Fixes #83768

3 years agoRollup merge of #83634 - JohnTitor:proc-macro-ice, r=varkor
Dylan DPC [Wed, 7 Apr 2021 11:07:11 +0000 (13:07 +0200)]
Rollup merge of #83634 - JohnTitor:proc-macro-ice, r=varkor

Do not emit the advanced diagnostics on macros

Fixes #83510

3 years agoRollup merge of #83476 - mystor:rc_mutate_strong_count, r=m-ou-se
Dylan DPC [Wed, 7 Apr 2021 11:07:06 +0000 (13:07 +0200)]
Rollup merge of #83476 - mystor:rc_mutate_strong_count, r=m-ou-se

Add strong_count mutation methods to Rc

The corresponding methods were stabilized on `Arc` in #79285 (tracking: #71983). This patch implements and stabilizes identical methods on the `Rc` types as well.

3 years agoAuto merge of #83833 - jyn514:no-resolver, r=GuillaumeGomez
bors [Wed, 7 Apr 2021 04:45:12 +0000 (04:45 +0000)]
Auto merge of #83833 - jyn514:no-resolver, r=GuillaumeGomez

rustdoc: Store intra-doc links in Cache instead of on items directly

Items are first built after rustdoc creates the TyCtxt. To allow
resolving the links before the TyCtxt is built, the links can't be
stored on `clean::Item` directly.

Helps with https://github.com/rust-lang/rust/issues/83761. Opening this early because I think it might decrease memory usage.

3 years agoAuto merge of #7046 - camsteffen:symbol-optimize, r=giraffate
bors [Wed, 7 Apr 2021 04:36:31 +0000 (04:36 +0000)]
Auto merge of #7046 - camsteffen:symbol-optimize, r=giraffate

Some symbol optimizations

changelog: none

3 years agoAdd spans to E0277 for impl/trait type/fn obligation disparity
Esteban Küber [Wed, 31 Mar 2021 23:53:26 +0000 (16:53 -0700)]
Add spans to E0277 for impl/trait type/fn obligation disparity

3 years agoreview comments
Esteban Küber [Wed, 31 Mar 2021 19:10:24 +0000 (12:10 -0700)]
review comments

3 years agoAlways mention `Box::pin` when dealing with `!Unpin`
Esteban Küber [Tue, 30 Mar 2021 20:51:08 +0000 (13:51 -0700)]
Always  mention `Box::pin` when dealing with `!Unpin`

3 years agoPoint at `impl` and type defs introducing requirements on E0277
Esteban Küber [Tue, 30 Mar 2021 20:37:30 +0000 (13:37 -0700)]
Point at `impl` and type defs introducing requirements on E0277

3 years agoSuggest Pin/Box/Arc for more cases
Esteban Küber [Tue, 30 Mar 2021 17:01:22 +0000 (10:01 -0700)]
Suggest Pin/Box/Arc for more cases

3 years agoAuto merge of #83955 - ehuss:update-stage0, r=Mark-Simulacrum
bors [Wed, 7 Apr 2021 02:26:25 +0000 (02:26 +0000)]
Auto merge of #83955 - ehuss:update-stage0, r=Mark-Simulacrum

Bump bootstrap compiler

Pulls in #83946

Closes #83914

3 years agoUse a more appropriate span for `;` suggestion
Esteban Küber [Wed, 7 Apr 2021 02:23:22 +0000 (19:23 -0700)]
Use a more appropriate span for `;` suggestion

Fix #83892.

3 years agoDisable using non-ascii identifiers in extern blocks.
Charles Lew [Tue, 6 Apr 2021 15:49:59 +0000 (23:49 +0800)]
Disable using non-ascii identifiers in extern blocks.

3 years agoBump bootstrap compiler
Eric Huss [Wed, 7 Apr 2021 01:24:09 +0000 (18:24 -0700)]
Bump bootstrap compiler

3 years agoDo not ICE when closure is involved in TAIT
Esteban Küber [Wed, 7 Apr 2021 01:17:50 +0000 (18:17 -0700)]
Do not ICE when closure is involved in TAIT

Fix #83613.

3 years agoRemove trailing `:` from E0119 message
Esteban Küber [Wed, 7 Apr 2021 01:16:11 +0000 (18:16 -0700)]
Remove trailing `:` from E0119 message

3 years agoAccount for `ExprKind::Block` when suggesting .into() and deref
Esteban Küber [Wed, 7 Apr 2021 00:23:48 +0000 (17:23 -0700)]
Account for `ExprKind::Block` when suggesting .into() and deref

Fix #83943.

3 years agoAuto merge of #83828 - camelid:rustdoc-vec-perf, r=jyn514
bors [Tue, 6 Apr 2021 23:57:06 +0000 (23:57 +0000)]
Auto merge of #83828 - camelid:rustdoc-vec-perf, r=jyn514

rustdoc: Use `ThinVec` in a few places

Almost every crate has no primitives and no keywords defined in it, so
using `ThinVec` should make some types smaller.

3 years agoFix handling of `--output-format json` flag
Joshua Nelson [Wed, 24 Feb 2021 21:16:49 +0000 (16:16 -0500)]
Fix handling of `--output-format json` flag

- Don't treat it as deprecated on stable and beta channels. Before, it
  would give confusing and incorrect output:

  ```
  warning: the 'output-format' flag is considered deprecated
    |
    = warning: see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more information

  error: json output format isn't supported for doc generation
  ```
  Both of those are wrong: output-format isn't deprecated, and json
  output is supported.

- Require -Z unstable-options for `--output-format json`

  Previously, it was allowed by default on nightly, which made it hard
  to realize the flag wouldn't be accepted on beta or stable.
  Note that this still allows `--output-format html`, which has been
  stable since 1.0.

- Remove unnecessary double-checking of the feature gate when parsing
  the output format
- Add custom run-make test since compiletest passes -Zunstable-options
    by default

3 years agoAdd regression test
Giacomo Stevanato [Tue, 6 Apr 2021 19:39:58 +0000 (21:39 +0200)]
Add regression test

3 years agoAdd reborrow suggestion when mutable reference is moved in a for loop
Giacomo Stevanato [Tue, 6 Apr 2021 19:39:44 +0000 (21:39 +0200)]
Add reborrow suggestion when mutable reference is moved in a for loop

3 years agoStore links in Cache instead of on items directly
Joshua Nelson [Sun, 4 Apr 2021 02:15:24 +0000 (22:15 -0400)]
Store links in Cache instead of on items directly

Items are first built after rustdoc creates the TyCtxt. To allow
resolving the links before the TyCtxt is built, the links can't be
stored on `clean::Item` directly.

3 years agoSymbol optimizations
Cameron Steffen [Wed, 24 Mar 2021 14:31:43 +0000 (09:31 -0500)]
Symbol optimizations

3 years agoAuto merge of #83934 - Dylan-DPC:rollup-nw5dadn, r=Dylan-DPC
bors [Tue, 6 Apr 2021 17:55:55 +0000 (17:55 +0000)]
Auto merge of #83934 - Dylan-DPC:rollup-nw5dadn, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #82963 (Move `SharedContext` to `context.rs`)
 - #83829 (rustc_target: Rely on defaults more in target specs)
 - #83895 (Add listing of lints (eg via `-W help`) to rustdoc)
 - #83902 (Update LLVM to support more wasm simd ops)
 - #83903 (Fix typo in TokenStream documentation)
 - #83910 (Update cargo)
 - #83920 (Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0)

Failed merges:

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

3 years agoAuto merge of #7044 - camsteffen:match-path, r=Manishearth
bors [Tue, 6 Apr 2021 17:41:34 +0000 (17:41 +0000)]
Auto merge of #7044 - camsteffen:match-path, r=Manishearth

Soft deprecate match_path and match_qpath

changelog: none

From zulip [disucssion](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/match_.5Bq.5Dpath.20is.20bad.3F).

3 years agorustdoc: Use `ThinVec` in a few places
Camelid [Sat, 3 Apr 2021 01:32:06 +0000 (18:32 -0700)]
rustdoc: Use `ThinVec` in a few places

Almost every crate has no primitives and no keywords defined in it, so
using `ThinVec` should make some types smaller.

3 years agoAuto merge of #7043 - camsteffen:dead-utils, r=flip1995
bors [Tue, 6 Apr 2021 16:49:42 +0000 (16:49 +0000)]
Auto merge of #7043 - camsteffen:dead-utils, r=flip1995

Remove some dead utils

changelog: none

3 years agoSoft deprecate match_path and match_qpath
Cameron Steffen [Tue, 6 Apr 2021 13:56:14 +0000 (08:56 -0500)]
Soft deprecate match_path and match_qpath

3 years agoRemove paths::PATH_BUF
Cameron Steffen [Thu, 1 Apr 2021 15:24:44 +0000 (10:24 -0500)]
Remove paths::PATH_BUF

3 years agoRemove get_node_span
Cameron Steffen [Thu, 1 Apr 2021 14:51:31 +0000 (09:51 -0500)]
Remove get_node_span

3 years agoMerge branch 'master' into stab_peek_mut
lukaslueg [Tue, 6 Apr 2021 16:23:21 +0000 (18:23 +0200)]
Merge branch 'master' into stab_peek_mut

3 years agoUpdate library/core/src/iter/adapters/peekable.rs
lukaslueg [Tue, 6 Apr 2021 16:16:02 +0000 (18:16 +0200)]
Update library/core/src/iter/adapters/peekable.rs

Co-authored-by: Alexander Ronald Altman <alexanderaltman@me.com>
3 years agoRollup merge of #83920 - ortem:fix-hashmap-lldb-pretty-printer-1.52, r=pnkfelix
Dylan DPC [Tue, 6 Apr 2021 15:42:35 +0000 (17:42 +0200)]
Rollup merge of #83920 - ortem:fix-hashmap-lldb-pretty-printer-1.52, r=pnkfelix

Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0

The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566 after updating hashbrown to 0.11.0.
Note that the corresponding GDB pretty-printer was updated properly.

Fixes #83891

3 years agoRollup merge of #83910 - ehuss:update-cargo, r=ehuss
Dylan DPC [Tue, 6 Apr 2021 15:42:34 +0000 (17:42 +0200)]
Rollup merge of #83910 - ehuss:update-cargo, r=ehuss

Update cargo

3 commits in 3c44c3c4b7900b8b13c85ead25ccaa8abb7d8989..65d57e6f384c2317f76626eac116f683e2b63665
2021-03-31 21:21:15 +0000 to 2021-04-04 15:07:52 +0000
- Fix typo in contrib docs. (rust-lang/cargo#9328)
- fix clippy warnings (rust-lang/cargo#9323)
- Add -Zallow-features to match rustc's -Z (rust-lang/cargo#9283)

3 years agoRollup merge of #83903 - rust-lang:GuillaumeGomez-patch-1, r=lcnr
Dylan DPC [Tue, 6 Apr 2021 15:42:33 +0000 (17:42 +0200)]
Rollup merge of #83903 - rust-lang:GuillaumeGomez-patch-1, r=lcnr

Fix typo in TokenStream documentation

3 years agoRollup merge of #83902 - alexcrichton:update-llvm, r=nikic
Dylan DPC [Tue, 6 Apr 2021 15:42:32 +0000 (17:42 +0200)]
Rollup merge of #83902 - alexcrichton:update-llvm, r=nikic

Update LLVM to support more wasm simd ops

Adds a commit with support for i64 simd comparisons for the wasm target

3 years agoRollup merge of #83895 - eggyal:issue-83883, r=jyn514
Dylan DPC [Tue, 6 Apr 2021 15:42:31 +0000 (17:42 +0200)]
Rollup merge of #83895 - eggyal:issue-83883, r=jyn514

Add listing of lints (eg via `-W help`) to rustdoc

Fixes #83883

r? `@jyn514`

3 years agoRollup merge of #83829 - petrochenkov:minclean, r=nagisa
Dylan DPC [Tue, 6 Apr 2021 15:42:29 +0000 (17:42 +0200)]
Rollup merge of #83829 - petrochenkov:minclean, r=nagisa

rustc_target: Rely on defaults more in target specs

3 years agoRollup merge of #82963 - camelid:move-sharedcontext, r=GuillaumeGomez
Dylan DPC [Tue, 6 Apr 2021 15:42:28 +0000 (17:42 +0200)]
Rollup merge of #82963 - camelid:move-sharedcontext, r=GuillaumeGomez

Move `SharedContext` to `context.rs`

It is tightly connected to `Context` and is primarily used as a field in
`Context`. Thus, it should be next to `Context`.

3 years agoAuto merge of #83875 - jyn514:diag_info, r=bugadani
bors [Tue, 6 Apr 2021 15:37:29 +0000 (15:37 +0000)]
Auto merge of #83875 - jyn514:diag_info, r=bugadani

rustdoc: Use DiagnosticInfo in more parts of intra-doc links

This makes the code a lot less verbose.

This is separated into lots of tiny commits because it was easier for me that way, but the overall diff isn't that big if you want to read it at once.

r? `@bugadani`

3 years agoAuto merge of #6931 - Jarcho:needless_borrow, r=phansch,flip1995
bors [Tue, 6 Apr 2021 15:30:48 +0000 (15:30 +0000)]
Auto merge of #6931 - Jarcho:needless_borrow, r=phansch,flip1995

Fix all occurences `needless_borrow` internally

The bug that got 'needless_borrow' moved into the nursery was fixed two years ago in d4370f8b.

This did trigger over a thousand times internally, so that's all the other changes. I vetted most of them, but there's a lot The only interesting change is to the lint list. `declare_tool_lint` already makes a reference, so there's no need to take a reference to the lints.

changelog: None

3 years agoforbid `impl Trait` in generic param defaults
SNCPlay42 [Tue, 6 Apr 2021 15:21:08 +0000 (16:21 +0100)]
forbid `impl Trait` in generic param defaults

3 years agouse a `SmallVec` in `impl_or_trait_item`
lcnr [Tue, 6 Apr 2021 15:06:44 +0000 (17:06 +0200)]
use a `SmallVec` in `impl_or_trait_item`

3 years agoFix all occurences of `needless_borrow` internally
Jason Newcomb [Fri, 2 Apr 2021 21:35:32 +0000 (17:35 -0400)]
Fix all occurences of `needless_borrow` internally

3 years agoAuto merge of #7036 - horacimacias:master, r=giraffate
bors [Tue, 6 Apr 2021 13:38:08 +0000 (13:38 +0000)]
Auto merge of #7036 - horacimacias:master, r=giraffate

consider mutability on useless_vec suggestions

fixes #7035

changelog: Now the suggested by `useless_vec` considers mutability to suggest either `&[]`, as before, or `&mut []` if the used reference is mutable.

3 years agoAuto merge of #83922 - RalfJung:miri, r=RalfJung
bors [Tue, 6 Apr 2021 12:20:48 +0000 (12:20 +0000)]
Auto merge of #83922 - RalfJung:miri, r=RalfJung

update Miri

Also updates the lockfile, since Miri updated some dependencies.
Cc `@rust-lang/miri` r? `@ghost`

3 years agoUse AnonConst for asm! constants
Amanieu d'Antras [Tue, 6 Apr 2021 04:50:55 +0000 (05:50 +0100)]
Use AnonConst for asm! constants

3 years agoUse AnonConst for asm! constants
Amanieu d'Antras [Tue, 6 Apr 2021 04:50:55 +0000 (05:50 +0100)]
Use AnonConst for asm! constants

3 years agoupdate Miri
Ralf Jung [Tue, 6 Apr 2021 11:20:48 +0000 (13:20 +0200)]
update Miri

3 years agoAuto merge of #83821 - camelid:improve-thinvec, r=petrochenkov
bors [Tue, 6 Apr 2021 09:57:12 +0000 (09:57 +0000)]
Auto merge of #83821 - camelid:improve-thinvec, r=petrochenkov

Add `FromIterator` and `IntoIterator` impls for `ThinVec`

These should make using `ThinVec` feel much more like using `Vec`.
They will allow users of `Vec` to switch to `ThinVec` while continuing
to use `collect()`, `for` loops, and other parts of the iterator API.

I don't know if there were use cases before for using the iterator API
with `ThinVec`, but I would like to start using `ThinVec` in rustdoc,
and having it conform to the iterator API would make the transition
*a lot* easier.

I added a `FromIterator` impl, an `IntoIterator` impl that yields owned
elements, and `IntoIterator` impls that yield immutable or mutable
references to elements. I also added some unit tests for `ThinVec`.

3 years agoFix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0
ortem [Tue, 6 Apr 2021 09:23:28 +0000 (12:23 +0300)]
Fix HashMap/HashSet LLDB pretty-printer after hashbrown 0.11.0

The pretty-printer was broken in https://github.com/rust-lang/rust/pull/77566
after updating hashbrown to 0.11.0.
Note that the corresponding GDB pretty-printer was updated properly.

3 years agoconsider mutability on useless_vec suggestions
Horaci Macias [Mon, 5 Apr 2021 11:27:39 +0000 (13:27 +0200)]
consider mutability on useless_vec suggestions
https://github.com/rust-lang/rust-clippy/issues/7035

3 years agoAdd listing of lints (eg via -W help) to rustdoc
Alan Egerton [Tue, 6 Apr 2021 01:09:43 +0000 (02:09 +0100)]
Add listing of lints (eg via -W help) to rustdoc

3 years agoAuto merge of #81641 - bjorn3:find_codegen_backend, r=davidtwco
bors [Tue, 6 Apr 2021 07:16:19 +0000 (07:16 +0000)]
Auto merge of #81641 - bjorn3:find_codegen_backend, r=davidtwco

Find codegen backends in more locations

* Search in the sysroot passed using `--sysroot` in addition to the default sysroot.
* Search for `librustc_codegen_$name.so` in addition to `librustc_codegen_$name-$release.so`.

This combined would allow putting `librustc_codegen_cranelift.so` in the right location of a sysroot passed using `--sysroot`.

3 years agoAuto merge of #81234 - repnop:fn-alignment, r=lcnr
bors [Tue, 6 Apr 2021 04:35:26 +0000 (04:35 +0000)]
Auto merge of #81234 - repnop:fn-alignment, r=lcnr

Allow specifying alignment for functions

Fixes #75072

This allows the user to specify alignment for functions, which can be useful for low level work where functions need to necessarily be aligned to a specific value.

I believe the error cases not covered in the match are caught earlier based on my testing so I had them just return `None`.

3 years agoMove `SharedContext` to `context.rs`
Camelid [Fri, 2 Apr 2021 19:08:28 +0000 (12:08 -0700)]
Move `SharedContext` to `context.rs`

It is tightly connected to `Context` and is primarily used as a field in
`Context`. Thus, it should be next to `Context`.

3 years agoAdd `FromIterator` and `IntoIterator` impls for `ThinVec`
Camelid [Sat, 3 Apr 2021 02:56:18 +0000 (19:56 -0700)]
Add `FromIterator` and `IntoIterator` impls for `ThinVec`

These should make using `ThinVec` feel much more like using `Vec`.
They will allow users of `Vec` to switch to `ThinVec` while continuing
to use `collect()`, `for` loops, and other parts of the iterator API.

I don't know if there were use cases before for using the iterator API
with `ThinVec`, but I would like to start using `ThinVec` in rustdoc,
and having it conform to the iterator API would make the transition
*a lot* easier.

I added a `FromIterator` impl, an `IntoIterator` impl that yields owned
elements, and `IntoIterator` impls that yield immutable or mutable
references to elements. I also added some unit tests for `ThinVec`.

3 years agoAuto merge of #83592 - nagisa:nagisa/dso_local, r=davidtwco
bors [Tue, 6 Apr 2021 02:09:01 +0000 (02:09 +0000)]
Auto merge of #83592 - nagisa:nagisa/dso_local, r=davidtwco

Set dso_local for hidden, private and local items

This should probably have no real effect in most cases, as e.g. `hidden`
visibility already implies `dso_local` (or at least LLVM IR does not
preserve the `dso_local` setting if the item is already `hidden`), but
it should fix `-Crelocation-model=static` and improve codegen in
executables.

Note that this PR does not exhaustively port the logic in [clang], only the
portion that is necessary to fix a regression from LLVM 12 that relates to
`-Crelocation_model=static`.

Fixes #83335

[clang]: https://github.com/llvm/llvm-project/blob/3001d080c813da20b329303bf8f45451480e5905/clang/lib/CodeGen/CodeGenModule.cpp#L945-L1039

3 years agoUpdate cargo
Eric Huss [Tue, 6 Apr 2021 00:10:04 +0000 (17:10 -0700)]
Update cargo

3 years agoAuto merge of #83905 - JohnTitor:rollup-pa1la80, r=JohnTitor
bors [Mon, 5 Apr 2021 23:40:18 +0000 (23:40 +0000)]
Auto merge of #83905 - JohnTitor:rollup-pa1la80, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #83370 (Add `x.py setup tools` which enables `download-rustc` by default)
 - #83489 (Properly suggest deref in else block)
 - #83734 (Catch a bad placeholder type error for statics in `extern`s)
 - #83814 (expand: Do not ICE when a legacy AST-based macro attribute produces and empty expression)
 - #83835 (rustdoc: sort search index items for compression)
 - #83849 (rustdoc: Cleanup handling of associated items for intra-doc links)
 - #83881 (:arrow_up: rust-analyzer)
 - #83885 (Document compiler/ with -Aprivate-intra-doc-links)

Failed merges:

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

3 years agoAuto merge of #7018 - Y-Nak:same_item_push, r=Manishearth
bors [Mon, 5 Apr 2021 22:57:33 +0000 (22:57 +0000)]
Auto merge of #7018 - Y-Nak:same_item_push, r=Manishearth

Don't trigger `same_item_push` if the vec is used in the loop body

fixes #6987
changelog: `same_item_push`: Don't trigger if the `vec` is used in the loop body

3 years agoAllow specifying alignment for functions
Wesley Norris [Thu, 21 Jan 2021 02:49:04 +0000 (21:49 -0500)]
Allow specifying alignment for functions

3 years agoRollup merge of #83885 - jyn514:private-links, r=Mark-Simulacrum
Yuki Okushi [Mon, 5 Apr 2021 21:24:17 +0000 (06:24 +0900)]
Rollup merge of #83885 - jyn514:private-links, r=Mark-Simulacrum

Document compiler/ with -Aprivate-intra-doc-links

Since compiler/ always passes --document-private-items, it's ok to link to items that are private.

3 years agoRollup merge of #83881 - lnicola:rust-analyzer-2021-04-05, r=jonas-schievink
Yuki Okushi [Mon, 5 Apr 2021 21:24:16 +0000 (06:24 +0900)]
Rollup merge of #83881 - lnicola:rust-analyzer-2021-04-05, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #83849 - jyn514:intra-doc-cleanup, r=bugadani
Yuki Okushi [Mon, 5 Apr 2021 21:24:15 +0000 (06:24 +0900)]
Rollup merge of #83849 - jyn514:intra-doc-cleanup, r=bugadani

rustdoc: Cleanup handling of associated items for intra-doc links

Helps with https://github.com/rust-lang/rust/issues/83761 (right now the uses of the resolver are all intermingled with uses of the tyctxt). Best reviewed one commit at a time.

r? ```@bugadani``` maybe? Feel free to reassign :)

3 years agoRollup merge of #83835 - notriddle:sort-index, r=ollie27
Yuki Okushi [Mon, 5 Apr 2021 21:24:13 +0000 (06:24 +0900)]
Rollup merge of #83835 - notriddle:sort-index, r=ollie27

rustdoc: sort search index items for compression

This should not affect the appearance of the docs pages themselves.

This makes the pre-compressed search index smaller, thanks to the
empty-string path duplication format, and also the gzipped version,
by giving the algorithm more structure to work with.

    rust$ wc -c search-index-old.js search-index-new.js
    2628334 search-index-old.js
    2586181 search-index-new.js
    5214515 total
    rust$ gzip search-index-*
    rust$ wc -c search-index-old.js.gz search-index-new.js.gz
    239486 search-index-old.js.gz
    237386 search-index-new.js.gz
    476872 total