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

3 years agoAuto merge of #83549 - sjakobi:no-tidy-line-length-1, r=Mark-Simulacrum
bors [Sat, 3 Apr 2021 08:46:03 +0000 (08:46 +0000)]
Auto merge of #83549 - sjakobi:no-tidy-line-length-1, r=Mark-Simulacrum

tidy: Add ignore-rules for the line length check

This is step 1 towards fixing https://github.com/rust-lang/rust/issues/77548.

This PR contains the `tidy` change from https://github.com/rust-lang/rust/pull/77675. The "ignoring file length unnecessarily" check is temporarily disabled to simplify landing the ignore-rules. This check will be re-enabled in a follow-up PR.

3 years agoRemove nightly features in rustc_type_ir
Wilco Kusee [Sat, 3 Apr 2021 08:00:09 +0000 (10:00 +0200)]
Remove nightly features in rustc_type_ir

3 years agoadd fp-armv8 for ARM_ALLOWED_FEATURES
surechen [Sat, 3 Apr 2021 07:50:59 +0000 (15:50 +0800)]
add fp-armv8 for ARM_ALLOWED_FEATURES

3 years agotidy: Add ignore-rules for the line length check
Anthony Huang [Thu, 15 Oct 2020 04:29:47 +0000 (21:29 -0700)]
tidy: Add ignore-rules for the line length check

This is step 1 towards fixing #77548.

This commit includes the tidy change from #77675.
The "ignoring file length unnecessarily" check is temporarily
disabled to simplify landing the ignore-rules.
That check will be re-enabled in a follow-up PR.

3 years agoAuto merge of #83774 - richkadel:zero-based-counters, r=tmandry
bors [Sat, 3 Apr 2021 06:27:03 +0000 (06:27 +0000)]
Auto merge of #83774 - richkadel:zero-based-counters, r=tmandry

Translate counters from Rust 1-based to LLVM 0-based counter ids

A colleague contacted me and asked why Rust's counters start at 1, when
Clangs appear to start at 0. There is a reason why Rust's internal
counters start at 1 (see the docs), and I tried to keep them consistent
when codegenned to LLVM's coverage mapping format. LLVM should be
tolerant of missing counters, but as my colleague pointed out,
`llvm-cov` will silently fail to generate a coverage report for a
function based on LLVM's assumption that the counters are 0-based.

See:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp#L170

Apparently, if, for example, a function has no branches, it would have
exactly 1 counter. `CounterValues.size()` would be 1, and (with the
1-based index), the counter ID would be 1. This would fail the check
and abort reporting coverage for the function.

It turns out that by correcting for this during coverage map generation,
by subtracting 1 from the Rust Counter ID (both when generating the
counter increment intrinsic call, and when adding counters to the map),
some uncovered functions (including in tests) now appear covered! This
corrects the coverage for a few tests!

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

3 years agoAuto merge of #83599 - jyn514:unorderable, r=Aaron1011
bors [Sat, 3 Apr 2021 04:11:35 +0000 (04:11 +0000)]
Auto merge of #83599 - jyn514:unorderable, r=Aaron1011

Avoid sorting by DefId for `necessary_variants()`

Follow-up to https://github.com/rust-lang/rust/pull/83074. Originally I tried removing `impl Ord for DefId` but that hit *lots* of errors :sweat_smile: so I thought I would start with easy things.

I am not sure whether this could actually cause invalid query results, but this is used from `MarkSymbolVisitor::visit_arm` so it's at least feasible.

r? `@Aaron1011`

3 years agoAuto merge of #83506 - asomers:backtrace-0.3.56, r=Mark-Simulacrum
bors [Sat, 3 Apr 2021 01:52:36 +0000 (01:52 +0000)]
Auto merge of #83506 - asomers:backtrace-0.3.56, r=Mark-Simulacrum

Update backtrace to 0.3.56

Fixes #78184

3 years agorustdoc: update macro highlight tests
Michael Howell [Sat, 3 Apr 2021 00:46:12 +0000 (17:46 -0700)]
rustdoc: update macro highlight tests

3 years agoTranslate counters from Rust 1-based to LLVM 0-based counter ids
Rich Kadel [Fri, 2 Apr 2021 07:08:48 +0000 (00:08 -0700)]
Translate counters from Rust 1-based to LLVM 0-based counter ids

A colleague contacted me and asked why Rust's counters start at 1, when
Clangs appear to start at 0. There is a reason why Rust's internal
counters start at 1 (see the docs), and I tried to keep them consistent
when codegenned to LLVM's coverage mapping format. LLVM should be
tolerant of missing counters, but as my colleague pointed out,
`llvm-cov` will silently fail to generate a coverage report for a
function based on LLVM's assumption that the counters are 0-based.

See:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp#L170

Apparently, if, for example, a function has no branches, it would have
exactly 1 counter. `CounterValues.size()` would be 1, and (with the
1-based index), the counter ID would be 1. This would fail the check
and abort reporting coverage for the function.

It turns out that by correcting for this during coverage map generation,
by subtracting 1 from the Rust Counter ID (both when generating the
counter increment intrinsic call, and when adding counters to the map),
some uncovered functions (including in tests) now appear covered! This
corrects the coverage for a few tests!

