]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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 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 agoOptimize out unneeded type resolving
liudingming [Sat, 3 Apr 2021 17:40:47 +0000 (01:40 +0800)]
Optimize out unneeded type resolving

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.

3 years agofix
Mario Carneiro [Fri, 2 Apr 2021 17:21:23 +0000 (10:21 -0700)]
fix

3 years agoclarify wording
Mario Carneiro [Fri, 2 Apr 2021 16:55:23 +0000 (09:55 -0700)]
clarify wording

3 years agoMonomorphization doc fix
Mario Carneiro [Fri, 2 Apr 2021 16:33:34 +0000 (09:33 -0700)]
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::<()>() }
```

3 years agoRemove `debug_assert`
Christiaan Dirkx [Fri, 2 Apr 2021 15:50:23 +0000 (17:50 +0200)]
Remove `debug_assert`

3 years agoIntroduce `get_process_heap` and fix atomic ordering.
Christiaan Dirkx [Fri, 2 Apr 2021 15:37:52 +0000 (17:37 +0200)]
Introduce `get_process_heap` and fix atomic ordering.

3 years agoAuto merge of #83468 - hi-rustin:rustin-patch-lint, r=nikomatsakis
bors [Fri, 2 Apr 2021 15:14:48 +0000 (15:14 +0000)]
Auto merge of #83468 - hi-rustin:rustin-patch-lint, r=nikomatsakis

add OR_PATTERNS_BACK_COMPAT lint

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

3 years agoAuto merge of #83781 - JohnTitor:rollup-1vm3dxo, r=JohnTitor
bors [Fri, 2 Apr 2021 12:51:41 +0000 (12:51 +0000)]
Auto merge of #83781 - JohnTitor:rollup-1vm3dxo, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #83535 (Break when there is a mismatch in the type count)
 - #83721 (Add a button to copy the "use statement")
 - #83740 (Fix comment typo in once.rs)
 - #83745 (Add my new email address to .mailmap)
 - #83754 (Add test to ensure search tabs behaviour)

Failed merges:

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

3 years agoRollup merge of #83754 - GuillaumeGomez:search-tab-behaviour, r=jyn514
Yuki Okushi [Fri, 2 Apr 2021 12:28:25 +0000 (21:28 +0900)]
Rollup merge of #83754 - GuillaumeGomez:search-tab-behaviour, r=jyn514

Add test to ensure search tabs behaviour

It adds a GUI test for https://github.com/rust-lang/rust/pull/80382.

r? ```@jyn514```

3 years agoRollup merge of #83745 - JohnTitor:jtitor-mailmap, r=Mark-Simulacrum
Yuki Okushi [Fri, 2 Apr 2021 12:28:24 +0000 (21:28 +0900)]
Rollup merge of #83745 - JohnTitor:jtitor-mailmap, r=Mark-Simulacrum

Add my new email address to .mailmap

3 years agoRollup merge of #83740 - obi1kenobi:patch-1, r=joshtriplett
Yuki Okushi [Fri, 2 Apr 2021 12:28:23 +0000 (21:28 +0900)]
Rollup merge of #83740 - obi1kenobi:patch-1, r=joshtriplett

Fix comment typo in once.rs

I believe I came across a minor typo in a comment. I am not particularly familiar with this part of the codebase, but I have read the surrounding code as well as the referenced `park` and `unpark` functions, and I believe my proposed change is true to the intended meaning of the comment.

I intentionally tried to keep the change as minimal as possible. If I have the maintainers' permission, I'd also love to add a comma to improve readability as follows: `Luckily ``park`` comes with the guarantee that if it got an ``unpark`` just before on an unparked thread, it does not park.`

3 years agoRollup merge of #83721 - GuillaumeGomez:copy-use, r=Nemo157
Yuki Okushi [Fri, 2 Apr 2021 12:28:21 +0000 (21:28 +0900)]
Rollup merge of #83721 - GuillaumeGomez:copy-use, r=Nemo157

Add a button to copy the "use statement"

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

When clicking on the button, it'll add the elements prepended by "use " and will end with a ";". So in the images below, I now have in my clipboard `use std::fs::OpenOptions;`.

A screenshot of the newly added button:

![Screenshot from 2021-03-31 22-12-12](https://user-images.githubusercontent.com/3050060/113205430-90e64500-926e-11eb-8538-529829f611ec.png)

A screenshot after it was clicked:

![Screenshot from 2021-03-31 22-15-31](https://user-images.githubusercontent.com/3050060/113205532-ad827d00-926e-11eb-893d-35f2f8f92696.png)

r? `@Nemo157`

3 years agoRollup merge of #83535 - MidasLamb:mir-type-count-mismatch, r=nikomatsakis
Yuki Okushi [Fri, 2 Apr 2021 12:28:20 +0000 (21:28 +0900)]
Rollup merge of #83535 - MidasLamb:mir-type-count-mismatch, r=nikomatsakis

Break when there is a mismatch in the type count

When other errors are generated, there can be a mismatch between the
amount of input types in MIR, and the amount in the function itself.
Break from the comparative loop if this is the case to prevent
out-of-bounds.
Fixes #83499

3 years agoDocument "standard" conventions for error messages
Aleksey Kladov [Fri, 2 Apr 2021 12:11:49 +0000 (15:11 +0300)]
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 agoAuto merge of #83207 - oli-obk:valtree2, r=lcnr
bors [Fri, 2 Apr 2021 10:28:12 +0000 (10:28 +0000)]
Auto merge of #83207 - oli-obk:valtree2, r=lcnr

normalize mir::Constant differently from ty::Const in preparation for valtrees

Valtrees are unable to represent many kind of constant values (this is on purpose). For constants that are used at runtime, we do not need a valtree representation and can thus use a different form of evaluation. In order to make this explicit and less fragile, I added a `fold_constant` method to `TypeFolder` and implemented it for normalization. Normalization can now, when it wants to eagerly evaluate a constant, normalize `mir::Constant` directly into a `mir::ConstantKind::Val` instead of relying on the `ty::Const` evaluation.

In the future we can get rid of the `ty::Const` in there entirely and add our own `Unevaluated` variant to `mir::ConstantKind`. This would allow us to remove the `promoted` field from `ty::ConstKind::Unevaluated`, as promoteds can never occur in the type system.

cc `@rust-lang/wg-const-eval`

r? `@lcnr`

3 years agoSimplify coverage tests
Rich Kadel [Thu, 1 Apr 2021 19:25:45 +0000 (12:25 -0700)]
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 agoAuto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514
bors [Fri, 2 Apr 2021 07:04:58 +0000 (07:04 +0000)]
Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514

Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`

