]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum
bors [Mon, 5 Apr 2021 21:14:27 +0000 (21:14 +0000)]
Auto merge of #83152 - guswynn:jemallocator_part2, r=Mark-Simulacrum

Use tikv-jemallocator in rustc/rustdoc in addition to jemalloc-sys when enabled.

In https://github.com/rust-lang/rust/pull/81782 it was mentioned that one reason rustc may benefit from minimalloc is it doesn't use the `sdallocx` api from jemalloc.

Currently, on unix, rust uses jemalloc by importing its symbols to use them with the default, System (libc) global allocator.
This PR switches its global alloc to `tikv-jemallocator`, which correctly uses sized deallocation (https://docs.rs/tikv-jemallocator/0.4.1/src/tikv_jemallocator/lib.rs.html#121-126). `tikv-jemallocator`, as far as I can tell, is a more up-to-date set of bindings to jemalloc than `jemallocator`

The perf results of this pr are in large part due to the version upgrade of jemalloc, but sized deallocation has a non-trivial improvement, particularly to rustdoc.

This pr also includes changes to bootstrap to correctly pass the jemalloc feature through to the rustdoc build

3 years agoAuto merge of #83406 - b-naber:issue-83510, r=lcnr
bors [Mon, 5 Apr 2021 18:50:42 +0000 (18:50 +0000)]
Auto merge of #83406 - b-naber:issue-83510, r=lcnr

Prevent very long compilation runtimes in LateBoundRegionNameCollector

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

On recursive types such as in the example given in https://github.com/rust-lang/rust/issues/83150, the current implementation of `LateBoundRegionNameCollector` has very long compilation runtimes. To prevent those we store the types visited in the `middle::ty::Visitor` implementation of `LateBoundRegionNameCollector` in a `SsoHashSet`.

3 years agoAuto merge of #83890 - Dylan-DPC:rollup-9fqy3fe, r=Dylan-DPC
bors [Mon, 5 Apr 2021 13:50:17 +0000 (13:50 +0000)]
Auto merge of #83890 - Dylan-DPC:rollup-9fqy3fe, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #83368 (Add `download-rustc = "if-unchanged"`)
 - #83705 (Give a better error when --theme is not a CSS file)
 - #83853 (Disallow the use of high byte registes as operands on x86_64)
 - #83877 (Remove unnecessary exceptions to the platform-specific code check)
 - #83878 (Fix racing file access in tidy)

Failed merges:

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

3 years agoRollup merge of #83878 - the8472:fix-concurrent-tidy-access, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Apr 2021 13:48:46 +0000 (15:48 +0200)]
Rollup merge of #83878 - the8472:fix-concurrent-tidy-access, r=Mark-Simulacrum

Fix racing file access in tidy

That should fix the failure in https://github.com/rust-lang/rust/pull/83776#issuecomment-813311289

The file is only created for a brief moment during the bins checks in the source directories while other checks may also be visiting the same directory. By skipping it we avoid file not found errors.

3 years agoRollup merge of #83877 - jyn514:exceptions, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Apr 2021 13:48:44 +0000 (15:48 +0200)]
Rollup merge of #83877 - jyn514:exceptions, r=Mark-Simulacrum

Remove unnecessary exceptions to the platform-specific code check

Some of these were just wrong, like src/librustc. Some looked outdated,
like std::f64. Not sure what was going on with the others - maybe this
check isn't as smart as it needs to be? But in the meantime it seems
silly to ignore the check if it will pass anyway.

3 years agoRollup merge of #83853 - Amanieu:asm_no_high_x86_64, r=nagisa
Dylan DPC [Mon, 5 Apr 2021 13:48:43 +0000 (15:48 +0200)]
Rollup merge of #83853 - Amanieu:asm_no_high_x86_64, r=nagisa

Disallow the use of high byte registes as operands on x86_64

They are still allowed on x86 though.

Fixes #83495

r? `@nagisa`

3 years agoRollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomez
Dylan DPC [Mon, 5 Apr 2021 13:48:42 +0000 (15:48 +0200)]
Rollup merge of #83705 - jyn514:theme-error, r=GuillaumeGomez

Give a better error when --theme is not a CSS file

Before:

```
error: invalid argument: "bacon.toml"
```

After:
```
error: invalid argument: "bacon.toml"
  |
  = help: arguments to --theme must be CSS files
```

cc https://github.com/rust-lang/rust/pull/83478

3 years agoRollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Apr 2021 13:48:40 +0000 (15:48 +0200)]
Rollup merge of #83368 - jyn514:download-if-unchanged, r=Mark-Simulacrum

Add `download-rustc = "if-unchanged"`

This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.

This sets `BOOTSTRAP_DOWNLOAD_RUSTC` in bootstrap.py so rustbuild doesn't have to try and replicate its logic.

Helps with https://github.com/rust-lang/rust/issues/81930.

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

3 years agoAdd `download-rustc = "if-unchanged"`
Joshua Nelson [Mon, 22 Mar 2021 06:31:47 +0000 (02:31 -0400)]
Add `download-rustc = "if-unchanged"`

This allows keeping the setting to a fixed value without having to
toggle it when you want to work on the compiler instead of on tools.

3 years agoDisallow the use of high byte registes as operands on x86_64
Amanieu d'Antras [Sun, 4 Apr 2021 16:44:46 +0000 (17:44 +0100)]
Disallow the use of high byte registes as operands on x86_64

They are still allowed on x86 though.

Fixes #83495

3 years agoAuto merge of #83880 - Dylan-DPC:rollup-hz9ph0e, r=Dylan-DPC
bors [Mon, 5 Apr 2021 11:06:20 +0000 (11:06 +0000)]
Auto merge of #83880 - Dylan-DPC:rollup-hz9ph0e, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #81922 (Let `#[allow(unstable_name_collisions)]` work for things other than function)
 - #82483 (Use FromStr trait for number option parsing)
 - #82739 (Use the beta compiler for building bootstrap tools when `download-rustc` is set)
 - #83650 (Update Source Serif to release 4.004)
 - #83826 (List trait impls before deref methods in doc's sidebar)
 - #83831 (Add `#[inline]` to IpAddr methods)
 - #83863 (Render destructured struct function param names as underscore)
 - #83865 (Don't report disambiguator error if link would have been ignored)

Failed merges:

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