3 years agoAuto merge of #81866 - nagisa:nagisa/sanitizer-support-target-prop, r=tmiasko
bors [Fri, 2 Apr 2021 23:33:01 +0000 (23:33 +0000)]
Auto merge of #81866 - nagisa:nagisa/sanitizer-support-target-prop, r=tmiasko

Maintain supported sanitizers as a target property

In an effort to remove a hard-coded allow-list for target-sanitizer support correspondence, this PR moves the configuration to the target options.

Perhaps the one notable change made in this PR is this doc-comment:

```rust
    /// The sanitizers supported by this target
    ///
    /// Note that the support here is at a codegen level. If the machine code with sanitizer
    /// enabled can generated on this target, but the necessary supporting libraries are not
    /// distributed with the target, the sanitizer should still appear in this list for the target.
```

Previously the target would typically be added to the allow-list at the same time as the supporting runtime libraries are shipped for the target. However whether we ship the runtime libraries or not needn't be baked into the compiler; and if we don't users will receive a significantly more directed error about library not being found.

Fixes #81802

3 years agofix clippy error
Roxane [Tue, 30 Mar 2021 04:30:20 +0000 (00:30 -0400)]
fix clippy error

3 years agoReduce size of statements
Roxane [Tue, 30 Mar 2021 02:48:44 +0000 (22:48 -0400)]
Reduce size of statements

3 years agoFix diagnostic issue when using FakeReads in closures
Roxane [Fri, 26 Mar 2021 03:03:12 +0000 (23:03 -0400)]
Fix diagnostic issue when using FakeReads in closures

3 years agorm target specific logic in link_sanitizer_runtime
Simonas Kazlauskas [Mon, 15 Feb 2021 01:17:50 +0000 (03:17 +0200)]
rm target specific logic in link_sanitizer_runtime

3 years ago(De-)serialize the supported_sanitizers
Simonas Kazlauskas [Sat, 13 Feb 2021 20:00:07 +0000 (22:00 +0200)]
(De-)serialize the supported_sanitizers

3 years agoMaintain supported sanitizers as a target property
Simonas Kazlauskas [Sun, 7 Feb 2021 22:49:00 +0000 (00:49 +0200)]
Maintain supported sanitizers as a target property

This commit adds an additional target property – `supported_sanitizers`,
and replaces the hardcoded allowlists in argument parsing to use this
new property.

Fixes #81802

3 years agoMove SanitizerSet to rustc_target
Simonas Kazlauskas [Sun, 7 Feb 2021 21:47:03 +0000 (23:47 +0200)]
Move SanitizerSet to rustc_target

3 years agoDon't load all extern crates unconditionally
Joshua Nelson [Thu, 1 Apr 2021 02:33:07 +0000 (22:33 -0400)]
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.

3 years agorustdoc: highlight macros more efficiently
Michael Howell [Mon, 15 Mar 2021 22:44:07 +0000 (15:44 -0700)]
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 agoAuto merge of #83790 - Dylan-DPC:rollup-p6ep8jo, r=Dylan-DPC
bors [Fri, 2 Apr 2021 20:06:11 +0000 (20:06 +0000)]
Auto merge of #83790 - Dylan-DPC:rollup-p6ep8jo, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #83065 (Rework `std::sys::windows::alloc`)
 - #83478 (rustdoc: Add unstable option to only emit shared/crate-specific files)
 - #83629 (Fix double-drop in `Vec::from_iter(vec.into_iter())` specialization when items drop during panic)
 - #83673 (give full path of constraint in suggest_constraining_type_param)
 - #83755 (Simplify coverage tests)
 - #83757 (2229: Support migration via rustfix)
 - #83771 (Fix stack overflow detection on FreeBSD 11.1+)

Failed merges:

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

3 years agorustdoc: Remove unused `spotlight` CSS
Camelid [Thu, 1 Apr 2021 20:31:55 +0000 (13:31 -0700)]
rustdoc: Remove unused `spotlight` CSS

I couldn't find any uses of this CSS. I think it was superseded by the
`.notable-traits` CSS class and other similarly-named CSS classes.

3 years agorustdoc: Rename internal uses of `spotlight`
Camelid [Thu, 1 Apr 2021 20:26:29 +0000 (13:26 -0700)]
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 #83771 - asomers:stack_overflow_freebsd, r=dtolnay
Dylan DPC [Fri, 2 Apr 2021 17:57:35 +0000 (19:57 +0200)]
Rollup merge of #83771 - asomers:stack_overflow_freebsd, r=dtolnay

Fix stack overflow detection on FreeBSD 11.1+

Beginning with FreeBSD 10.4 and 11.1, there is one guard page by
default.  And the stack autoresizes, so if Rust allocates its own guard
page, then FreeBSD's will simply move up one page.  The best solution is
to just use the OS's guard page.

3 years agoRollup merge of #83757 - sexxi-goose:migrations_out, r=nikomatsakis
Dylan DPC [Fri, 2 Apr 2021 17:57:34 +0000 (19:57 +0200)]
Rollup merge of #83757 - sexxi-goose:migrations_out, r=nikomatsakis

