]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoContinue String to Symbol conversion in rustdoc
Guillaume Gomez [Thu, 17 Dec 2020 13:02:09 +0000 (14:02 +0100)]
Continue String to Symbol conversion in rustdoc

3 years agoAuto merge of #80091 - GuillaumeGomez:str-to-symbol, r=jyn514
bors [Thu, 17 Dec 2020 06:00:12 +0000 (06:00 +0000)]
Auto merge of #80091 - GuillaumeGomez:str-to-symbol, r=jyn514

Replace String with Symbol where possible

The same as #80047 but on different types. Might be interesting to run some perf comparison.

r? `@jyn514`

3 years agoAuto merge of #80105 - JohnTitor:rollup-8c030u5, r=JohnTitor
bors [Thu, 17 Dec 2020 03:07:09 +0000 (03:07 +0000)]
Auto merge of #80105 - JohnTitor:rollup-8c030u5, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #79051 (Implement if-let match guards)
 - #79877 (Allow `since="TBD"` for rustc_deprecated)
 - #79882 (Fix issue #78496)
 - #80026 (expand-yaml-anchors: Make the output directory separator-insensitive)
 - #80039 (Remove unused `TyEncoder::tcx` required method)
 - #80069 (Test that `core::assert!` is valid)
 - #80072 (Fixed conflict with drop elaboration and coverage)
 - #80073 (Add support for target aliases)
 - #80082 (Revert #78790 - rust-src vendoring)
 - #80097 (Add `popcount` and `popcnt` as doc aliases for `count_ones` methods.)
 - #80103 (Remove docs for non-existent parameters in `rustc_expand`)

Failed merges:

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

3 years agoRollup merge of #80103 - camelid:remove-docs-old-params-rustc_expand, r=jyn514
Yuki Okushi [Thu, 17 Dec 2020 02:44:13 +0000 (11:44 +0900)]
Rollup merge of #80103 - camelid:remove-docs-old-params-rustc_expand, r=jyn514

Remove docs for non-existent parameters in `rustc_expand`

3 years agoRollup merge of #80097 - SimonSapin:popcount, r=m-ou-se
Yuki Okushi [Thu, 17 Dec 2020 02:44:12 +0000 (11:44 +0900)]
Rollup merge of #80097 - SimonSapin:popcount, r=m-ou-se

Add `popcount` and `popcnt` as doc aliases for `count_ones` methods.

Integer types have a `count_ones` method that end up calling `intrinsics::ctpop`. On some architectures, that intrinsic is translated as a corresponding CPU instruction know as "popcount" or "popcnt".

This PR makes it so that searching for those names in rustdoc shows those methods.

CC https://blog.rust-lang.org/2020/11/19/Rust-1.48.html#adding-search-aliases

3 years agoRollup merge of #80082 - ehuss:revert-rust-src-vendor, r=Mark-Simulacrum
Yuki Okushi [Thu, 17 Dec 2020 02:44:10 +0000 (11:44 +0900)]
Rollup merge of #80082 - ehuss:revert-rust-src-vendor, r=Mark-Simulacrum

Revert #78790 - rust-src vendoring

This reverts the rust-src vendor changes from #78790. There were a few issues (see #79218, https://github.com/rust-lang/cargo/issues/8962, https://github.com/rust-lang/cargo/issues/8963), that I don't think will get fixed in the next few days before the beta branch.

Fixes #79218

3 years agoRollup merge of #80073 - kulikjak:add-target-alias-support, r=varkor
Yuki Okushi [Thu, 17 Dec 2020 02:44:08 +0000 (11:44 +0900)]
Rollup merge of #80073 - kulikjak:add-target-alias-support, r=varkor

Add support for target aliases

Closes #68214, see that for more info.

`@varkor`

3 years agoRollup merge of #80072 - richkadel:llvm-coverage-counters-2.2.1, r=tmandry
Yuki Okushi [Thu, 17 Dec 2020 02:44:06 +0000 (11:44 +0900)]
Rollup merge of #80072 - richkadel:llvm-coverage-counters-2.2.1, r=tmandry

Fixed conflict with drop elaboration and coverage

See
https://github.com/rust-lang/rust/issues/80045#issuecomment-745733339

Coverage statements are moved to the beginning of the BCB. This does
also affect what's counted before a panic, changing some results, but I
think these results may even be preferred? In any case, there are no
guarantees about what's counted when a panic occurs (by design).

r? `@tmandry`

FYI `@wesleywiser` `@ecstatic-morse`

3 years agoRollup merge of #80069 - jyn514:core-assert, r=dtolnay
Yuki Okushi [Thu, 17 Dec 2020 02:44:05 +0000 (11:44 +0900)]
Rollup merge of #80069 - jyn514:core-assert, r=dtolnay

Test that `core::assert!` is valid

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

r? `@dtolnay`

3 years agoRollup merge of #80039 - LeSeulArtichaut:rm-tyencoder-tcx, r=matthewjasper
Yuki Okushi [Thu, 17 Dec 2020 02:44:03 +0000 (11:44 +0900)]
Rollup merge of #80039 - LeSeulArtichaut:rm-tyencoder-tcx, r=matthewjasper

Remove unused `TyEncoder::tcx` required method

Unsure if this is helpful or not...

r? ``@ghost`` cc ``@matthewjasper`` ``@jackh726``

3 years agoRollup merge of #80026 - JohnTitor:separator-insensitive, r=Mark-Simulacrum
Yuki Okushi [Thu, 17 Dec 2020 02:44:01 +0000 (11:44 +0900)]
Rollup merge of #80026 - JohnTitor:separator-insensitive, r=Mark-Simulacrum

expand-yaml-anchors: Make the output directory separator-insensitive

Fixes #75709

3 years agoRollup merge of #79882 - wecing:master, r=oli-obk
Yuki Okushi [Thu, 17 Dec 2020 02:43:59 +0000 (11:43 +0900)]
Rollup merge of #79882 - wecing:master, r=oli-obk

Fix issue #78496

EarlyOtherwiseBranch finds MIR structures like:

```
bb0: {
  ...
  _2 = discriminant(X)
  ...
  switchInt(_2) -> [1_isize: bb1, otherwise: bb3]
}
bb1: {
  ...
  _3 = discriminant(Y)
  ...
  switchInt(_3) -> [1_isize: bb2, otherwise: bb3]
}
bb2: {...}
bb3: {...}
```

And transforms them into something like:

```
bb0: {
  ...
  _2 = discriminant(X)
  _3 = discriminant(Y)
  _4 = Eq(_2, _3)
  switchInt(_4) -> [true: bb4, otherwise: bb3]
}
bb2: {...} // unchanged
bb3: {...} // unchanged
bb4: {
  switchInt(_2) -> [1_isize: bb2, otherwise: bb3]
}
```

But that is not always a safe thing to do -- sometimes the early `otherwise` branch is necessary so the later block could assume the value of `discriminant(X)`.

I am not totally sure what's the best way to detect that, but fixing #78496 should be easy -- we just check if `X` is a sub-expression of `Y`. A more precise test might be to check if `Y` contains a `Downcast(1)` of `X`, but I think this might be good enough.

Fix #78496

3 years agoRollup merge of #79877 - bstrie:depinfut, r=oli-obk
Yuki Okushi [Thu, 17 Dec 2020 02:43:57 +0000 (11:43 +0900)]
Rollup merge of #79877 - bstrie:depinfut, r=oli-obk