Fixes #80936.

"spotlight" is not a very specific or self-explaining name.
Additionally, the dialog that it triggers is called "Notable traits".
So, "notable trait" is a better name.

* Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`
* Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]`
* Update documentation
* Improve documentation

r? `@Manishearth`

3 years agoFix stack overflow detection on FreeBSD 11.1+
Alan Somers [Sat, 27 Mar 2021 17:12:38 +0000 (11:12 -0600)]
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 agoAuto merge of #80828 - SNCPlay42:opaque-projections, r=estebank
bors [Fri, 2 Apr 2021 03:39:32 +0000 (03:39 +0000)]
Auto merge of #80828 - SNCPlay42:opaque-projections, r=estebank

Fix expected/found order on impl trait projection mismatch error

fixes #68561

This PR adds a new `ObligationCauseCode` used when checking the concrete type of an impl trait satisfies its bounds, and checks for that cause code in the existing test to see if a projection's normalized type should be the "expected" or "found" type.

The second commit adds a `peel_derives` to that test, which appears to be necessary in some cases (see projection-mismatch-in-impl-where-clause.rs, which would still give expected/found in the wrong order otherwise). This caused some other changes in diagnostics not involving impl trait, but they look correct to me.

3 years agoMake the diagnostic message more readable
Aman Arora [Fri, 2 Apr 2021 01:33:11 +0000 (21:33 -0400)]
Make the diagnostic message more readable

3 years agoDon't introduce a block if a block exists
Aman Arora [Fri, 2 Apr 2021 01:08:04 +0000 (21:08 -0400)]
Don't introduce a block if a block exists

3 years agoAuto merge of #83663 - AngelicosPhosphoros:simplify_binary_and_to_get_better_asm...
bors [Fri, 2 Apr 2021 00:48:31 +0000 (00:48 +0000)]
Auto merge of #83663 - AngelicosPhosphoros:simplify_binary_and_to_get_better_asm, r=nagisa

Simplify logical operations CFG

This is basically same commit as e38e954a0d249f88d0a55504f70d6055e865a931 which was reverted later in 676953fde9120cda62e4ef2f75a804af7481d6af
In both cases, this changes weren't benchmarked.
e38e954a0d249f88d0a55504f70d6055e865a931 leads to missed optimization described in [this issue](https://github.com/rust-lang/rust/issues/62993)
676953fde9120cda62e4ef2f75a804af7481d6af leads to missed optimization described in [this issue](https://github.com/rust-lang/rust/issues/83623)

3 years agoaddress comments
hi-rustin [Fri, 2 Apr 2021 00:08:02 +0000 (08:08 +0800)]
address comments

3 years agoUpdate test cases
Aman Arora [Thu, 1 Apr 2021 20:32:25 +0000 (16:32 -0400)]
Update test cases

3 years agoUpdate lint message
Aman Arora [Thu, 1 Apr 2021 20:49:05 +0000 (16:49 -0400)]
Update lint message

3 years agoAdd test to ensure search tabs behaviour
Guillaume Gomez [Thu, 1 Apr 2021 19:55:06 +0000 (21:55 +0200)]
Add test to ensure search tabs behaviour