3 years agoRollup merge of #83865 - camelid:disamb-err-fix, r=jyn514
Dylan DPC [Mon, 5 Apr 2021 11:03:44 +0000 (13:03 +0200)]
Rollup merge of #83865 - camelid:disamb-err-fix, r=jyn514

Don't report disambiguator error if link would have been ignored

Fixes #83859.

This prevents us from warning on links such as `<hello@example.com>`.
Note that we still warn on links such as `<hello@localhost>` because
they have no dots in them. However, the links will still work, even
though a warning is reported.

r? ````@jyn514````

3 years agoRollup merge of #83863 - eggyal:issue-83852, r=jyn514
Dylan DPC [Mon, 5 Apr 2021 11:03:43 +0000 (13:03 +0200)]
Rollup merge of #83863 - eggyal:issue-83852, r=jyn514

Render destructured struct function param names as underscore

Fixes #83852

r? ````@GuillaumeGomez````

3 years agoRollup merge of #83831 - AngelicosPhosphoros:issue-77583-inline-for-ip, r=m-ou-se
Dylan DPC [Mon, 5 Apr 2021 11:03:42 +0000 (13:03 +0200)]
Rollup merge of #83831 - AngelicosPhosphoros:issue-77583-inline-for-ip, r=m-ou-se

Add `#[inline]` to IpAddr methods

Add some inlines to trivial methods of IpAddr
Closes https://github.com/rust-lang/rust/issues/77583

3 years agoRollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shuffle, r=jyn514
Dylan DPC [Mon, 5 Apr 2021 11:03:41 +0000 (13:03 +0200)]
Rollup merge of #83826 - slightlyoutofphase:rustdoc-sidebar-order-shuffle, r=jyn514

List trait impls before deref methods in doc's sidebar

This PR is acting directly on a suggestion made by ```````@jyn514``````` in #83133. I've tested the changes locally, and can confirm that it does in fact properly achieve what he thought it would. This PR also in turn closes #83133.

3 years agoRollup merge of #83650 - tspiteri:source-serif-4, r=GuillaumeGomez
Dylan DPC [Mon, 5 Apr 2021 11:03:40 +0000 (13:03 +0200)]
Rollup merge of #83650 - tspiteri:source-serif-4, r=GuillaumeGomez

Update Source Serif to release 4.004

Now the family name is Source Serif 4 (upstream issue 77) instead of Source Serif Pro.

3 years agoRollup merge of #82739 - jyn514:separate-stage0-stage1, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Apr 2021 11:03:38 +0000 (13:03 +0200)]
Rollup merge of #82739 - jyn514:separate-stage0-stage1, r=Mark-Simulacrum

Use the beta compiler for building bootstrap tools when `download-rustc` is set

 ## Motivation

This avoids having to rebuild bootstrap and tidy each time you rebase
over master. In particular, it makes rebasing and running `x.py fmt` on
each commit in a branch significantly faster. It also avoids having to
rebuild bootstrap after setting `download-rustc = true`.

 ## Implementation

Instead of extracting the CI artifacts directly to `stage0/`, extract
them to `ci-rustc/` instead. Continue to copy them to the proper
sysroots as necessary for all stages except stage 0.

This also requires `bootstrap.py` to download both stage0 and CI
artifacts and distinguish between the two when checking stamp files.

Note that since tools have to be built by the same compiler that built
`rustc-dev` and the standard library, the downloaded artifacts can't be
reused when building with the beta compiler. To make sure this is still
a good user experience, warn when building with the beta compiler, and
default to building with stage 2.

I tested this by rebasing this PR from edeee915b1c52f97411e57ef6b1a8bd46548a37a over 1c77a1fa3ca574f2a40056f64d498db8efe0d8a8 and confirming that only the bootstrap library itself had to be rebuilt, not any dependencies and not `tidy`. I also tested that a clean build with `x.py build` builds rustdoc exactly once and does no other work, and that `touch src/librustdoc/lib.rs && x.py build` works. `x.py check` still behaves as before (checks using the beta compiler, even if there are changes to `compiler/`).

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #82483 - tmiasko:option-from-str, r=matthewjasper
Dylan DPC [Mon, 5 Apr 2021 11:03:37 +0000 (13:03 +0200)]
Rollup merge of #82483 - tmiasko:option-from-str, r=matthewjasper

Use FromStr trait for number option parsing

Replace `parse_uint` with generic `parse_number` based on `FromStr`.
Use it for parsing inlining threshold to avoid casting later.

3 years agoRollup merge of #81922 - magurotuna:issue81522, r=matthewjasper
Dylan DPC [Mon, 5 Apr 2021 11:03:36 +0000 (13:03 +0200)]
Rollup merge of #81922 - magurotuna:issue81522, r=matthewjasper

Let `#[allow(unstable_name_collisions)]` work for things other than function

Fixes #81522

In addition to the report in #81522, currently `#[allow(unstable_name_collisions)]` doesn't suppress the corresponding diagnostics even if this attribute is appended to an expression statement or a let statement. It seems like this is because the wrong `HirId` is passed to `struct_span_lint_hir`.
It's fixed in this PR, and a regression test for it is also added.

3 years agodon't try to visit probe file
The8472 [Mon, 5 Apr 2021 10:15:52 +0000 (12:15 +0200)]
don't try to visit probe file

this file is only created for a brief moment during the bins checks
in the source directories while other checks may also be visiting
that directory. skip processing it to avoid missing file errors

3 years agoRemove unnecessary exceptions to the platform-specific code check
Joshua Nelson [Mon, 5 Apr 2021 10:02:29 +0000 (06:02 -0400)]
Remove unnecessary exceptions to the platform-specific code check

Some of these were just wrong, like src/librustc. Some looked outdated,
like std::f64. Not sure what was going on with the others - maybe this
check isn't as smart as it needs to be? But it the meantime it seems
silly to ignore the check if it will pass anyway.

3 years agochange SourceSerifPro to SourceSerif4 in emit-shared-files test
Trevor Spiteri [Mon, 5 Apr 2021 08:51:37 +0000 (10:51 +0200)]
change SourceSerifPro to SourceSerif4 in emit-shared-files test

3 years agoUpdate Source Serif to release 4.004
Trevor Spiteri [Mon, 29 Mar 2021 16:33:22 +0000 (18:33 +0200)]
Update Source Serif to release 4.004

Now the family name is Source Serif 4 (upstream issue 77) instead of
Source Serif Pro.