Allow `since="TBD"` for rustc_deprecated

Closes #78381.

This PR only affects `#[rustc_deprecated]`, not `#[deprecated]`, so there is no effect on any stable language feature.

Likewise this PR only implements `since="TBD"`, it does not actually tag any library functions with it, so there is no effect on any stable API.

Overview of changes:

* `rustc_middle/stability.rs`:
    * change `deprecation_in_effect` function to return `false` when `since="TBD"`
    * tidy up the compiler output when a deprecated item has `since="TBD"`
* `rustc_passes/stability.rs`:
    * allow `since="TBD"` to pass the sanity check for stable_version < deprecated_version
    * refactor the "invalid stability version" and "invalid deprecation version" error into separate errors
* rustdoc: make `since="TBD"` message on a deprecated item's page match the command-line deprecation output
* tests:
    * test rustdoc output
    * test that the `deprecated_in_future` lint fires when `since="TBD"`
    * test the new "invalid deprecation version" error message

3 years agoRollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasper
Yuki Okushi [Thu, 17 Dec 2020 02:43:55 +0000 (11:43 +0900)]
Rollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasper

Implement if-let match guards

Implements rust-lang/rfcs#2294 (tracking issue: #51114).

I probably should do a few more things before this can be merged:
- [x] Add tests (added basic tests, more advanced tests could be done in the future?)
- [x] Add lint for exhaustive if-let guard (comparable to normal if-let statements)
- [x] Fix clippy

However since this is a nightly feature maybe it's fine to land this and do those steps in follow-up PRs.

Thanks a lot `@matthewjasper` :heart: for helping me with lowering to MIR! Would you be interested in reviewing this?
r? `@ghost` for now

3 years agoRemove docs for non-existent parameters in `rustc_expand`
Camelid [Thu, 17 Dec 2020 01:34:47 +0000 (17:34 -0800)]
Remove docs for non-existent parameters in `rustc_expand`

3 years agoAuto merge of #79790 - LeSeulArtichaut:issue-79683, r=lcnr
bors [Thu, 17 Dec 2020 00:15:45 +0000 (00:15 +0000)]
Auto merge of #79790 - LeSeulArtichaut:issue-79683, r=lcnr

Take into account negative impls in "trait item not found" suggestions

This removes the suggestion to implement a trait for a type when that type already has a negative implementation for the trait, and replaces it with a note to point out that the trait is explicitely unimplemented, as suggested by `@scottmcm.`

Helps with #79683.

r? `@scottmcm` do you want to review this?

3 years agoAdd `popcount` and `popcnt` as doc aliases for `count_ones` methods.
Simon Sapin [Wed, 16 Dec 2020 22:51:18 +0000 (23:51 +0100)]
Add `popcount` and `popcnt` as doc aliases for `count_ones` methods.

Integer types have a `count_ones` method that end up calling
`intrinsics::ctpop`.
On some architectures, that intrinsic is translated as a corresponding
CPU instruction know as "popcount" or "popcnt".

This PR makes it so that searching for those names in rustdoc shows those methods.

CC https://blog.rust-lang.org/2020/11/19/Rust-1.48.html#adding-search-aliases

3 years agoReplace String with Symbol where possible
Guillaume Gomez [Wed, 16 Dec 2020 16:21:08 +0000 (17:21 +0100)]
Replace String with Symbol where possible

3 years agoAuto merge of #80087 - davidtwco:issue-80086-llvm-dwp-in-ci-llvm, r=Mark-Simulacrum
bors [Wed, 16 Dec 2020 19:36:22 +0000 (19:36 +0000)]
Auto merge of #80087 - davidtwco:issue-80086-llvm-dwp-in-ci-llvm, r=Mark-Simulacrum

bootstrap: include llvm-dwp in CI LLVM

Fixes #80086.

This PR includes the `llvm-dwp` tool in the CI LLVM (which rustc developers can download instead of building LLVM locally) - `llvm-dwp` is required by Split DWARF which landed in PR #77117.

r? `@Mark-Simulacrum`

3 years agobootstrap: include llvm-dwp in CI LLVM
David Wood [Wed, 16 Dec 2020 19:16:36 +0000 (19:16 +0000)]
bootstrap: include llvm-dwp in CI LLVM

This commit includes the `llvm-dwp` tool in the CI LLVM (which rustc
developers can download instead of building LLVM locally) - `llvm-dwp`
is required by Split DWARF which landed in PR #77117.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAllow `since="TBD"` for rustc_deprecated
bstrie [Wed, 9 Dec 2020 23:26:42 +0000 (18:26 -0500)]
Allow `since="TBD"` for rustc_deprecated

3 years agoRevert "Auto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum"
Eric Huss [Wed, 16 Dec 2020 17:10:40 +0000 (09:10 -0800)]
Revert "Auto merge of #78790 - Gankra:rust-src-vendor, r=Mark-Simulacrum"

This reverts commit 7afc5172305cdae588a0318ce545749cf4ed947d, reversing
changes made to d4ea0b3e46a0303d5802b632e88ba1ba84d9d16f.

3 years agoTake into account negative impls in "trait item not found" suggestions
LeSeulArtichaut [Mon, 7 Dec 2020 11:34:27 +0000 (12:34 +0100)]
Take into account negative impls in "trait item not found" suggestions

3 years agoAuto merge of #77117 - davidtwco:issue-34651-split-dwarf, r=nagisa
bors [Wed, 16 Dec 2020 12:51:42 +0000 (12:51 +0000)]
Auto merge of #77117 - davidtwco:issue-34651-split-dwarf, r=nagisa

cg_llvm: split dwarf support

cc #34651

This PR adds initial support for Split DWARF to rustc, based on the implementation in Clang.

##### Current Status
This PR currently has functioning split-dwarf, running rustc with `-Zsplit-dwarf=split` when compiling a binary will produce a `dwp` alongside the binary, which contains the linked dwarf objects.

```shell-session
$ rustc -Cdebuginfo=2 -Zsplit-dwarf=split -C save-temps ./foo.rs
$ ls foo*
foo
foo.belfx9afw9cmv8.rcgu.dwo
foo.belfx9afw9cmv8.rcgu.o
foo.foo.7rcbfp3g-cgu.0.rcgu.dwo
foo.foo.7rcbfp3g-cgu.0.rcgu.o
foo.foo.7rcbfp3g-cgu.1.rcgu.dwo
foo.foo.7rcbfp3g-cgu.1.rcgu.o
foo.foo.7rcbfp3g-cgu.2.rcgu.dwo
foo.foo.7rcbfp3g-cgu.2.rcgu.o
foo.foo.7rcbfp3g-cgu.3.rcgu.dwo
foo.foo.7rcbfp3g-cgu.3.rcgu.o
foo.foo.7rcbfp3g-cgu.4.rcgu.dwo
foo.foo.7rcbfp3g-cgu.4.rcgu.o
foo.foo.7rcbfp3g-cgu.5.rcgu.dwo
foo.foo.7rcbfp3g-cgu.5.rcgu.o
foo.foo.7rcbfp3g-cgu.6.rcgu.dwo
foo.foo.7rcbfp3g-cgu.6.rcgu.o
foo.foo.7rcbfp3g-cgu.7.rcgu.dwo
foo.foo.7rcbfp3g-cgu.7.rcgu.o
foo.dwp
foo.rs
$ readelf -wi foo.foo.7rcbfp3g-cgu.0.rcgu.o
# ...
  Compilation Unit @ offset 0x90:
   Length:        0x2c (32-bit)
   Version:       4
   Abbrev Offset: 0x5b
   Pointer Size:  8
 <0><9b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <9c>   DW_AT_stmt_list   : 0xe8
    <a0>   DW_AT_comp_dir    : (indirect string, offset: 0x13b): /home/david/Projects/rust/rust0
    <a4>   DW_AT_GNU_dwo_name: (indirect string, offset: 0x15b): foo.foo.7rcbfp3g-cgu.0.rcgu.dwo
    <a8>   DW_AT_GNU_dwo_id  : 0x357472a2b032d7b9
    <b0>   DW_AT_low_pc      : 0x0
    <b8>   DW_AT_ranges      : 0x40
    <bc>   DW_AT_GNU_addr_base: 0x0
# ...
```