2229: Support migration via rustfix

- Adds support of machine applicable suggestions for `disjoint_capture_drop_reorder`.
- Doesn't migrate in the case of pre-existing bugs in user code

r? ``@nikomatsakis``

3 years agoRollup merge of #83755 - richkadel:cov-test-simplify, r=tmandry
Dylan DPC [Fri, 2 Apr 2021 17:57:33 +0000 (19:57 +0200)]
Rollup merge of #83755 - richkadel:cov-test-simplify, r=tmandry

Simplify coverage tests

This change reduces the risk of impacting coverage tests on unrelated
changes (such as MIR and Span changes), and reduces the burden when
blessing coverage changes in case it is necessary.

* Remove all spanview tests. The spanview tests were useful during
  development, but they can be generated as needed, via compiler command
  line flags. They aren't critical to confirming coverage results. (The
  coverage report tests are sufficient.)

  When spanview regeneration was necessary, the diffs were way too hard
  to read to be useful anyway. So I'm removing them to reduce friction
  from a feature that is no longer useful.

* Remove the requirement for `llvm-cov show --debug` when blessing
  tests. The `--debug` flag is, unfortunately, only available if LLVM is
  built with `optimize = false` (in Rust's config.toml). This adds
  significant time and resource burdens to the contributor's build. As
  it turns out, for other reasons in the past, I wasn't actually using
  the debug output (counter info) to validate coverage anymore either,
  so it was required for no reason, I now realize.

3 years agoRollup merge of #83673 - hi-rustin:rustin-patch-suggestion, r=estebank
Dylan DPC [Fri, 2 Apr 2021 17:57:32 +0000 (19:57 +0200)]
Rollup merge of #83673 - hi-rustin:rustin-patch-suggestion, r=estebank

give full path of constraint in suggest_constraining_type_param

close https://github.com/rust-lang/rust/issues/83513

3 years agoRollup merge of #83629 - the8472:fix-inplace-panic-on-drop, r=m-ou-se
Dylan DPC [Fri, 2 Apr 2021 17:57:31 +0000 (19:57 +0200)]
Rollup merge of #83629 - the8472:fix-inplace-panic-on-drop, r=m-ou-se

Fix double-drop in `Vec::from_iter(vec.into_iter())` specialization when items drop during panic

This fixes the double-drop but it leaves a behavioral difference compared to the default implementation intact: In the default implementation the source and the destination vec are separate objects, so they get dropped separately. Here they share an allocation and the latter only exists as a pointer into the former. So if dropping the former panics then this fix will leak more items than the default implementation would. Is this acceptable or should the specialization also mimic the default implementation's drops-during-panic behavior?

Fixes #83618

`@rustbot` label T-libs-impl

3 years agoRollup merge of #83478 - jyn514:fine-grained-files, r=Mark-Simulacrum
Dylan DPC [Fri, 2 Apr 2021 17:57:30 +0000 (19:57 +0200)]
Rollup merge of #83478 - jyn514:fine-grained-files, r=Mark-Simulacrum

rustdoc: Add unstable option to only emit shared/crate-specific files

The intended use case is for docs.rs, which can now copy exactly the
files it cares about, rather than having to guess based on whether they
have a resource suffix or not. In particular, some files have a resource
suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688

The end goal is to fix rust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324.

This obsoletes `--print=unversioned-files`, which I plan to remove as
soon as docs.rs stops using it.

I recommend reviewing this one commit at a time.

r? ``@GuillaumeGomez`` cc ``@Nemo157`` ``@pietroalbini``

3 years agoRollup merge of #83065 - CDirkx:win-alloc, r=dtolnay
Dylan DPC [Fri, 2 Apr 2021 17:57:28 +0000 (19:57 +0200)]
Rollup merge of #83065 - CDirkx:win-alloc, r=dtolnay

Rework `std::sys::windows::alloc`

I came across https://github.com/rust-lang/rust/pull/76676#discussion_r488729990, which points out that there was unsound code in the Windows alloc code, creating a &mut to possibly uninitialized memory. I reworked the code so that that particular issue does not occur anymore, and started adding more documentation and safety comments.

Full list of changes:
 - moved and documented the relevant Windows Heap API functions
 - refactor `allocate_with_flags` to `allocate` (and remove the other helper functions), which now takes just a `bool` if the memory should be zeroed
 - add checks for if `GetProcessHeap` returned null
 - add a test that checks if the size and alignment of a `Header` are indeed <= `MIN_ALIGN`
 - add `#![deny(unsafe_op_in_unsafe_fn)]` and the necessary unsafe blocks with safety comments

I feel like I may have overdone the documenting, the unsoundness fix is the most important part; I could spit this PR up in separate parts.

3 years agoAuto merge of #76881 - hameerabbasi:issue-53325, r=oli-obk
bors [Fri, 2 Apr 2021 17:38:57 +0000 (17:38 +0000)]
Auto merge of #76881 - hameerabbasi:issue-53325, r=oli-obk

Add allocation information to undefined behaviour errors.

So far I'm looking on information on whether the error messages are suitable.

Fixes #53325.