3 years agoAuto merge of #83858 - joshtriplett:unsafe-cell-always-inline, r=Mark-Simulacrum
bors [Mon, 5 Apr 2021 06:21:14 +0000 (06:21 +0000)]
Auto merge of #83858 - joshtriplett:unsafe-cell-always-inline, r=Mark-Simulacrum

Use `#[inline(always)]` on trivial UnsafeCell methods

UnsafeCell is the standard building block for shared mutable data
structures. UnsafeCell should add zero overhead compared to using raw
pointers directly.

Some reports suggest that debug builds, or even builds at opt-level 1,
may not always be inlining its methods. Mark the methods as
`#[inline(always)]`, since once inlined the methods should result in no
actual code other than field accesses.

3 years agoAuto merge of #83819 - AngelicosPhosphoros:issue-73338-fix-partial-eq-impl, r=Mark...
bors [Mon, 5 Apr 2021 03:55:09 +0000 (03:55 +0000)]
Auto merge of #83819 - AngelicosPhosphoros:issue-73338-fix-partial-eq-impl, r=Mark-Simulacrum

Optimize jumps in PartialOrd le

Closes https://github.com/rust-lang/rust/issues/73338
This change stops default implementation of `le()` method of PartialOrd from generating jumps.

3 years agoAuto merge of #83864 - Dylan-DPC:rollup-78an86n, r=Dylan-DPC
bors [Mon, 5 Apr 2021 01:26:57 +0000 (01:26 +0000)]
Auto merge of #83864 - Dylan-DPC:rollup-78an86n, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #80525 (wasm64 support)
 - #83019 (core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.)
 - #83717 (rustdoc: Separate filter-empty-string out into its own function)
 - #83807 (Tests: Remove redundant `ignore-tidy-linelength` annotations)
 - #83815 (ptr::addr_of documentation improvements)
 - #83820 (Remove attribute `#[link_args]`)
 - #83841 (Allow clobbering unsupported registers in asm!)

Failed merges:

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

3 years agoRenamed test
Alan Egerton [Sun, 4 Apr 2021 23:29:43 +0000 (00:29 +0100)]
Renamed test

3 years agoMerge branch 'master' of github.com:rust-lang/rust into issue-83852
Alan Egerton [Sun, 4 Apr 2021 23:27:57 +0000 (00:27 +0100)]
Merge branch 'master' of github.com:rust-lang/rust into issue-83852

3 years agoDon't report disambiguator error if link would have been ignored
Camelid [Sun, 4 Apr 2021 22:31:43 +0000 (15:31 -0700)]
Don't report disambiguator error if link would have been ignored

This prevents us from warning on links such as `<hello@example.com>`.
Note that we still warn on links such as `<hello@localhost>` because
they have no dots in them. However, the links will still work, even
though a warning is reported.

3 years agoAuto merge of #83530 - Mark-Simulacrum:bootstrap-bump, r=Mark-Simulacrum
bors [Sun, 4 Apr 2021 22:45:56 +0000 (22:45 +0000)]
Auto merge of #83530 - Mark-Simulacrum:bootstrap-bump, r=Mark-Simulacrum

Bump bootstrap to 1.52 beta

This includes the standard bump, but also a workaround for new cargo behavior around clearing out the doc directory when the rustdoc version changes.

3 years agoRollup merge of #83841 - Amanieu:asm_clobber_feature, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:34 +0000 (00:24 +0200)]
Rollup merge of #83841 - Amanieu:asm_clobber_feature, r=nagisa

Allow clobbering unsupported registers in asm!

Previously registers could only be marked as clobbered if the target feature for that register was enabled. This restriction is now removed.

cc #81092

r? ``@nagisa``

3 years agoRollup merge of #83820 - petrochenkov:nolinkargs, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:33 +0000 (00:24 +0200)]
Rollup merge of #83820 - petrochenkov:nolinkargs, r=nagisa

Remove attribute `#[link_args]`

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