##### To-Do
I've opened this PR as a draft to get feedback and work out how we'd expect rustc to work when Split DWARF is requested. It might be easier to read the PR commit-by-commit.

- [ ] Add error when Split DWARF is requested on platforms where it doesn't make sense.
- [x] Determine whether or not there should be a single `dwo` output from rustc, or one per codegen-unit as exists currently.
- [x] Add tests.
- [x] Fix `single` mode - currently single mode doesn't change the invocation of `addPassesToEmitFile`, which is correct, but it also needs to change the split dwarf path provided to `createCompileUnit` and `createTargetMachine` so that it's just the final binary (currently it is still a non-existent `dwo` file).

r? `@nagisa`
cc `@michaelwoerister` `@eddyb` `@alexcrichton` `@rust-lang/wg-incr-comp`

3 years agocg_llvm: split dwarf filename and comp dir
David Wood [Sun, 8 Nov 2020 17:17:37 +0000 (17:17 +0000)]
cg_llvm: split dwarf filename and comp dir

llvm-dwp concatenates `DW_AT_comp_dir` with `DW_AT_GNU_dwo_name` (only
when `DW_AT_comp_dir` exists), which can result in it failing to find
the DWARF object files.

In earlier testing, `DW_AT_comp_dir` wasn't present in the final
object and the current directory was the output directory.

When running tests through compiletest, the working directory of the
compilation is different from output directory and that resulted in
`DW_AT_comp_dir` being in the object file (and set to the current
working directory, rather than the output directory), and
`DW_AT_GNU_dwo_name` being set to the full path (rather than just
the filename), so llvm-dwp was failing.

This commit changes the compilation directory provided to LLVM to match
the output directory, where DWARF objects are output; and ensures that
only the filename is used for `DW_AT_GNU_dwo_name`.

Signed-off-by: David Wood <david@davidtw.co>
3 years agocompiletest: add split dwarf compare mode
David Wood [Sun, 8 Nov 2020 17:27:33 +0000 (17:27 +0000)]
compiletest: add split dwarf compare mode

This commit adds a Split DWARF compare mode to compiletest so that
debuginfo tests are also tested using Split DWARF in split mode (and
manually in single mode).

Signed-off-by: David Wood <david@davidtw.co>
3 years agotests: add run-make-fulldeps split-dwarf test
David Wood [Sun, 8 Nov 2020 17:26:59 +0000 (17:26 +0000)]
tests: add run-make-fulldeps split-dwarf test

This commit adds a run-make-fulldeps test which checks that a DWARF
package file is emitted.

Signed-off-by: David Wood <david@davidtw.co>
3 years agocg_clif: fix build with split dwarf
David Wood [Sun, 8 Nov 2020 14:01:23 +0000 (14:01 +0000)]
cg_clif: fix build with split dwarf

This commit makes minor changes to the cranelift backend so that it can
build given changes in cg_ssa for Split DWARF.

Signed-off-by: David Wood <david@davidtw.co>
3 years agocg_llvm: implement split dwarf support
David Wood [Wed, 23 Sep 2020 16:33:54 +0000 (17:33 +0100)]
cg_llvm: implement split dwarf support

This commit implements Split DWARF support, wiring up the flag (added in
earlier commits) to the modified FFI wrapper (also from earlier
commits).

Signed-off-by: David Wood <david@davidtw.co>
3 years agobootstrap: copy `llvm-dwp` to sysroot
David Wood [Wed, 14 Oct 2020 17:16:05 +0000 (18:16 +0100)]
bootstrap: copy `llvm-dwp` to sysroot

`llvm-dwp` is required for linking the DWARF objects into DWARF packages
when using Split DWARF, especially given that rustc produces multiple
DWARF objects (one for each codegen unit).

Signed-off-by: David Wood <david@davidtw.co>
3 years agocg_ssa: introduce `TargetMachineFactoryFn` alias
David Wood [Wed, 23 Sep 2020 15:57:50 +0000 (16:57 +0100)]
cg_ssa: introduce `TargetMachineFactoryFn` alias

This commit removes the `TargetMachineFactory` struct and adds a
`TargetMachineFactoryFn` type alias which is used everywhere that the
previous, long type was used.

Signed-off-by: David Wood <david@davidtw.co>
3 years agocg_ssa: correct documentation comments
David Wood [Wed, 14 Oct 2020 14:52:16 +0000 (15:52 +0100)]
cg_ssa: correct documentation comments

This commit changes some comments to documentation comments so that
they can be read on the generated rustdoc.

Signed-off-by: David Wood <david@davidtw.co>
3 years agosession: add `split-dwarf` flag
David Wood [Wed, 23 Sep 2020 15:50:58 +0000 (16:50 +0100)]
session: add `split-dwarf` flag

This commit adds a flag for Split DWARF, which enables debuginfo to be
split into multiple files.

Signed-off-by: David Wood <david@davidtw.co>
3 years agollvm: update ffi bindings for split dwarf
David Wood [Wed, 23 Sep 2020 15:25:20 +0000 (16:25 +0100)]
llvm: update ffi bindings for split dwarf

This commit modifies the FFI bindings to LLVM required for Split DWARF
support in rustc. In particular:

- `addPassesToEmitFile`'s wrapper, `LLVMRustWriteOutputFile` now takes
  a `DwoPath` `const char*`. When disabled, `nullptr` should be provided
  which will preserve existing behaviour. When enabled, the path to the
  `.dwo` file should be provided.
- `createCompileUnit`'s wrapper, `LLVMRustDIBuilderCreateCompileUnit`
  now has two additional arguments, for the `DWOId` and to enable
  `SplitDebugInlining`. `DWOId` should always be zero.
- `createTargetMachine`'s wrapper, `LLVMRustCreateTargetMachine` has an
  additional argument which should be provided the path to the `.dwo`
  when enabled.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAdd support for target aliases
Jakub Kulik [Wed, 16 Dec 2020 09:41:07 +0000 (10:41 +0100)]
Add support for target aliases

3 years agoAuto merge of #79682 - jyn514:no-blanket-impls, r=Manishearth,GuillaumeGomez
bors [Wed, 16 Dec 2020 09:13:14 +0000 (09:13 +0000)]
Auto merge of #79682 - jyn514:no-blanket-impls, r=Manishearth,GuillaumeGomez

Don't look for blanket impls in intra-doc links

This never worked and has been causing severe performance problems.
Hopefully it will be re-landed at some point in the future when it
actually works, but in the meantime it makes no sense to have the code
around when it does nothing and actively makes rustdoc harder to use.

Closes https://github.com/rust-lang/rust/issues/78761. Does *not* affect https://github.com/rust-lang/rust/issues/78800.

r? `@Manishearth`
cc `@seeplusplus`

3 years agoFixed conflict with drop elaboration and coverage
Rich Kadel [Wed, 16 Dec 2020 07:33:47 +0000 (23:33 -0800)]
Fixed conflict with drop elaboration and coverage

See
https://github.com/rust-lang/rust/issues/80045#issuecomment-745733339

Coverage statements are moved to the beginning of the BCB. This does
also affect what's counted before a panic, changing some results, but I
think these results may even be preferred? In any case, there are no
guarantees about what's counted when a panic occurs (by design).

3 years agoAuto merge of #79607 - DrMeepster:maybe_uninit_write_slice, r=m-ou-se
bors [Wed, 16 Dec 2020 06:26:51 +0000 (06:26 +0000)]
Auto merge of #79607 - DrMeepster:maybe_uninit_write_slice, r=m-ou-se

MaybeUninit::copy/clone_from_slice

This PR adds 2 new methods to MaybeUninit under the feature of `maybe_uninit_write_slice`: `copy_from_slice` and `clone_from_slice`.

These are useful for initializing uninitialized buffers (such as the one returned by `Vec::spare_capacity_mut` for example) with initialized data.

The methods behave similarly to the methods on slices, but the destination is uninitialized and they return the destination slice as an initialized slice.

3 years agoAuto merge of #80041 - jyn514:shrink-item, r=GuillaumeGomez
bors [Wed, 16 Dec 2020 03:35:08 +0000 (03:35 +0000)]
Auto merge of #80041 - jyn514:shrink-item, r=GuillaumeGomez

Get rid of `clean::Deprecation`

This brings the size of `item.deprecation` from 56 to 16 bytes. Helps with #79103 and https://github.com/rust-lang/rust/issues/76382, in the same vein as https://github.com/rust-lang/rust/pull/79957.

r? `@GuillaumeGomez`

3 years agoTest that `core::assert!` is valid
Joshua Nelson [Wed, 16 Dec 2020 01:47:06 +0000 (20:47 -0500)]
Test that `core::assert!` is valid

3 years agoAuto merge of #78833 - CDirkx:parse_prefix, r=dtolnay
bors [Wed, 16 Dec 2020 00:47:50 +0000 (00:47 +0000)]
Auto merge of #78833 - CDirkx:parse_prefix, r=dtolnay

Refactor and fix `parse_prefix` on Windows

This PR is an extension of #78692 as well as a general refactor of `parse_prefix`:

**Fixes**:
There are two errors in the current implementation of `parse_prefix`:

Firstly, in the current implementation only `\` is recognized as a separator character in device namespace prefixes. This behavior is only correct for verbatim paths; `"\\.\C:/foo"` should be parsed as `"C:"` instead of `"C:/foo"`.

Secondly, the current implementation only handles single separator characters. In non-verbatim paths a series of separator characters should be recognized as a single boundary, e.g. the UNC path `"\\localhost\\\\\\C$\foo"` should be parsed as `"\\localhost\\\\\\C$"` and then `UNC(server: "localhost", share: "C$")`, but currently it is not parsed at all, because it starts being parsed as `\\localhost\` and then has an invalid empty share location.

Paths like `"\\.\C:/foo"` and `"\\localhost\\\\\\C$\foo"` are valid on Windows, they are equivalent to just `"C:\foo"`.

**Refactoring**:
All uses of `&[u8]` within `parse_prefix` are extracted to helper functions and`&OsStr` is used instead. This reduces the number of places unsafe is used:
- `get_first_two_components` is adapted to the more general `parse_next_component` and used in more places
- code for parsing drive prefixes is extracted to `parse_drive`

3 years agoDon't look for blanket impls in intra-doc links
Joshua Nelson [Fri, 4 Dec 2020 01:14:11 +0000 (20:14 -0500)]
Don't look for blanket impls in intra-doc links

This never worked and has been causing severe performance problems.
Hopefully it will be re-landed at some point in the future when it
actually works, but in the meantime it makes no sense to have the code
around when it does nothing and actively makes rustdoc harder to use.

3 years agoAuto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk
bors [Tue, 15 Dec 2020 22:00:02 +0000 (22:00 +0000)]
Auto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk

make MIR graphviz generation use gsgdt

gsgdt [https://crates.io/crates/gsgdt] is a crate which provides an
interface for stringly typed graphs. It also provides generation of
graphviz dot format from said graph.

This is the first in a series of PRs on moving graphviz code out of rustc into normal crates and then implementating graph diffing on top of these crates.

r? `@oli-obk`

3 years agowrite_slice(_cloned)
DrMeepster [Tue, 1 Dec 2020 06:24:04 +0000 (22:24 -0800)]
write_slice(_cloned)

3 years agoAuto merge of #80044 - jyn514:smaller-name, r=GuillaumeGomez
bors [Tue, 15 Dec 2020 18:40:50 +0000 (18:40 +0000)]
Auto merge of #80044 - jyn514:smaller-name, r=GuillaumeGomez

[rustdoc] Switch to Symbol for item.name

This decreases the size of `Item` from 680 to 616 bytes. It also does a
lot less work since it no longer has to copy as much.

Helps with #79103.

r? `@GuillaumeGomez`

3 years agoAuto merge of #80055 - GuillaumeGomez:rollup-p09mweg, r=GuillaumeGomez
bors [Tue, 15 Dec 2020 15:58:46 +0000 (15:58 +0000)]
Auto merge of #80055 - GuillaumeGomez:rollup-p09mweg, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #79379 (Show hidden elements by default when JS is disabled)
 - #79796 (Hide associated constants too when collapsing implementation)
 - #79958 (Fixes reported bugs in Rust Coverage)
 - #80008 (Fix `cargo-binutils` link)
 - #80016 (Use imports instead of rewriting the type signature of `RustcOptGroup::stable`)
 - #80025 (Replace some `println!` with `tidy_error!` to simplify)

Failed merges:

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

3 years agoRollup merge of #80025 - JohnTitor:tidy-error, r=Mark-Simulacrum
Guillaume Gomez [Tue, 15 Dec 2020 15:43:28 +0000 (16:43 +0100)]
Rollup merge of #80025 - JohnTitor:tidy-error, r=Mark-Simulacrum

Replace some `println!` with `tidy_error!` to simplify

3 years agoRollup merge of #80016 - jyn514:imports, r=GuillaumeGomez
Guillaume Gomez [Tue, 15 Dec 2020 15:43:26 +0000 (16:43 +0100)]
Rollup merge of #80016 - jyn514:imports, r=GuillaumeGomez

Use imports instead of rewriting the type signature of `RustcOptGroup::stable`

This was an adventure; see https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/'higher.20ranked.20subtype.20error'

r? `@GuillaumeGomez`

3 years agoRollup merge of #80008 - EFanZh:patch-1, r=GuillaumeGomez
Guillaume Gomez [Tue, 15 Dec 2020 15:43:24 +0000 (16:43 +0100)]
Rollup merge of #80008 - EFanZh:patch-1, r=GuillaumeGomez

Fix `cargo-binutils` link

3 years agoRollup merge of #79958 - richkadel:llvm-coverage-counters-2.2.0, r=tmandry
Guillaume Gomez [Tue, 15 Dec 2020 15:43:23 +0000 (16:43 +0100)]
Rollup merge of #79958 - richkadel:llvm-coverage-counters-2.2.0, r=tmandry

Fixes reported bugs in Rust Coverage

Fixes: #79569
Fixes: #79566
Fixes: #79565
For the first issue (#79569), I got hit a `debug_assert!()` before
encountering the reported error message (because I have `debug = true`
enabled in my config.toml).

The assertion showed me that some `SwitchInt`s can have more than one
target pointing to the same `BasicBlock`.

I had thought that was invalid, but since it seems to be possible, I'm
allowing this now.

I added a new test for this.

----

In the last two cases above, both tests (intentionally) fail to compile,
but the `InstrumentCoverage` pass is invoked anyway.

The MIR starts with an `Unreachable` `BasicBlock`, which I hadn't
encountered before. (I had assumed the `InstrumentCoverage` pass
would only be invoked with MIRs from successful compilations.)

I don't have test infrastructure set up to test coverage on files that
fail to compile, so I didn't add a new test.

r? `@tmandry`
FYI: `@wesleywiser`

3 years agoRollup merge of #79796 - GuillaumeGomez:hide-associated-const-when-collapsing, r...
Guillaume Gomez [Tue, 15 Dec 2020 15:43:21 +0000 (16:43 +0100)]
Rollup merge of #79796 - GuillaumeGomez:hide-associated-const-when-collapsing, r=jyn514

Hide associated constants too when collapsing implementation

Fixes #71849.

r? `@jyn514`

3 years agoRollup merge of #79379 - GuillaumeGomez:no-js-not-hidden, r=Nemo157
Guillaume Gomez [Tue, 15 Dec 2020 15:43:13 +0000 (16:43 +0100)]
Rollup merge of #79379 - GuillaumeGomez:no-js-not-hidden, r=Nemo157

Show hidden elements by default when JS is disabled

Fixes  #79301.

A lot of things are hidden by default which shouldn't when JS is disabled. This PR fixes it.

Before:

![Screenshot from 2020-11-24 14-10-16](https://user-images.githubusercontent.com/3050060/100099361-a16d5580-2e5f-11eb-891b-a4c005aeb1d0.png)

After:

![after](https://user-images.githubusercontent.com/3050060/100099382-a6caa000-2e5f-11eb-8190-14f330aff9a2.png)

r? `@jyn514`

3 years agoAuto merge of #78068 - RalfJung:union-safe-assign, r=nikomatsakis
bors [Tue, 15 Dec 2020 11:31:03 +0000 (11:31 +0000)]
Auto merge of #78068 - RalfJung:union-safe-assign, r=nikomatsakis

consider assignments of union field of ManuallyDrop type safe

Assigning to `Copy` union fields is safe because that assignment will never drop anything. However, with https://github.com/rust-lang/rust/pull/77547, unions may also have `ManuallyDrop` fields, and their assignments are currently still unsafe. That seems unnecessary though, as assigning `ManuallyDrop` does not drop anything either, and is thus safe even for union fields.

I assume this will at least require FCP.

3 years agoAuto merge of #73210 - wesleywiser:consts_in_debuginfo, r=oli-obk
bors [Tue, 15 Dec 2020 08:46:00 +0000 (08:46 +0000)]
Auto merge of #73210 - wesleywiser:consts_in_debuginfo, r=oli-obk

[mir-opt] Allow debuginfo to be generated for a constant or a Place

Prior to this commit, debuginfo was always generated by mapping a name
to a Place. This has the side-effect that `SimplifyLocals` cannot remove
locals that are only used for debuginfo because their other uses have
been const-propagated.

To allow these locals to be removed, we now allow debuginfo to point to
a constant value. The `ConstProp` pass detects when debuginfo points to
a local with a known constant value and replaces it with the value. This
allows the later `SimplifyLocals` pass to remove the local.

3 years agoAuto merge of #78682 - glandium:issue78471, r=lcnr
bors [Tue, 15 Dec 2020 06:32:10 +0000 (06:32 +0000)]
Auto merge of #78682 - glandium:issue78471, r=lcnr

Do not inline finish_grow

Fixes #78471.

Looking at libgkrust.a in Firefox, the sizes for the `gkrust.*.o` file is:
18584816 (text) 582418 (data) with unmodified master
17937659 (text) 582554 (data) with #72227 reverted
17968228 (text) 582858 (data) with `#[inline(never)]` on `grow_amortized` and `grow_exact`, but that has some performance consequences
17927760 (text) 582322 (data) with this change

So in terms of size, at least in the case of Firefox, this patch more than undoes the regression. I don't think it should affect performance, but we'll see.

3 years agoAuto merge of #77700 - bugadani:rustdoc-link-cache, r=jyn514
bors [Tue, 15 Dec 2020 04:06:51 +0000 (04:06 +0000)]
Auto merge of #77700 - bugadani:rustdoc-link-cache, r=jyn514

Rustdoc: Cache resolved links in current module

A step towards #77681

3 years agoSwitch to Symbol for item.name
Joshua Nelson [Tue, 15 Dec 2020 00:30:36 +0000 (19:30 -0500)]
Switch to Symbol for item.name

This decreases the size of `Item` from 680 to 616 bytes. It also does a
lot less work since it no longer has to copy as much.

3 years agoGet rid of `clean::Deprecation`
Joshua Nelson [Mon, 14 Dec 2020 23:44:59 +0000 (18:44 -0500)]
Get rid of `clean::Deprecation`

This brings the size of `item.deprecation` from 56 to 16 bytes.

3 years agoRemove unnecessary unwrap_or
Joshua Nelson [Tue, 15 Dec 2020 00:06:41 +0000 (19:06 -0500)]
Remove unnecessary unwrap_or

This was always questionable, and removing it doesn't fail any tests, so
I think this was not affecting the behavior. It dates all the way back
to the very first commit of rustdoc: 268f3f0ff5d80544ca21d565354eae6d3e29fb91

3 years agoAuto merge of #79922 - tmiasko:lower-discriminant, r=nagisa
bors [Tue, 15 Dec 2020 01:56:25 +0000 (01:56 +0000)]
Auto merge of #79922 - tmiasko:lower-discriminant, r=nagisa

Lower `discriminant_value` intrinsic

This allows const propagation to evaluate comparisons involving
field-less enums using derived implementations of `PartialEq` (after
inlining `eq`).

3 years agoConvenience funcs for `some_option.unwrap_or(...)`
Rich Kadel [Mon, 14 Dec 2020 21:12:15 +0000 (13:12 -0800)]
Convenience funcs for `some_option.unwrap_or(...)`

This ensures consistent handling of default values for options that are
None if not specified on the command line.

3 years agoDisable the constant debuginfo promotion pass by default
Wesley Wiser [Mon, 14 Dec 2020 12:35:03 +0000 (07:35 -0500)]
Disable the constant debuginfo promotion pass by default