The attribute could always be replaced with `-C link-arg`, but cargo didn't provide a reasonable way to pass such flags to rustc.
Now cargo supports `cargo:rustc-link-arg*` directives in build scripts (https://doc.rust-lang.org/cargo/reference/unstable.html#extra-link-arg), so this attribute can be removed.

3 years agoRollup merge of #83815 - RalfJung:addr_of, r=kennytm
Dylan DPC [Sun, 4 Apr 2021 22:24:32 +0000 (00:24 +0200)]
Rollup merge of #83815 - RalfJung:addr_of, r=kennytm

ptr::addr_of documentation improvements

While writing https://github.com/rust-lang/reference/pull/1001 I figured I could also improve the docs here a bit.

3 years agoRollup merge of #83807 - sjakobi:77548-remove-ignore-annotations, r=Mark-Simulacrum
Dylan DPC [Sun, 4 Apr 2021 22:24:31 +0000 (00:24 +0200)]
Rollup merge of #83807 - sjakobi:77548-remove-ignore-annotations, r=Mark-Simulacrum

Tests: Remove redundant `ignore-tidy-linelength` annotations

This is step 2 towards fixing #77548.

In the codegen and codegen-units test suites, the `//` comment markers
were kept in order not to affect any source locations. This is because
these tests cannot be automatically `--bless`ed.

3 years agoRollup merge of #83717 - notriddle:main-js-slice-loop, r=GuillaumeGomez
Dylan DPC [Sun, 4 Apr 2021 22:24:29 +0000 (00:24 +0200)]
Rollup merge of #83717 - notriddle:main-js-slice-loop, r=GuillaumeGomez

rustdoc: Separate filter-empty-string out into its own function

3 years agoRollup merge of #83019 - eddyb:spirv-no-block-swap, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:29 +0000 (00:24 +0200)]
Rollup merge of #83019 - eddyb:spirv-no-block-swap, r=nagisa

core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.

SPIR-V primarily supports what it calls the "Logical addressing model" (and AFAIK for graphical shaders it's the only option), and what that implies is that there is no "memory" to uniformly address at some byte/word level, and that you can't really talk about values having a "raw representation" in terms of sequences of bytes. Therefore, the "block"-wise swapping optimization employed by `ptr::swap_nonoverlapping_one` (where a "block" is 32 bytes, currently), is fundamentally incompatible with SPIR-V "memory".

As such, [Rust-GPU](https://github.com/EmbarkStudios/rust-gpu/)'s `rustc_codegen_spirv` backend cannot currently allow the use of `ptr::swap_nonoverlapping_one` - but that comes at a great price, since it's the building block of `mem::{swap,replace}`, and those in turn are used by e.g. `Option::take` and `Range`'s `Iterator` implementation (the latter blocking the use of `for i in 0..n` loops).

There's 4 options I can see in terms of supporting `ptr::swap_nonoverlapping_one` in `rustc_codegen_spirv`:
* legalize the block-wise swap loop back into swapping whole values, for SPIR-V
  * this is made borderline impossible by the fact that the size of the state "on the stack" is a block, and has to be expanded back to the appropriate size of the value being swapped, so in practice this would have to effectively pattern-match on the exact shape of the block-wise swapping algorithm, as a roundabout way of "patching `core::ptr` on the fly"
* (**this PR**) disable the block-wise swap optimization altogether when `#[cfg(target_arch = "spirv")`
  * I've tested it and it does in fact allow compiling `for i in 0..n` loops, which was my primary motivation
  * main downside IMO is the fact that `core` now acknowledges an out-of-tree backend
    * as a counterpoint, any attempt to compile Rust to SPIR-V would run into this problem, one way or another
* only enable the block-wise swap optimization on targets where it's been empirically proven to be an improvement
  * would avoid any surprises in terms of potentially-broken/inefficient codegen, in general
  * however, it may be universally applicable (thanks to caches), even if the optimal block size could differ
* move low-level swapping into an intrinsic, where the backend can choose any optimization approach it wants
  * this also has an impact on MIR optimizations (cc ``@rust-lang/wg-mir-opt)`` - which currently cannot hope to make sense of e.g. `Option::take` despite it being effectively `_0 = *_1;` `*_1 = None;` `return;`
  * long-term this is my preferred approach, and I can start working on it if that's desired, but I wanted to confirm that this swapping optimization is the final blocker for [Rust-GPU](https://github.com/EmbarkStudios/rust-gpu/) supporting e.g. range `for` loops

r? ``@nagisa`` cc ``@rust-lang/libs``

3 years agoRollup merge of #80525 - devsnek:wasm64, r=nagisa
Dylan DPC [Sun, 4 Apr 2021 22:24:23 +0000 (00:24 +0200)]
Rollup merge of #80525 - devsnek:wasm64, r=nagisa

wasm64 support

There is still some upstream llvm work needed before this can land.

3 years agoRender destructured struct function param names as underscore.
Alan Egerton [Sun, 4 Apr 2021 21:42:19 +0000 (22:42 +0100)]
Render destructured struct function param names as underscore.

Fixes #83852

r? `@GuillaumeGomez`

3 years agouse jemallocator in rustc/rustdoc
Gus Wynn [Sun, 4 Apr 2021 21:07:56 +0000 (14:07 -0700)]
use jemallocator in rustc/rustdoc

3 years agoAuto merge of #82907 - petrochenkov:dercache, r=Aaron1011
bors [Sun, 4 Apr 2021 20:16:09 +0000 (20:16 +0000)]
Auto merge of #82907 - petrochenkov:dercache, r=Aaron1011

resolve/expand: Cache intermediate results of `#[derive]` expansion

Expansion function for `#[derive]` (`rustc_builtin_macros::derive::Expander::expand`) may return an indeterminate result, and therefore can be called multiple times.
Previously we parsed the `#[derive(Foo, Bar)]`'s input and tried to resolve `Foo` and `Bar` on every such call.

Now we maintain a cache `Resolver::derive_data` and take all the necessary data from it if it was computed previously.
So `Foo, Bar` is now parsed at most once, and `Foo` and `Bar` are successfully resolved at most once.

3 years agoUse the beta compiler for building bootstrap tools when `download-rustc` is set
Joshua Nelson [Wed, 10 Feb 2021 05:33:17 +0000 (00:33 -0500)]
Use the beta compiler for building bootstrap tools when `download-rustc` is set

 ## Motivation

This avoids having to rebuild bootstrap and tidy each time you rebase
over master. In particular, it makes rebasing and running `x.py fmt` on
each commit in a branch significantly faster. It also avoids having to
rebuild bootstrap after setting `download-rustc = true`.

 ## Implementation

Instead of extracting the CI artifacts directly to `stage0/`, extract
them to `ci-rustc/` instead. Continue to copy them to the proper
sysroots as necessary for all stages except stage 0.

This also requires `bootstrap.py` to download both stage0 and CI
artifacts and distinguish between the two when checking stamp files.

Note that since tools have to be built by the same compiler that built
`rustc-dev` and the standard library, the downloaded artifacts can't be
reused when building with the beta compiler. To make sure this is still
a good user experience, warn when building with the beta compiler, and
default to building with stage 2.

3 years agocore: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.
Eduard-Mihai Burtescu [Thu, 11 Mar 2021 14:33:34 +0000 (16:33 +0200)]
core: disable `ptr::swap_nonoverlapping_one`'s block optimization on SPIR-V.

3 years agocore: rearrange `ptr::swap_nonoverlapping_one`'s cases (no functional changes).
Eduard-Mihai Burtescu [Thu, 11 Mar 2021 12:39:37 +0000 (14:39 +0200)]
core: rearrange `ptr::swap_nonoverlapping_one`'s cases (no functional changes).

3 years agoWorkaround increased cache clearing in Cargo
Mark Rousskov [Sun, 4 Apr 2021 18:51:22 +0000 (14:51 -0400)]
Workaround increased cache clearing in Cargo

1.52 Cargo adds rust-lang/cargo#8640 which means that cargo will try to purge
the doc directory caches for us. In theory this may mean that we can jettison
the clear_if_dirty for rustdoc versioning entirely, but for now just workaround
the effects of this change in a less principled but more local way.

3 years agoBump cfgs
Mark Rousskov [Fri, 26 Mar 2021 20:10:21 +0000 (16:10 -0400)]
Bump cfgs

3 years agoUse `#[inline(always)]` on trivial UnsafeCell methods
Josh Triplett [Sun, 4 Apr 2021 18:55:13 +0000 (11:55 -0700)]
Use `#[inline(always)]` on trivial UnsafeCell methods

UnsafeCell is the standard building block for shared mutable data
structures. UnsafeCell should add zero overhead compared to using raw
pointers directly.

Some reports suggest that debug builds, or even builds at opt-level 1,
may not always be inlining its methods. Mark the methods as
`#[inline(always)]`, since once inlined the methods should result in no
actual code other than field accesses.

3 years agoAuto merge of #83855 - Dylan-DPC:rollup-oww62sh, r=Dylan-DPC
bors [Sun, 4 Apr 2021 17:48:41 +0000 (17:48 +0000)]
Auto merge of #83855 - Dylan-DPC:rollup-oww62sh, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #73945 (Add an unstable --json=unused-externs flag to print unused externs)
 - #81619 (Implement `SourceIterator` and `InPlaceIterable` for `ResultShunt`)
 - #82726 (BTree: move blocks around in node.rs)
 - #83521 (2229: Fix diagnostic issue when using FakeReads in closures)
 - #83532 (Fix compiletest on FreeBSD)
 - #83793 (rustdoc: highlight macros more efficiently)
 - #83809 (Remove unneeded INITIAL_IDS const)
 - #83827 (cleanup leak after test to make miri happy)

Failed merges:

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

3 years agoOptimize PartialOrd le
AngelicosPhosphoros [Sat, 3 Apr 2021 17:58:15 +0000 (20:58 +0300)]
Optimize PartialOrd le

Closes https://github.com/rust-lang/rust/issues/73338
This change stops default implementation of `le()` method from generating jumps.

3 years agofix typo
Ralf Jung [Sun, 4 Apr 2021 17:32:54 +0000 (19:32 +0200)]
fix typo

Co-authored-by: kennytm <kennytm@gmail.com>
3 years agoRollup merge of #83827 - the8472:fix-inplace-panic-on-drop, r=RalfJung
Dylan DPC [Sun, 4 Apr 2021 17:20:06 +0000 (19:20 +0200)]
Rollup merge of #83827 - the8472:fix-inplace-panic-on-drop, r=RalfJung

cleanup leak after test to make miri happy

Contains changes that were requested in #83629 but didn't make it into the rollup.

r? `````@RalfJung`````

3 years agoRollup merge of #83809 - GuillaumeGomez:remove-initial-ids, r=camelid
Dylan DPC [Sun, 4 Apr 2021 17:20:04 +0000 (19:20 +0200)]
Rollup merge of #83809 - GuillaumeGomez:remove-initial-ids, r=camelid

Remove unneeded INITIAL_IDS const

Some IDs inside this map didn't exist anymore, some others were duplicates of what we have inside `IdMap`. So instead of keeping the two around and since `INITIAL_IDS` was only used by `IdMap`, no need to keep both of them.

3 years agoRollup merge of #83793 - notriddle:single-span-macro-highlight, r=GuillaumeGomez
Dylan DPC [Sun, 4 Apr 2021 17:20:03 +0000 (19:20 +0200)]
Rollup merge of #83793 - notriddle:single-span-macro-highlight, r=GuillaumeGomez

rustdoc: highlight macros more efficiently

Instead of producing `<span class=macro>assert_eq</span><span class=macro>!</span>`,
just produce `<span class=macro>assert_eq!</span>`.

3 years agoRollup merge of #83532 - asomers:gdb-fbsd, r=Mark-Simulacrum
Dylan DPC [Sun, 4 Apr 2021 17:20:02 +0000 (19:20 +0200)]
Rollup merge of #83532 - asomers:gdb-fbsd, r=Mark-Simulacrum

Fix compiletest on FreeBSD

Recent FreeBSD gdb packages have a different format for the version string.

3 years agoRollup merge of #83521 - sexxi-goose:quick-diagnostic-fix, r=nikomatsakis
Dylan DPC [Sun, 4 Apr 2021 17:20:01 +0000 (19:20 +0200)]
Rollup merge of #83521 - sexxi-goose:quick-diagnostic-fix, r=nikomatsakis

2229: Fix diagnostic issue when using FakeReads in closures

This PR fixes a diagnostic issue caused by https://github.com/rust-lang/rust/pull/82536. A temporary work around was used in this merged PR which involved feature gating the addition of FakeReads introduced as a result of pattern matching in closures.

The fix involves adding an optional closure DefId to ForLet and ForMatchedPlace FakeReadCauses. This DefId will only be added if a closure pattern matches a Place starting with an Upvar.

r? ```@nikomatsakis```

3 years agoRollup merge of #82726 - ssomers:btree_node_rearange, r=Mark-Simulacrum
Dylan DPC [Sun, 4 Apr 2021 17:20:00 +0000 (19:20 +0200)]
Rollup merge of #82726 - ssomers:btree_node_rearange, r=Mark-Simulacrum

BTree: move blocks around in node.rs

Without changing any names or implementation, reorder some members:
- Move down the ones defined long ago on the demised `struct Root`, to below the definition of their current host `struct NodeRef`.
- Move up some defined on `struct NodeRef` that are interspersed with those defined on `struct Handle`.
- Move up the `correct_…` methods squeezed between the two flavours of `push`.
- Move the unchecked static downcasts (`cast_to_…`) after the upcasts (`forget_`) and the (weirdly named) dynamic downcasts (`force`).
r? ````@Mark-Simulacrum````

3 years agoRollup merge of #81619 - SkiFire13:resultshunt-inplace, r=the8472
Dylan DPC [Sun, 4 Apr 2021 17:19:59 +0000 (19:19 +0200)]
Rollup merge of #81619 - SkiFire13:resultshunt-inplace, r=the8472

Implement `SourceIterator` and `InPlaceIterable` for `ResultShunt`

3 years agoRollup merge of #73945 - est31:unused_externs, r=Mark-Simulacrum
Dylan DPC [Sun, 4 Apr 2021 17:19:58 +0000 (19:19 +0200)]
Rollup merge of #73945 - est31:unused_externs, r=Mark-Simulacrum

Add an unstable --json=unused-externs flag to print unused externs

This adds an unstable flag to print a list of the extern names not used by cargo.

This PR will enable cargo to collect unused dependencies from all units and provide warnings.
The companion PR to cargo is: https://github.com/rust-lang/cargo/pull/8437

The goal is eventual stabilization of this flag in rustc as well as in cargo.

Discussion of this feature is mostly contained inside these threads: #57274 #72342 #72603

The feature builds upon the internal datastructures added by #72342

Externs are uniquely identified by name and the information is sufficient for cargo.
If the mode is enabled, rustc will print json messages like:

```
{"unused_extern_names":["byteorder","openssl","webpki"]}
```

For a crate that got passed byteorder, openssl and webpki dependencies but needed none of them.

### Q: Why not pass -Wunused-crate-dependencies?
A: See [ehuss's comment here](https://github.com/rust-lang/rust/issues/57274#issuecomment-624839355)
   TLDR: it's cleaner. Rust's warning system wasn't built to be filtered or edited by cargo.
   Even a basic implementation of the feature would have to change the "n warnings emitted" line that rustc prints at the end.
   Cargo ideally wants to synthesize its own warnings anyways. For example, it would be hard for rustc to emit warnings like
   "dependency foo is only used by dev targets", suggesting to make it a dev-dependency instead.

### Q: Make rustc emit used or unused externs?
A: Emitting used externs has the advantage that it simplifies cargo's collection job.
   However, emitting unused externs creates less data to be communicated between rustc and cargo.
   Often you want to paste a cargo command obtained from `cargo build -vv` for doing something
   completely unrelated. The message is emitted always, even if no warning or error is emitted.
   At that point, even this tiny difference in "noise" matters. That's why I went with emitting unused externs.

### Q: One json msg per extern or a collective json msg?
A: Same as above, the data format should be concise. Having 30 lines for the 30 crates a crate uses would be disturbing to readers.
   Also it helps the cargo implementation to know that there aren't more unused deps coming.

### Q: Why use names of externs instead of e.g. paths?
A: Names are both sufficient as well as neccessary to uniquely identify a passed `--extern` arg.
   Names are sufficient because you *must* pass a name when passing an `--extern` arg.
   Passing a path is optional on the other hand so rustc might also figure out a crate's location from the file system.
   You can also put multiple paths for the same extern name, via e.g. `--extern hello=/usr/lib/hello.rmeta --extern hello=/usr/local/lib/hello.rmeta`,
   but rustc will only ever use one of those paths.
   Also, paths don't identify a dependency uniquely as it is possible to have multiple different extern names point to the same path.
   So paths are ill-suited for identification.

### Q: What about 2015 edition crates?
A: They are fully supported.
   Even on the 2015 edition, an explicit `--extern` flag is is required to enable `extern crate foo;` to work (outside of sysroot crates, which this flag doesn't warn about anyways).
   So the lint would still fire on 2015 edition crates if you haven't included a dependency specified in Cargo.toml using `extern crate foo;` or similar.
   The lint won't fire if your sole use in the crate is through a `extern crate foo;`   statement, but that's not its job.
   For detecting unused `extern crate foo` statements, there is the `unused_extern_crates` lint
   which can be enabled by `#![warn(unused_extern_crates)]` or similar.

cc ```@jsgf``` ```@ehuss``` ```@petrochenkov``` ```@estebank```

3 years agoBump bootstrap compiler
Mark Rousskov [Fri, 26 Mar 2021 15:25:48 +0000 (11:25 -0400)]
Bump bootstrap compiler

3 years agowasm64
Gus Caplan [Wed, 30 Dec 2020 18:52:21 +0000 (12:52 -0600)]
wasm64

3 years agoAuto merge of #83451 - GuillaumeGomez:fix-error-code-tidy-check, r=Mark-Simulacrum
bors [Sun, 4 Apr 2021 15:34:01 +0000 (15:34 +0000)]
Auto merge of #83451 - GuillaumeGomez:fix-error-code-tidy-check, r=Mark-Simulacrum

Fix error codes check run and ensure it will not go unnoticed again

Fixes #83268.

The error codes explanations were not checked anymore. I fixed this issue and also added variables to ensure that this won't happen again (at least not silently).

3 years agoresolve: Stable order for derive helper attributes
Vadim Petrochenkov [Sun, 4 Apr 2021 14:51:31 +0000 (17:51 +0300)]
resolve: Stable order for derive helper attributes

3 years agoresolve/expand: Cache intermediate results of `#[derive]` expansion
Vadim Petrochenkov [Mon, 8 Mar 2021 12:05:03 +0000 (15:05 +0300)]
resolve/expand: Cache intermediate results of `#[derive]` expansion

3 years agoFix error codes check run and ensure it will not go unnoticed again
Guillaume Gomez [Wed, 24 Mar 2021 20:42:04 +0000 (21:42 +0100)]
Fix error codes check run and ensure it will not go unnoticed again

3 years agoAuto merge of #83839 - ldm0:deref, r=petrochenkov
bors [Sun, 4 Apr 2021 11:15:17 +0000 (11:15 +0000)]
Auto merge of #83839 - ldm0:deref, r=petrochenkov

Remove unneeded type resolving

small optimization.

3 years agoUpdate clobber example in the asm documentation
Amanieu d'Antras [Sun, 4 Apr 2021 09:49:44 +0000 (10:49 +0100)]
Update clobber example in the asm documentation

3 years agoAllow clobbering unsupported registers in asm!
Amanieu d'Antras [Sun, 4 Apr 2021 07:09:56 +0000 (08:09 +0100)]
Allow clobbering unsupported registers in asm!

Previously registers could only be marked as clobbered if the target feature for that register was enabled. This restriction is now removed.

3 years agorely on intra-doc links
Ralf Jung [Sun, 4 Apr 2021 09:24:25 +0000 (11:24 +0200)]
rely on intra-doc links

Co-authored-by: Yuki Okushi <jtitor@2k36.org>
3 years agoAuto merge of #82347 - the8472:parallelize-tidy, r=Mark-Simulacrum
bors [Sun, 4 Apr 2021 08:34:12 +0000 (08:34 +0000)]
Auto merge of #82347 - the8472:parallelize-tidy, r=Mark-Simulacrum

Parallelize tidy

Split off from #81833

While that PR brings wall time of `x.py test tidy` down to 0m2.847s adding this one on top should bring it down to 0m1.673s.

r? `@Mark-Simulacrum`

Previous concerns can be found at https://github.com/rust-lang/rust/pull/81833#issuecomment-782754685 and https://github.com/rust-lang/rust/pull/81833#discussion_r575194633

3 years agoAuto merge of #83267 - ssomers:btree_prune_range_search_overlap, r=Mark-Simulacrum
bors [Sun, 4 Apr 2021 05:52:43 +0000 (05:52 +0000)]
Auto merge of #83267 - ssomers:btree_prune_range_search_overlap, r=Mark-Simulacrum

BTree: no longer search arrays twice to check Ord

A possible addition to / partial replacement of #83147: no longer linearly search the upper bound of a range in the initial portion of the keys we already know are below the lower bound.
- Should be faster: fewer key comparisons at the cost of some instructions dealing with offsets
- Makes code a little more complicated.
- No longer detects ill-defined `Ord` implementations, but that wasn't a publicised feature, and was quite incomplete, and was only done in the `range` and `range_mut` methods.
r? `@Mark-Simulacrum`

3 years agoperform filesystem probe once before running bins checks concurrently
The8472 [Sun, 21 Feb 2021 11:08:04 +0000 (12:08 +0100)]
perform filesystem probe once before running bins checks concurrently

this avoids concurrent write attempts to the output directory

3 years agoAuto merge of #83529 - richkadel:demangler, r=tmandry
bors [Sun, 4 Apr 2021 02:30:18 +0000 (02:30 +0000)]
Auto merge of #83529 - richkadel:demangler, r=tmandry

Make rust-demangler installable

Adds bootstrap rules to support installing rust-demangler, as an optional, in-tree `extended` tool. It can be included by updating `config.toml`, setting `extended = true`, and then either (a) adding `"rust-demangler"` to the `tools` array, or by enabling `profiler = true`. In other words, it is a _default_ `extended` tool if `profiler = true`.

When compiling with `-Z instrument-coverage`, the coverage reports are
generated by `llvm-cov`. `llvm-cov` includes a built-in demangler for
C++, and an option to supply an alternate demangler. For Rust, we have
`rust-demangler`, currently used in `rustc` coverage tests.

Fuchsia's toolchain for Rust is built via `./x.py install`. Fuchsia is
adding support for Rust coverage, and we need to include the
`rust-demangler` in the installed `bin` directory.

r? `@tmandry`

3 years agoAddress review comments and Windows failure, and make cleaner
Rich Kadel [Sun, 4 Apr 2021 00:47:32 +0000 (17:47 -0700)]
Address review comments and Windows failure, and make cleaner

3 years agoAdd `#[inline]` to IpAddr methods
AngelicosPhosphoros [Sat, 3 Apr 2021 23:42:56 +0000 (02:42 +0300)]
Add `#[inline]` to IpAddr methods

Add some inlines to trivial methods of IpAddr
Closes https://github.com/rust-lang/rust/issues/77583

3 years agosuggestion from review
the8472 [Sat, 3 Apr 2021 23:38:58 +0000 (01:38 +0200)]
suggestion from review

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agocleanup leak after test to make miri happy
The8472 [Fri, 2 Apr 2021 21:06:05 +0000 (23:06 +0200)]
cleanup leak after test to make miri happy

3 years agoAuto merge of #83811 - JohnTitor:rollup-hnw1xwz, r=JohnTitor
bors [Sat, 3 Apr 2021 23:17:58 +0000 (23:17 +0000)]
Auto merge of #83811 - JohnTitor:rollup-hnw1xwz, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #82487 (Constify methods of `std::net::SocketAddr`, `SocketAddrV4` and `SocketAddrV6`)
 - #83756 (rustdoc: Rename internal uses of `spotlight`)
 - #83780 (Document "standard" conventions for error messages)
 - #83787 (Monomorphization doc fix)
 - #83803 (add fp-armv8 for ARM_ALLOWED_FEATURES)
 - #83804 (Remove nightly features in rustc_type_ir)
 - #83810 (Fix rustc_lint_defs documentation typo)

Failed merges:

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

3 years agoRemove unneeded INITIAL_IDS const
Guillaume Gomez [Sat, 3 Apr 2021 13:14:23 +0000 (15:14 +0200)]
Remove unneeded INITIAL_IDS const

3 years agoRemove trailing whitespace
SlightlyOutOfPhase [Sat, 3 Apr 2021 21:00:07 +0000 (17:00 -0400)]
Remove trailing whitespace

3 years agoAuto merge of #81507 - weiznich:add_diesel_to_cargo_test, r=Mark-Simulacrum
bors [Sat, 3 Apr 2021 20:48:25 +0000 (20:48 +0000)]
Auto merge of #81507 - weiznich:add_diesel_to_cargo_test, r=Mark-Simulacrum

Adding diesel to the cargotest suite

As discussed in https://github.com/rust-lang/rust/issues/79560#issuecomment-767542364 this adds diesel to the compilers test suite. This is basically a reopened version of #79599, but now with the backing of the compiler team.

r? `@pnkfelix`

3 years agoList trait impls before methods from deref in the sidebar of Rustdoc's output
SlightlyOutOfPhase [Sat, 3 Apr 2021 20:32:59 +0000 (16:32 -0400)]
List trait impls before methods from deref in the sidebar of Rustdoc's output

3 years agoRemove redundant `ignore-tidy-linelength` annotations
Simon Jakobi [Sat, 3 Apr 2021 11:05:11 +0000 (13:05 +0200)]
Remove redundant `ignore-tidy-linelength` annotations

This is step 2 towards fixing #77548.

In the codegen and codegen-units test suites, the `//` comment markers
were kept in order not to affect any source locations. This is because
these tests cannot be automatically `--bless`ed.

3 years agoChanged function signature to keep buffer handling out of lib
Rich Kadel [Mon, 29 Mar 2021 15:28:52 +0000 (08:28 -0700)]
Changed function signature to keep buffer handling out of lib

3 years agoMake rust-demangler installable
Rich Kadel [Fri, 26 Mar 2021 20:02:46 +0000 (13:02 -0700)]
Make rust-demangler installable

Adds bootstrap rules to support installing rust-demangler.

When compiling with `-Z instrument-coverage`, the coverage reports are
generated by `llvm-cov`. `llvm-cov` includes a built-in demangler for
C++, and an option to supply an alternate demangler. For Rust, we have
`rust-demangler`, currently used in `rustc` coverage tests.

Fuchsia's toolchain for Rust is built via `./x.py install`. Fuchsia is
adding support for Rust coverage, and we need to include the
`rust-demangler` in the installed `bin` directory.

Configured rust-demangler as an in-tree extended tool.

Added tests to support `./x.py test rust-demangler`.

Install with extended tools by default only if `profiler = true`.

3 years agoRemove attribute `#[link_args]`
Vadim Petrochenkov [Sat, 3 Apr 2021 17:20:18 +0000 (20:20 +0300)]
Remove attribute `#[link_args]`

3 years agoOptimize out unneeded type resolving
liudingming [Sat, 3 Apr 2021 17:40:47 +0000 (01:40 +0800)]
Optimize out unneeded type resolving

3 years agoexplain that even addr_of cannot deref a NULL ptr
Ralf Jung [Sat, 3 Apr 2021 17:26:54 +0000 (19:26 +0200)]
explain that even addr_of cannot deref a NULL ptr

3 years agoaddr_of_mut: add example for creating a pointer to uninit data
Ralf Jung [Sat, 3 Apr 2021 17:25:11 +0000 (19:25 +0200)]
addr_of_mut: add example for creating a pointer to uninit data

3 years agoMove log's short part to first
liudingming [Sat, 3 Apr 2021 16:05:17 +0000 (00:05 +0800)]
Move log's short part to first

3 years agoRollup merge of #83810 - benmezger:update-builtin-docs-typo, r=jonas-schievink
Yuki Okushi [Sat, 3 Apr 2021 15:19:41 +0000 (00:19 +0900)]
Rollup merge of #83810 - benmezger:update-builtin-docs-typo, r=jonas-schievink

Fix rustc_lint_defs documentation typo

Found a typo while reading the documentation. This PR fixes it.

3 years agoRollup merge of #83804 - detrumi:build-type-ir-on-stable, r=petrochenkov
Yuki Okushi [Sat, 3 Apr 2021 15:19:40 +0000 (00:19 +0900)]
Rollup merge of #83804 - detrumi:build-type-ir-on-stable, r=petrochenkov

Remove nightly features in rustc_type_ir

`rustc_type_ir` will be used as a type library by Chalk, which we want to be able to build on stable, so this PR removes the current nightly features used.

3 years agoRollup merge of #83803 - surechen:add_target_feature, r=petrochenkov
Yuki Okushi [Sat, 3 Apr 2021 15:19:39 +0000 (00:19 +0900)]
Rollup merge of #83803 - surechen:add_target_feature, r=petrochenkov

add fp-armv8 for ARM_ALLOWED_FEATURES

For fixing err in https://github.com/rust-lang/stdarch/pull/1105.

3 years agoRollup merge of #83787 - digama0:patch-1, r=bjorn3
Yuki Okushi [Sat, 3 Apr 2021 15:19:38 +0000 (00:19 +0900)]
Rollup merge of #83787 - digama0:patch-1, r=bjorn3

Monomorphization doc fix

Only public items are monomorphization roots. This can be confirmed by noting that this program compiles:
```rust
fn foo<T>() { if true { foo::<Option<T>>() } }
fn bar() { foo::<()>() }
```
See also the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Why.20are.20non.20public.20items.20monomorphization.20roots.3F).

3 years agoRollup merge of #83780 - matklad:doc-error-message, r=JohnTitor
Yuki Okushi [Sat, 3 Apr 2021 15:19:37 +0000 (00:19 +0900)]
Rollup merge of #83780 - matklad:doc-error-message, r=JohnTitor

Document "standard" conventions for error messages

These are currently documented in the API guidelines:

https://rust-lang.github.io/api-guidelines/interoperability.html#error-types-are-meaningful-and-well-behaved-c-good-err

I think it makes sense to uplift this guideline (in a milder form) into
std docs. Printing and producing errors is something that even
non-expert users do frequently, so it is useful to give at least some
indication of what a typical error message looks like.

3 years agoRollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomez
Yuki Okushi [Sat, 3 Apr 2021 15:19:36 +0000 (00:19 +0900)]
Rollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomez

rustdoc: Rename internal uses of `spotlight`

I didn't make these renames in #80965 because I didn't want the PR to
conflict with #80914.

3 years agoRollup merge of #82487 - CDirkx:const-socketaddr, r=m-ou-se
Yuki Okushi [Sat, 3 Apr 2021 15:19:30 +0000 (00:19 +0900)]
Rollup merge of #82487 - CDirkx:const-socketaddr, r=m-ou-se

Constify methods of `std::net::SocketAddr`, `SocketAddrV4` and `SocketAddrV6`

The following methods are made unstable const under the `const_socketaddr` feature (https://github.com/rust-lang/rust/issues/82485):

```rust
// std::net

impl SocketAddr {
    pub const fn ip(&self) -> IpAddr;
    pub const fn port(&self) -> u16;
    pub const fn is_ipv4(&self) -> bool;
    pub const fn is_ipv6(&self) -> bool;
}

impl SocketAddrV4 {
    pub const fn ip(&self) -> IpAddr;
    pub const fn port(&self) -> u16;
}

impl SocketAddrV6 {
    pub const fn ip(&self) -> IpAddr;
    pub const fn port(&self) -> u16;
    pub const fn flowinfo(&self) -> u32;
    pub const fn scope_id(&self) -> u32;
}
```

Note: `SocketAddrV4::ip` and `SocketAddrV6::ip` use pointer casting and depend on the unstable feature `const_raw_ptr_deref`

3 years agoFix rustc_lint_defs documentation typo
Ben Mezger [Sat, 3 Apr 2021 15:00:28 +0000 (12:00 -0300)]
Fix rustc_lint_defs documentation typo

3 years agoAuto merge of #83682 - bjorn3:mmap_wrapper, r=cjgillot
bors [Sat, 3 Apr 2021 13:23:42 +0000 (13:23 +0000)]
Auto merge of #83682 - bjorn3:mmap_wrapper, r=cjgillot

Add an Mmap wrapper to rustc_data_structures

This wrapper implements StableAddress and falls back to directly reading the file on wasm32.

Taken from #83640, which I will close due to the perf regression.

3 years agoAdd safety comment to StableAddress impl for Mmap
bjorn3 [Sat, 3 Apr 2021 12:51:05 +0000 (14:51 +0200)]
Add safety comment to StableAddress impl for Mmap

3 years agoAdd fixme comment to revert change once const_panic is stable
Wilco Kusee [Sat, 3 Apr 2021 11:07:03 +0000 (13:07 +0200)]
Add fixme comment to revert change once const_panic is stable

3 years agoAuto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkov
bors [Sat, 3 Apr 2021 10:59:24 +0000 (10:59 +0000)]
Auto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkov

rustdoc: Don't load all extern crates unconditionally

Instead, only load the crates that are linked to with intra-doc links.

This doesn't help very much with any of rustdoc's fundamental issues
with freezing the resolver, but it at least fixes a stable-to-stable
regression, and makes the crate loading model somewhat more consistent
with rustc's. I tested and it unfortunately does not help at all with https://github.com/rust-lang/rust/pull/82496.

Closes https://github.com/rust-lang/rust/issues/68427. Let me know if you want me to open a separate issue for not freezing the resolver.
r? `@petrochenkov` cc `@eddyb` `@ollie27`