It doesn't work correctly on *-pc-windows-gnu

3 years agoRemove unused `TyEncoder::tcx` required method
LeSeulArtichaut [Mon, 14 Dec 2020 22:33:47 +0000 (23:33 +0100)]
Remove unused `TyEncoder::tcx` required method

3 years agoAuto merge of #79938 - tmiasko:stdarch, r=Amanieu
bors [Mon, 14 Dec 2020 22:16:47 +0000 (22:16 +0000)]
Auto merge of #79938 - tmiasko:stdarch, r=Amanieu

Update stdarch submodule

Changes included:

* Use a bootstrap guard for modules with new target features
* Avoid calling intrinsics with invalid const arguments
* Avx512bw
* Avx512cd
* Add AVX512BITALG
* Add GFNI Intrinsics
* Add AVX512VPOPCNTDQ Intrinsics
* Add VPCLMULQDQ Intrinsics
* Avx512bw
* Reimplement `_xgetbv` with LLVM intrinsics
* Avx512bw
* Add reamained vmax and vmin via auto-generated code
* Add VAES intrinsics

Fixes #56483.

3 years agoImprove warnings on incompatible options involving -Zinstrument-coverage
Rich Kadel [Mon, 14 Dec 2020 08:25:29 +0000 (00:25 -0800)]
Improve warnings on incompatible options involving -Zinstrument-coverage

Adds checks for:

* `no_core` attribute
* explicitly-enabled `legacy` symbol mangling
* mir_opt_level > 1 (which enables inlining)

I removed code from the `Inline` MIR pass that forcibly disabled
inlining if `-Zinstrument-coverage` was set. The default `mir_opt_level`
does not enable inlining anyway. But if the level is explicitly set and
is greater than 1, I issue a warning.

The new warnings show up in tests, which is much better for diagnosing
potential option conflicts in these cases.

3 years agoAuto merge of #77618 - fusion-engineering-forks:windows-parker, r=Amanieu
bors [Mon, 14 Dec 2020 16:41:14 +0000 (16:41 +0000)]
Auto merge of #77618 - fusion-engineering-forks:windows-parker, r=Amanieu

Add fast futex-based thread parker for Windows.

This adds a fast futex-based thread parker for Windows. It either uses WaitOnAddress+WakeByAddressSingle or NT Keyed Events (NtWaitForKeyedEvent+NtReleaseKeyedEvent), depending on which is available. Together, this makes this thread parker work for Windows XP and up. Before this change, park()/unpark() did not work on Windows XP: it needs condition variables, which only exist since Windows Vista.

---

Unfortunately, NT Keyed Events are an undocumented Windows API. However:
- This API is relatively simple with obvious behaviour, and there are several (unofficial) articles documenting the details. [1]
- parking_lot has been using this API for years (on Windows versions before Windows 8). [2] Many big projects extensively use parking_lot, such as servo and the Rust compiler itself.
- It is the underlying API used by Windows SRW locks and Windows critical sections. [3] [4]
- The source code of the implementations of Wine, ReactOs, and Windows XP are available and match the expected behaviour.
- The main risk with an undocumented API is that it might change in the future. But since we only use it for older versions of Windows, that's not a problem.
- Even if these functions do not block or wake as we expect (which is unlikely, see all previous points), this implementation would still be memory safe. The NT Keyed Events API is only used to sleep/block in the right place.

[1]\: http://www.locklessinc.com/articles/keyed_events/
[2]\: https://github.com/Amanieu/parking_lot/commit/43abbc964e
[3]\: https://docs.microsoft.com/en-us/archive/msdn-magazine/2012/november/windows-with-c-the-evolution-of-synchronization-in-windows-and-c
[4]\: Windows Internals, Part 1, ISBN 9780735671300

---

The choice of fallback API is inspired by parking_lot(_core), but the implementation of this thread parker is different. While parking_lot has no use for a fast path (park() directly returning if unpark() was already called), this implementation has a fast path that returns without even checking which waiting/waking API to use, as the same atomic variable with compatible states is used in all cases.

3 years agoexpand-yaml-anchors: Make the output directory separator-insensitive
Yuki Okushi [Mon, 14 Dec 2020 14:33:20 +0000 (23:33 +0900)]
expand-yaml-anchors: Make the output directory separator-insensitive

3 years agoReplace some `println!` with `tidy_error!` to simplify
Yuki Okushi [Mon, 14 Dec 2020 14:10:15 +0000 (23:10 +0900)]
Replace some `println!` with `tidy_error!` to simplify

3 years agoAuto merge of #80024 - GuillaumeGomez:rollup-rqd46ko, r=GuillaumeGomez
bors [Mon, 14 Dec 2020 13:45:38 +0000 (13:45 +0000)]
Auto merge of #80024 - GuillaumeGomez:rollup-rqd46ko, r=GuillaumeGomez

Rollup of 3 pull requests

Successful merges:

 - #79918 (doc(array,vec): add notes about side effects when empty-initializing)
 - #79936 (Fix item name display on mobile)
 - #80013 (Refactor test_lang_string_parse to make it clearer)

Failed merges:

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

3 years agoRollup merge of #80013 - poliorcetics:rustdoc-test-refactor, r=jyn514
Guillaume Gomez [Mon, 14 Dec 2020 13:43:47 +0000 (14:43 +0100)]
Rollup merge of #80013 - poliorcetics:rustdoc-test-refactor, r=jyn514

Refactor test_lang_string_parse to make it clearer

Follows https://github.com/rust-lang/rust/pull/79454#discussion_r540190949

A small PR made to refactor a test in rustdoc that was becoming unwieldy.

``@rustbot`` label T-rustdoc
r? ``@jyn514``

3 years agoRollup merge of #79936 - GuillaumeGomez:mobile-fix-item-name, r=Nemo157,jyn514
Guillaume Gomez [Mon, 14 Dec 2020 13:43:45 +0000 (14:43 +0100)]
Rollup merge of #79936 - GuillaumeGomez:mobile-fix-item-name, r=Nemo157,jyn514

Fix item name display on mobile

Fixes https://github.com/rust-lang/docs.rs/issues/1200

![Screenshot_20201211-200931](https://user-images.githubusercontent.com/3050060/101944457-0c06eb00-3bed-11eb-8f63-a4d4fd3cbb56.jpg)
![Screenshot_20201211-195846](https://user-images.githubusercontent.com/3050060/101944459-0d381800-3bed-11eb-91ff-815a2af7ca72.jpg)

cc `@jyn514`

r? `@Nemo157`

3 years agoRollup merge of #79918 - woodruffw-forks:ww/doc-initializer-side-effects, r=dtolnay
Guillaume Gomez [Mon, 14 Dec 2020 13:43:44 +0000 (14:43 +0100)]
Rollup merge of #79918 - woodruffw-forks:ww/doc-initializer-side-effects, r=dtolnay

doc(array,vec): add notes about side effects when empty-initializing

Copying some context from a conversation in the Rust discord:

* Both `vec![T; 0]` and `[T; 0]` are syntactically valid, and produce empty containers of their respective types

* Both *also* have side effects:

```rust
fn side_effect() -> String {
    println!("side effect!");

    "foo".into()
}

fn main() {
    println!("before!");

    let x = vec![side_effect(); 0];

    let y = [side_effect(); 0];

    println!("{:?}, {:?}", x, y);
}
```

produces:

```
before!
side effect!
side effect!
[], []
```

This PR just adds two small notes to each's documentation, warning users that side effects can occur.

I've also submitted a clippy proposal: https://github.com/rust-lang/rust-clippy/issues/6439

3 years agoAdd test case for Self:: links
Dániel Buga [Mon, 30 Nov 2020 22:17:11 +0000 (23:17 +0100)]
Add test case for Self:: links

3 years agoReview suggestions
Dániel Buga [Mon, 30 Nov 2020 22:16:50 +0000 (23:16 +0100)]
Review suggestions

3 years agoCache link resolution results in current module
Dániel Buga [Fri, 9 Oct 2020 08:27:14 +0000 (10:27 +0200)]
Cache link resolution results in current module

Co-authored-by: Joshua Nelson <jyn514@gmail.com>
3 years agoAuto merge of #79959 - JohnTitor:tidy-entries, r=petrochenkov
bors [Mon, 14 Dec 2020 09:25:00 +0000 (09:25 +0000)]
Auto merge of #79959 - JohnTitor:tidy-entries, r=petrochenkov

Check the number of entries in UI test on tidy

This helps #73494 to be resolved.

r? `@petrochenkov`

3 years agoAuto merge of #79944 - sivadeilra:syms_proc_macro_testing, r=petrochenkov
bors [Mon, 14 Dec 2020 07:03:52 +0000 (07:03 +0000)]
Auto merge of #79944 - sivadeilra:syms_proc_macro_testing, r=petrochenkov

Improve error handling in `symbols` proc-macro

This improves how the `symbols` proc-macro handles errors.
If it finds an error in its input, the macro does not panic.
Instead, it still produces an output token stream. That token
stream will contain `compile_error!(...)` macro invocations.
This will still cause compilation to fail (which is what we want),
but it will prevent meaningless errors caused by the output not
containing symbols that the macro normally generates.

This solves a small (but annoying) problem. When you're editing
rustc_span/src/symbol.rs, and you get something wrong (dup
symbol name, misordered symbol), you want to get only the errors
that are relevant, not a burst of errors that are irrelevant.
This change also uses the correct Span when reporting errors,
so you get errors that point to the correct place in
rustc_span/src/symbol.rs where something is wrong.

This also adds several unit tests which test the `symbols` proc-macro.

This commit also makes it easy to run the `symbols` proc-macro
as an ordinary Cargo test. Just run `cargo test`. This makes it
easier to do development on the macro itself, such as running it
under a debugger.

This commit also uses the `Punctuated` type in `syn` for parsing
comma-separated lists, rather than doing it manually.

The output of the macro is not changed at all by this commit,
so rustc should be completely unchanged. This just improves
quality of life during development.

3 years agoCheck the number of entries in UI test
Yuki Okushi [Sat, 12 Dec 2020 06:15:06 +0000 (15:15 +0900)]
Check the number of entries in UI test

3 years agoAuto merge of #80005 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
bors [Sun, 13 Dec 2020 22:13:02 +0000 (22:13 +0000)]
Auto merge of #80005 - ssomers:btree_cleanup_3, r=Mark-Simulacrum

BTreeMap: declare clear_parent_link directly on the root it needs

r? `@Mark-Simulacrum`

3 years ago./x.py fmt
Arlie Davis [Sun, 13 Dec 2020 21:36:01 +0000 (13:36 -0800)]
./x.py fmt

3 years agoUse imports instead of rewriting the type signature of `stable`
Joshua Nelson [Sun, 13 Dec 2020 20:13:41 +0000 (15:13 -0500)]
Use imports instead of rewriting the type signature of `stable`

This was an adventure; see https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/'higher.20ranked.20subtype.20error'

3 years agoAuto merge of #79978 - Aaron1011:fix/capture-broken-token, r=petrochenkov
bors [Sun, 13 Dec 2020 19:31:06 +0000 (19:31 +0000)]
Auto merge of #79978 - Aaron1011:fix/capture-broken-token, r=petrochenkov

Properly capture trailing 'unglued' token

If we try to capture the `Vec<u8>` in `Option<Vec<u8>>`, we'll
need to capture a `>` token which was 'unglued' from a `>>` token.
The processing of unglueing a token for parsing purposes bypasses the
usual capturing infrastructure, so we currently lose the trailing `>`.
As a result, we fall back to the reparsed `TokenStream`, causing us to
lose spans.

This commit makes token capturing keep track of a trailing 'unglued'
token. Note that we don't need to care about unglueing except at the end
of the captured tokens - if we capture both the first and second unglued
tokens, then we'll end up capturing the full 'glued' token, which
already works correctly.

3 years agoAuto merge of #79987 - ssomers:btree_cleanup_4, r=Mark-Simulacrum
bors [Sun, 13 Dec 2020 17:09:41 +0000 (17:09 +0000)]
Auto merge of #79987 - ssomers:btree_cleanup_4, r=Mark-Simulacrum

BTreeMap: detect bulk_steal's count-1 underflow in release builds too

r? `@Mark-Simulacrum`

3 years agoRefactor test_lang_string_parse to make it clearer
Alexis Bourget [Sun, 13 Dec 2020 16:47:46 +0000 (17:47 +0100)]
Refactor test_lang_string_parse to make it clearer

3 years agoAuto merge of #79376 - ssomers:btree_choose_parent_kv, r=Mark-Simulacrum
bors [Sun, 13 Dec 2020 14:42:37 +0000 (14:42 +0000)]
Auto merge of #79376 - ssomers:btree_choose_parent_kv, r=Mark-Simulacrum

BTreeMap: clarify comments and panics around choose_parent_kv

Fixes a lie in recent code: `unreachable!("empty non-root node")` should shout "empty internal node", but it might as well be good and keep quiet

r? `@Mark-Simulacrum`

3 years agoFix `cargo-binutils` link
EFanZh [Sun, 13 Dec 2020 11:23:16 +0000 (19:23 +0800)]
Fix `cargo-binutils` link

3 years agoAuto merge of #79668 - coolreader18:recover-const-impl, r=petrochenkov
bors [Sun, 13 Dec 2020 10:52:29 +0000 (10:52 +0000)]
Auto merge of #79668 - coolreader18:recover-const-impl, r=petrochenkov

Recover on `const impl<> X for Y`

`@leonardo-m` mentioned that `const impl Foo for Bar` could be recovered from in #79287.

I'm not sure about the error strings as they are, I think it should probably be something like the error that `expected_one_of_not_found` makes + the suggestion to flip the keywords, but I'm not sure how exactly to do that. Also, I decided not to try to handle `const unsafe impl` or `unsafe const impl` cause I figured that `unsafe impl const` would be pretty rare anyway (if it's even valid?), and it wouldn't be worth making the code more messy.

3 years agoBTreeMap: declare clear_parent_link directly on the root it needs
Stein Somers [Mon, 23 Nov 2020 13:41:53 +0000 (14:41 +0100)]
BTreeMap: declare clear_parent_link directly on the root it needs

3 years agoAuto merge of #79956 - camelid:variant-field-vis, r=petrochenkov
bors [Sun, 13 Dec 2020 08:40:07 +0000 (08:40 +0000)]
Auto merge of #79956 - camelid:variant-field-vis, r=petrochenkov

Resolve enum field visibility correctly

Fixes #79593. :tada:

Previously, this code treated enum fields' visibility as if they were
struct fields. However, that's not correct because the visibility of a
struct field with `ast::VisibilityKind::Inherited` is private to the
module it's defined in, whereas the visibility of an *enum* field with
`ast::VisibilityKind::Inherited` is the visibility of the enum it
belongs to.

3 years agoAuto merge of #79994 - JohnTitor:rollup-43wl2uj, r=JohnTitor
bors [Sun, 13 Dec 2020 04:02:26 +0000 (04:02 +0000)]
Auto merge of #79994 - JohnTitor:rollup-43wl2uj, r=JohnTitor

Rollup of 12 pull requests

Successful merges:

 - #79360 (std::iter: document iteration over `&T` and `&mut T`)
 - #79398 (Link loop/for keyword)
 - #79834 (Remove deprecated linked_list_extras methods.)
 - #79845 (Fix rustup support in default_build_triple for python3)
 - #79940 (fix more clippy::complexity findings)
 - #79942 (Add post-init hook for static memory for miri.)
 - #79954 (Fix building compiler docs with stage 0)
 - #79963 (Fix typo in `DebruijnIndex` documentation)
 - #79970 (Misc rustbuild improvements when the LLVM backend isn't used)
 - #79973 (rustdoc light theme: Fix CSS for selected buttons)
 - #79984 (Remove an unused dependency that made `rustdoc` crash)
 - #79985 (Fixes submit event of the search input)

Failed merges:

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

3 years agoRollup merge of #79985 - GuillaumeGomez:fix-submit-event, r=jyn514
Yuki Okushi [Sun, 13 Dec 2020 02:05:48 +0000 (11:05 +0900)]
Rollup merge of #79985 - GuillaumeGomez:fix-submit-event, r=jyn514

Fixes submit event of the search input

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

It's a very funny corner case:

In HTML, when a button follows an input (in a `form`), if the enter keep is pressed on the input, instead of sending the submit event to the input, it'll create a click event on the button following it, which in this case made the help popup show up whenever "enter" was pressed.

cc `@camelid`

r? `@jyn514`

3 years agoRollup merge of #79984 - Nadrieril:remove-unused-dep, r=jyn514
Yuki Okushi [Sun, 13 Dec 2020 02:05:47 +0000 (11:05 +0900)]
Rollup merge of #79984 - Nadrieril:remove-unused-dep, r=jyn514

Remove an unused dependency that made `rustdoc` crash

Whilst struggling with https://github.com/rust-lang/rust/issues/79980 I discovered that this dependency was unused, and that made rustdoc crash. This PR removes it.

3 years agoRollup merge of #79973 - camelid:rustdoc-search-tab-color, r=GuillaumeGomez
Yuki Okushi [Sun, 13 Dec 2020 02:05:45 +0000 (11:05 +0900)]
Rollup merge of #79973 - camelid:rustdoc-search-tab-color, r=GuillaumeGomez

rustdoc light theme: Fix CSS for selected buttons

Fixes #79961.

The background was dark before, which made the text impossible to read.
Now the button doesn't override the background, and the only thing it
does is add a light-blue top border.

Ultimately, the search results tabs now look very similar to how they
used to look.

r? `@GuillaumeGomez`

3 years agoRollup merge of #79970 - bjorn3:no_unnecessary_llvm_checkout, r=Mark-Simulacrum
Yuki Okushi [Sun, 13 Dec 2020 02:05:43 +0000 (11:05 +0900)]
Rollup merge of #79970 - bjorn3:no_unnecessary_llvm_checkout, r=Mark-Simulacrum

Misc rustbuild improvements when the LLVM backend isn't used

* Don't checkout llvm-project
* Don't require cmake and ninja

Fixes #78564

3 years agoRollup merge of #79963 - LeSeulArtichaut:debruijn-typo, r=Dylan-DPC
Yuki Okushi [Sun, 13 Dec 2020 02:05:41 +0000 (11:05 +0900)]
Rollup merge of #79963 - LeSeulArtichaut:debruijn-typo, r=Dylan-DPC

Fix typo in `DebruijnIndex` documentation

Suggested in https://github.com/rust-lang/rust/pull/79169#discussion_r541564114.
r? ``@lqd``

3 years agoRollup merge of #79954 - jyn514:normalize-oops, r=Mark-Simulacrum
Yuki Okushi [Sun, 13 Dec 2020 02:05:40 +0000 (11:05 +0900)]
Rollup merge of #79954 - jyn514:normalize-oops, r=Mark-Simulacrum

Fix building compiler docs with stage 0

This regressed in https://github.com/rust-lang/rust/pull/79525 (see https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Can't.20document.20single.20crate).

r? `@Mark-Simulacrum`

3 years agoRollup merge of #79942 - JCTyblaidd:static-mem-init, r=RalfJung
Yuki Okushi [Sun, 13 Dec 2020 02:05:38 +0000 (11:05 +0900)]
Rollup merge of #79942 - JCTyblaidd:static-mem-init, r=RalfJung

Add post-init hook for static memory for miri.

Adds a post-initialization hook to treat memory initialized using the interpreter as if it was initialized in a static context.

See: https://github.com/rust-lang/miri/pull/1644 & https://github.com/rust-lang/miri/issues/1643

3 years agoRollup merge of #79940 - matthiaskrgr:cl15ppy, r=Dylan-DPC
Yuki Okushi [Sun, 13 Dec 2020 02:05:36 +0000 (11:05 +0900)]
Rollup merge of #79940 - matthiaskrgr:cl15ppy, r=Dylan-DPC

fix more clippy::complexity findings

fix clippy::unnecessary_filter_map
use if let Some(x) = ..  instead of ...map(|x|) to conditionally run fns that return () (clippy::option_map_unit_fn)
fix clippy::{needless_bool, manual_unwrap_or}
don't clone types that are copy (clippy::clone_on_copy)
don't convert types into identical types with .into() (clippy::useless_conversion)
use strip_prefix over slicing (clippy::manual_strip)

r? ``@Dylan-DPC``

3 years agoRollup merge of #79845 - jyn514:python3, r=Mark-Simulacrum
Yuki Okushi [Sun, 13 Dec 2020 02:05:35 +0000 (11:05 +0900)]
Rollup merge of #79845 - jyn514:python3, r=Mark-Simulacrum

Fix rustup support in default_build_triple for python3

bootstrap completely ignores all errors when detecting a rustup version,
so this wasn't noticed before.

Fixes the following error:

```
rustup not detected: a bytes-like object is required, not 'str'
falling back to auto-detect
```

This also takes the opportunity to only call rustup and other external
commands only once during startup.

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

3 years agoRollup merge of #79834 - m-ou-se:bye-linked-list-extras, r=Mark-Simulacrum
Yuki Okushi [Sun, 13 Dec 2020 02:05:32 +0000 (11:05 +0900)]
Rollup merge of #79834 - m-ou-se:bye-linked-list-extras, r=Mark-Simulacrum

Remove deprecated linked_list_extras methods.

https://github.com/rust-lang/rust/issues/27794#issuecomment-667524201:
> I'd say give it about 2 weeks then remove them.

It's been 18 weeks. Time to remove them. :)

Closes #27794.