]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #86977 - vakaras:body_with_borrowck_facts, r=nikomatsakis
bors [Tue, 17 Aug 2021 19:08:31 +0000 (19:08 +0000)]
Auto merge of #86977 - vakaras:body_with_borrowck_facts, r=nikomatsakis

Enable compiler consumers to obtain mir::Body with Polonius facts.

This PR adds a function (``get_body_with_borrowck_facts``) that can be used by compiler consumers to obtain ``mir::Body`` with accompanying borrow checker information.

The most important borrow checker information that [our verifier called Prusti](https://github.com/viperproject/prusti-dev) needs is lifetime constraints. I have not found a reasonable way to compute the lifetime constraints on the Prusti side. In the compiler, the constraints are computed during the borrow checking phase and then dropped. This PR adds an additional parameter to the `do_mir_borrowck` function that tells it to return the computed information instead of dropping it.

The additionally returned information by `do_mir_borrowck` contains a ``mir::Body`` with non-erased lifetime regions and Polonius facts. I have decided to reuse the Polonius facts because this way I needed fewer changes to the compiler and Polonius facts contains other useful information that we otherwise would need to recompute.

Just FYI: up to now, Prusti was obtaining this information by [parsing the compiler logs](https://github.com/viperproject/prusti-dev/blob/b58ced8dfd14ef30582b503d517167ccd771eaff/prusti-interface/src/environment/borrowck/regions.rs#L25-L39). This is not only a hacky approach, but we also reached its limits.

r? `@nikomatsakis`

2 years agoAuto merge of #88083 - m-ou-se:non-fmt-panics-suggest-debug, r=estebank
bors [Tue, 17 Aug 2021 16:43:40 +0000 (16:43 +0000)]
Auto merge of #88083 - m-ou-se:non-fmt-panics-suggest-debug, r=estebank

Improve non_fmt_panics suggestion based on trait impls.

This improves the non_fmt_panics lint suggestions by checking first which trait (Display or Debug) are actually implemented on the type.

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

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

Before:

```
help: add a "{}" format string to Display the message
  |
2 |     panic!("{}", Some(1));
  |            +++++
help: or use std::panic::panic_any instead
  |
2 |     std::panic::panic_any(Some(1));
  |     ~~~~~~~~~~~~~~~~~~~~~
```

After:

```
help: add a "{:?}" format string to use the Debug implementation of `Option<i32>`
  |
2 |     panic!("{:?}", Some(1));
  |            +++++++
help: or use std::panic::panic_any instead
  |
2 |     std::panic::panic_any(Some(1));
  |     ~~~~~~~~~~~~~~~~~~~~~
```

r? `@estebank`

2 years agoAuto merge of #88056 - erikdesjardins:revertzst, r=oli-obk
bors [Tue, 17 Aug 2021 14:02:55 +0000 (14:02 +0000)]
Auto merge of #88056 - erikdesjardins:revertzst, r=oli-obk

Revert "Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk"

This reverts commit 8007b506ac5da629f223b755f5a5391edd5f6d01, reversing changes made to e55c13e1099b78b1a485202fabc9c1b10b1f1d15.

Fixes #88043

r? `@oli-obk`

2 years agoFix obtain-borrowck failure on Windows.
Vytautas Astrauskas [Tue, 17 Aug 2021 11:06:27 +0000 (13:06 +0200)]
Fix obtain-borrowck failure on Windows.

2 years agoAuto merge of #87668 - estebank:tweak-bound-output, r=oli-obk
bors [Tue, 17 Aug 2021 06:59:49 +0000 (06:59 +0000)]
Auto merge of #87668 - estebank:tweak-bound-output, r=oli-obk

Use note for pointing at bound introducing requirement

Modify output for pointing where a trait bound obligation is introduced in an E0277 from using a span label to using a note in order to always preserve order of the output:

Before:
```
error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug`
  --> $DIR/bounds-on-assoc-in-trait.rs:18:28
   |
LL |     type A: Iterator<Item: Debug>;
   |                            ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
   |
  ::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
   |
LL | pub trait Debug {
   | --------------- required by this bound in `Debug`
   |
   = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item`
```
After:
```
error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug`
  --> $DIR/bounds-on-assoc-in-trait.rs:18:28
   |
LL |     type A: Iterator<Item: Debug>;
   |                            ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
   |
   = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item`
note: required by a bound in `Debug`
  --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
   |
LL | pub trait Debug {
   | ^^^^^^^^^^^^^^^ required by this bound in `Debug`
```

2 years agoAuto merge of #87119 - jyn514:rustfmt-doc-private, r=Mark-Simulacrum
bors [Tue, 17 Aug 2021 04:18:55 +0000 (04:18 +0000)]
Auto merge of #87119 - jyn514:rustfmt-doc-private, r=Mark-Simulacrum

Document private items for rustfmt

This is possible now that https://github.com/rust-lang/rust/pull/73936 has been merged.

2 years agoAuto merge of #87990 - Aaron1011:moved-src-dir, r=cjgillot
bors [Tue, 17 Aug 2021 01:32:15 +0000 (01:32 +0000)]
Auto merge of #87990 - Aaron1011:moved-src-dir, r=cjgillot

Include (potentially remapped) working dir in crate hash

Fixes #85019

A `SourceFile` created during compilation may have a relative
path (e.g. if rustc itself is invoked with a relative path).
When we write out crate metadata, we convert all relative paths
to absolute paths using the current working directory.

However, the working directory is not included in the crate hash.
This means that the crate metadata can change while the crate
hash remains the same. Among other problems, this can cause a
fingerprint mismatch ICE, since incremental compilation uses
the crate metadata hash to determine if a foreign query is green.

This commit moves the field holding the working directory from
`Session` to `Options`, including it as part of the crate hash.

cc `@ohsayan`

2 years agoAuto merge of #88094 - m-ou-se:rollup-2fxss0q, r=m-ou-se
bors [Mon, 16 Aug 2021 22:33:36 +0000 (22:33 +0000)]
Auto merge of #88094 - m-ou-se:rollup-2fxss0q, r=m-ou-se

Rollup of 10 pull requests

Successful merges:

 - #87178 ([rustdoc] Copy only item path to clipboard rather than full `use` statement.)
 - #87677 (Adding explicit notice of lack of documentation for Tier 2 Platforms)
 - #87958 (Closure migration multispan suggestions)
 - #87967 (Detect fake spans in non_fmt_panic lint.)
 - #88011 (Enable `--all-targets` for `x.py check` unconditionally)
 - #88030 (Assign FIXMEs to me and remove obsolete ones)
 - #88052 (Update redox_syscall)
 - #88055 (Update RELEASES.md for 1.55.0)
 - #88080 (Skip assert ICE with default_method_body_is_const)
 - #88089 (Rustdoc font test)

Failed merges:

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

2 years agoRollup merge of #88089 - dns2utf8:rustdoc_font_test, r=GuillaumeGomez
Mara Bos [Mon, 16 Aug 2021 21:37:35 +0000 (23:37 +0200)]
Rollup merge of #88089 - dns2utf8:rustdoc_font_test, r=GuillaumeGomez

Rustdoc font test

 Add a font test based on #85669 fixes #85632.

r? `@jsha` `@GuillaumeGomez`

2 years agoRollup merge of #88080 - fee1-dead:iterator-const, r=oli-obk
Mara Bos [Mon, 16 Aug 2021 21:37:34 +0000 (23:37 +0200)]
Rollup merge of #88080 - fee1-dead:iterator-const, r=oli-obk

Skip assert ICE with default_method_body_is_const

functions marked with #[default_method_body_is_const] would
ICE when being const checked due to it not being a const function:
`tcx.is_const_fn_raw(did)` returns false. We should skip this assert
when it is marked with that attribute.

r? `@oli-obk`

2 years agoRollup merge of #88055 - Mark-Simulacrum:relnotes-1.55, r=Mark-Simulacrum
Mara Bos [Mon, 16 Aug 2021 21:37:33 +0000 (23:37 +0200)]
Rollup merge of #88055 - Mark-Simulacrum:relnotes-1.55, r=Mark-Simulacrum

Update RELEASES.md for 1.55.0

Reopening https://github.com/rust-lang/rust/pull/87624 after some edits and a force-push caused GitHub to close the PR.

2 years agoRollup merge of #88052 - bjorn3:update_redox_syscall, r=Mark-Simulacrum
Mara Bos [Mon, 16 Aug 2021 21:37:31 +0000 (23:37 +0200)]
Rollup merge of #88052 - bjorn3:update_redox_syscall, r=Mark-Simulacrum

Update redox_syscall

The currently pinned version doesn't compile with the latest rustc nightly

cc ``@jackpot51``

2 years agoRollup merge of #88030 - fee1-dead:fixme, r=oli-obk
Mara Bos [Mon, 16 Aug 2021 21:37:30 +0000 (23:37 +0200)]
Rollup merge of #88030 - fee1-dead:fixme, r=oli-obk

Assign FIXMEs to me and remove obsolete ones

Also fixed capitalization of documentation

We also don't need to transform predicates to be non-const since we basically ignore const predicates in non-const contexts.

r? `````@oli-obk`````

2 years agoRollup merge of #88011 - jyn514:check-all-targets, r=Mark-Simulacrum
Mara Bos [Mon, 16 Aug 2021 21:37:29 +0000 (23:37 +0200)]
Rollup merge of #88011 - jyn514:check-all-targets, r=Mark-Simulacrum

Enable `--all-targets` for `x.py check` unconditionally

Now that Cargo deduplicates diagnostics from different targets, this doesn't flood the console with
duplicate errors.

Note that this doesn't add `--all-targets` in `Builder::cargo` directly because `impl Step for Std`
actually wants to omit `--all-targets` the first time while it's still building libtest.

When passed `--all-targets`, this warns that the option isn't needed, but still continues to compile.

Fixes https://github.com/rust-lang/rust/issues/87846.
r? ``@Mark-Simulacrum``

2 years agoRollup merge of #87967 - m-ou-se:non-fmt-panic-detect-fake-spans, r=cjgillot
Mara Bos [Mon, 16 Aug 2021 21:37:28 +0000 (23:37 +0200)]
Rollup merge of #87967 - m-ou-se:non-fmt-panic-detect-fake-spans, r=cjgillot

Detect fake spans in non_fmt_panic lint.

This addresses https://github.com/rust-lang/rust/issues/87621

Some proc_macros claim that the user wrote all of the tokens it outputs, by applying a span from the input to all of the produced tokens. That can result in confusing suggestions, as in #87621. This is a simple patch that avoids suggesting anything for `panic!("{}")` if the span of `"{}"` and `panic!(..)` are identical, which is normally not possible.

2 years agoRollup merge of #87958 - m-ou-se:closure-migration-multispan-suggestions, r=estebank
Mara Bos [Mon, 16 Aug 2021 21:37:27 +0000 (23:37 +0200)]
Rollup merge of #87958 - m-ou-se:closure-migration-multispan-suggestions, r=estebank

Closure migration multispan suggestions

This changes the `rust_2021_incompatible_closure_captures` lint to only suggest inserting the parts that need to be inserted, instead of suggesting to replace the entire closure by an almost identical closure with one statement added.

Before:
```
[...]
help: add a dummy let to cause `a` to be fully captured
   |
5  ~     let _ = || {
6  +         let _ = &a;
7  +         dbg!(a.0);
8  +         println!("1");
9  +         println!("2");
10 +         println!("3");
 ...
   |

[...]
help: add a dummy let to cause `b` to be fully captured
   |
14 |     let _ = || { let _ = &b; dbg!(b.0); };
   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]
help: add a dummy let to cause `c` to be fully captured
   |
16 |     let _ = || { let _ = &c; dbg!(c.0) };
   |                ~~~~~~~~~~~~~~~~~~~~~~~~~
```

After:
```
[...]
help: add a dummy let to cause `a` to be fully captured
   |
5  ~     let _ = || {
6  +         let _ = &a;
   |

[...]
help: add a dummy let to cause `b` to be fully captured
   |
14 |     let _ = || { let _ = &b; dbg!(b.0); };
   |                  +++++++++++

[...]
help: add a dummy let to cause `c` to be fully captured
   |
16 |     let _ = || { let _ = &c; dbg!(c.0) };
   |                +++++++++++++           +
```

2 years agoRollup merge of #87677 - amalik18:issue-2788-fix, r=pietroalbini
Mara Bos [Mon, 16 Aug 2021 21:37:26 +0000 (23:37 +0200)]
Rollup merge of #87677 - amalik18:issue-2788-fix, r=pietroalbini

Adding explicit notice of lack of documentation for Tier 2 Platforms

Fixing: https://github.com/rust-lang/rustup/issues/2788

2 years agoRollup merge of #87178 - moxian:rd-use, r=jyn514
Mara Bos [Mon, 16 Aug 2021 21:37:25 +0000 (23:37 +0200)]
Rollup merge of #87178 - moxian:rd-use, r=jyn514

[rustdoc] Copy only item path to clipboard rather than full `use` statement.

The (somewhat) recent addition of the "copy item import to clipboard" button is extremely nice.

However, i tend to write my code with fully qualified paths wherever feasible and only resort to `use` statements as a refactoring pass. This makes the "copy to clipboard" workflow awkward to use, as i would be copy-pasting that as, say

```rust
impl use std::ops::Add; for MyType {
```

and then go back  and remove the `use ` and `;`.

This PR removes the `use ;` decorations, making it much nicer to use for fully-qualified items. I argue, however, that this does not noticeably degrade experience for those who prefer to import items, since the hard part about those is getting the path right, and writing the `use ;` decoration can be done by hand with little effort.

2 years agoMerge the two test files as they are testing the same features
Stefan Schindler [Mon, 16 Aug 2021 19:38:30 +0000 (21:38 +0200)]
Merge the two test files as they are testing the same features

2 years agoAdd a font test based on #85669
Stefan Schindler [Mon, 16 Aug 2021 18:41:15 +0000 (20:41 +0200)]
Add a font test based on #85669

2 years agoFix double output of the summary line
Stefan Schindler [Mon, 16 Aug 2021 18:40:23 +0000 (20:40 +0200)]
Fix double output of the summary line

2 years agoUse note to point at bound introducing requirement
Esteban Küber [Sat, 31 Jul 2021 16:26:55 +0000 (09:26 -0700)]
Use note to point at bound introducing requirement

2 years agoShow correct macro name in non_fmt_panics message.
Mara Bos [Mon, 16 Aug 2021 15:39:50 +0000 (17:39 +0200)]
Show correct macro name in non_fmt_panics message.

2 years agoAuto merge of #87050 - jyn514:no-doc-primitive, r=manishearth
bors [Mon, 16 Aug 2021 15:36:44 +0000 (15:36 +0000)]
Auto merge of #87050 - jyn514:no-doc-primitive, r=manishearth

Add future-incompat lint for `doc(primitive)`

## What is `doc(primitive)`?

`doc(primitive)` is an attribute recognized by rustdoc which adds documentation for the built-in primitive types, such as `usize` and `()`. It has been stable since Rust 1.0.

## Why change anything?

`doc(primitive)` is useless for anyone outside the standard library. Since rustdoc provides no way to combine the documentation on two different primitive items, you can only replace the docs, and since the standard library already provides extensive documentation there is no reason to do so.

While fixing rustdoc's handling of primitive items (https://github.com/rust-lang/rust/pull/87073) I discovered that even rustdoc's existing handling of primitive items was broken if you had more than two crates using it (it would pick randomly between them). That meant both:
- Keeping rustdoc's existing treatment was nigh-impossible, because it was random.
- doc(primitive) was even more useless than it would otherwise be.

The only use-case for this outside the standard library is for no-std libraries which want to link to primitives (https://github.com/rust-lang/rust/issues/73423) which is being fixed in https://github.com/rust-lang/rust/pull/87073.

https://github.com/rust-lang/rust/pull/87073 makes various breaking changes to `doc(primitive)` (breaking in the sense that they change the semantics, not in that they cause code to fail to compile). It's not possible to avoid these and still fix rustdoc's issues.

## What can we do about it?

As shown by the crater run (https://github.com/rust-lang/rust/pull/87050#issuecomment-886166706), no one is actually using doc(primitive), there wasn't a single true regression in the whole run. We can either:
1. Feature gate it completely, breaking anyone who crater missed. They can easily fix the breakage just by removing the attribute.
2. add it to the `INVALID_DOC_ATTRIBUTES` future-incompat lint, and at the same time make it a no-op unless you add a feature gate. That would mean rustdoc has to look at the features of dependent crates, because it needs to know where primitives are defined in order to link to them.
3. add it to `INVALID_DOC_ATTRIBUTES`, but still use it to determine where primitives come from
4. do nothing; the behavior will silently change in https://github.com/rust-lang/rust/pull/87073.

My preference is for 2, but I would also be happy with 1 or 3. I don't think we should silently change the behavior.

This PR currently implements 3.

2 years agoAdd more assert!() tests for non_fmt_panics.
Mara Bos [Mon, 16 Aug 2021 15:35:49 +0000 (17:35 +0200)]
Add more assert!() tests for non_fmt_panics.

2 years agoAdd tests for non_fmt_panics in generic functions.
Mara Bos [Mon, 16 Aug 2021 15:33:42 +0000 (17:33 +0200)]
Add tests for non_fmt_panics in generic functions.

2 years agoUpdate non_fmt_panics test.
Mara Bos [Mon, 16 Aug 2021 15:26:08 +0000 (17:26 +0200)]
Update non_fmt_panics test.

2 years agoImprove non_fmt_panics suggestion based on trait impls.
Mara Bos [Mon, 16 Aug 2021 15:25:35 +0000 (17:25 +0200)]
Improve non_fmt_panics suggestion based on trait impls.

2 years agoAdd ui test
Deadbeef [Mon, 16 Aug 2021 14:46:08 +0000 (14:46 +0000)]
Add ui test

2 years agoSkip assert ICE with default_method_body_is_const
Deadbeef [Mon, 16 Aug 2021 11:29:05 +0000 (11:29 +0000)]
Skip assert ICE with default_method_body_is_const

functions marked with #[default_method_body_is_const] would
ICE when being const checked due to it not being a const function:
`tcx.is_const_fn_raw(did)` returns false. We should skip this assert
when it is marked with that attribute.

2 years agoUpdate test output.
Mara Bos [Thu, 12 Aug 2021 10:17:35 +0000 (12:17 +0200)]
Update test output.

2 years agoUse multi span suggestions for closure migrations.
Mara Bos [Thu, 12 Aug 2021 10:17:25 +0000 (12:17 +0200)]
Use multi span suggestions for closure migrations.

2 years agoAuto merge of #88032 - hyd-dev:no-mangle-method, r=petrochenkov
bors [Mon, 16 Aug 2021 09:38:18 +0000 (09:38 +0000)]
Auto merge of #88032 - hyd-dev:no-mangle-method, r=petrochenkov

Fix `reachable_set` for non-function items in non-library crates

I unintentionally changed `reachable_set` to ignore non-function items when `!self.any_library` in https://github.com/rust-lang/rust/pull/86492, which can lead to "undefined reference" errors in non-library (`cdylib`/`staticlib`/`bin`) crates, for example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=6bb2c5065a9be7e40943d0541e161b5a

This PR restores the behavior of `reachable_set` for non-function items.

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

<details>
<summary>The modified test will fail with this output without the `reachable_set` change</summary>

```
---- [codegen] codegen/external-no-mangle-statics.rs#staticlib stdout ----

error in revision `staticlib`: verification with 'FileCheck' failed
status: exit status: 1
command: "/checkout/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll" "/checkout/src/test/codegen/external-no-mangle-statics.rs" "--check-prefixes" "CHECK,NONMSVC,staticlib"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
/checkout/src/test/codegen/external-no-mangle-statics.rs:10:11: error: CHECK: expected string not found in input
// CHECK: `@A` = local_unnamed_addr constant
          ^
/checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll:1:1: note: scanning from here
; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0'
^
/checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll:1:6: note: possible intended match here
; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0'
     ^

Input file: /checkout/build/x86_64-unknown-linux-gnu/test/codegen/external-no-mangle-statics.staticlib/external-no-mangle-statics.ll
Check file: /checkout/src/test/codegen/external-no-mangle-statics.rs

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ; ModuleID = 'external_no_mangle_statics.b50529d3-cgu.0'
check:10'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:10'1          ?                                                   possible intended match
            2: source_filename = "external_no_mangle_statics.b50529d3-cgu.0"
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            4: target triple = "x86_64-unknown-linux-gnu"
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5:
check:10'0     ~
            6: !llvm.module.flags = !{!0, !1}
check:10'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
>>>>>>

------------------------------------------

failures:
    [codegen] codegen/external-no-mangle-statics.rs#staticlib
```
</details>

2 years agoAuto merge of #84039 - jyn514:uplift-atomic-ordering, r=wesleywiser
bors [Mon, 16 Aug 2021 06:36:13 +0000 (06:36 +0000)]
Auto merge of #84039 - jyn514:uplift-atomic-ordering, r=wesleywiser

Uplift the invalid_atomic_ordering lint from clippy to rustc

This is mostly just a rebase of https://github.com/rust-lang/rust/pull/79654; I've copy/pasted the text from that PR below.

r? `@lcnr` since you reviewed the last one, but feel free to reassign.

---

This is an implementation of https://github.com/rust-lang/compiler-team/issues/390.

As mentioned, in general this turns an unconditional runtime panic into a (compile time) lint failure. It has no false positives, and the only false negatives I'm aware of are if `Ordering` isn't specified directly and is comes from an argument/constant/whatever.

As a result of it having no false positives, and the alternative always being strictly wrong, it's on as deny by default. This seems right.

In the [zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Uplift.20the.20.60invalid_atomic_ordering.60.20lint.20from.20clippy/near/218483957) `@joshtriplett` suggested that lang team should FCP this before landing it. Perhaps libs team cares too?

---

Some notes on the code for reviewers / others below

## Changes from clippy

The code is changed from [the implementation in clippy](https://github.com/rust-lang/rust-clippy/blob/68cf94f6a66e47234e3adefc6dfbe806cd6ad164/clippy_lints/src/atomic_ordering.rs) in the following ways:

1. Uses `Symbols` and `rustc_diagnostic_item`s instead of string literals.
    - It's possible I should have just invoked Symbol::intern for some of these instead? Seems better to use symbol, but it did require adding several.
2. The functions are moved to static methods inside the lint struct, as a way to namespace them.
    - There's a lot of other code in that file — which I picked as the location for this lint because `@jyn514` told me that seemed reasonable.
3. Supports unstable AtomicU128/AtomicI128.
    - I did this because it was almost easier to support them than not — not supporting them would have (ideally) required finding a way not to give them a `rustc_diagnostic_item`, which would have complicated an already big macro.
    - These don't have tests since I wasn't sure if/how I should make tests conditional on whether or not the target has the atomic... This is to a certain extent an issue of 64bit atomics too, but 128-bit atomics are much less common. Regardless, the existing tests should be *more* than thorough enough here.
4. Minor changes like:
    - grammar tweaks ("loads cannot have `Release` **and** `AcqRel` ordering" => "loads cannot have `Release` **or** `AcqRel` ordering")
    - function renames (`match_ordering_def_path` => `matches_ordering_def_path`),
    - avoiding clippy-specific helper methods that don't exist in rustc_lint and didn't seem worth adding for this case (for example `cx.struct_span_lint` vs clippy's `span_lint_and_help` helper).

## Potential issues

(This is just about the code in this PR, not conceptual issues with the lint or anything)

1. I'm not sure if I should have used a diagnostic item for `Ordering` and its variants (I couldn't figure out how really, so if I should do this some pointers would be appreciated).
    - It seems possible that failing to do this might possibly mean there are more cases this lint would miss, but I don't really know how `match_def_path` works and if it has any pitfalls like that, so maybe not.

2. I *think* I deprecated the lint in clippy (CC `@flip1995` who asked to be notified about clippy changes in the future in [this comment](https://github.com/rust-lang/rust/pull/75671#issuecomment-718731659)) but I'm not sure if I need to do anything else there.
    - I'm kind of hoping CI will catch if I missed anything, since `x.py test src/tools/clippy` fails with a lot of errors with and without my changes (and is probably a nonsense command regardless). Running `cargo test` from src/tools/clippy also fails with unrelated errors that seem like refactorings that didnt update clippy? So, honestly no clue.

3. I wasn't sure if the description/example I gave good. Hopefully it is. The example is less thorough than the one from clippy here: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_atomic_ordering. Let me know if/how I should change it if it needs changing.

4. It pulls in the `if_chain` crate. This crate was already used in clippy, and seems like it's used elsewhere in rustc, but I'm willing to rewrite it to not use this if needed (I'd prefer not to, all things being equal).

2 years agofeature gate doc(primitive)
Joshua Nelson [Sun, 11 Jul 2021 02:06:10 +0000 (22:06 -0400)]
feature gate doc(primitive)

2 years agoOnly run expensive calculations if the method name is recognized
Joshua Nelson [Wed, 14 Jul 2021 00:18:43 +0000 (20:18 -0400)]
Only run expensive calculations if the method name is recognized

2 years agoUplift the `invalid_atomic_ordering` lint from clippy to rustc
Thom Chiovoloni [Wed, 2 Dec 2020 23:16:12 +0000 (15:16 -0800)]
Uplift the `invalid_atomic_ordering` lint from clippy to rustc

- Deprecate clippy::invalid_atomic_ordering
- Use rustc_diagnostic_item for the orderings in the invalid_atomic_ordering lint
- Reduce code duplication
- Give up on making enum variants diagnostic items and just look for
`Ordering` instead

  I ran into tons of trouble with this because apparently the change to
  store HIR attrs in a side table also gave the DefIds of the
  constructor instead of the variant itself. So I had to change
  `matches_ordering` to also check the grandparent of the defid as well.

- Rename `atomic_ordering_x` symbols to just the name of the variant
- Fix typos in checks - there were a few places that said "may not be
  Release" in the diagnostic but actually checked for SeqCst in the lint.
- Make constant items const
- Use fewer diagnostic items
- Only look at arguments after making sure the method matches

  This prevents an ICE when there aren't enough arguments.

- Ignore trait methods
- Only check Ctors instead of going through `qpath_res`

  The functions take values, so this couldn't ever be anything else.

- Add if_chain to allowed dependencies
- Fix grammar
- Remove unnecessary allow

2 years agoAuto merge of #87696 - ssomers:btree_lazy_iterator_cleanup, r=Mark-Simulacrum
bors [Mon, 16 Aug 2021 03:45:26 +0000 (03:45 +0000)]
Auto merge of #87696 - ssomers:btree_lazy_iterator_cleanup, r=Mark-Simulacrum

BTree: merge the complication introduced by #81486 and #86031

Also:
- Deallocate the last few tree nodes as soon as an `into_iter` iterator steps beyond the end, instead of waiting around for the drop of the iterator (just to share more code).
- Symmetric code for backward iteration.
- Mark unsafe the methods on dying handles, modelling dying handles after raw pointers: it's the caller's responsibility to use them safely.

r? `@Mark-Simulacrum`

2 years agoadd regression test
Erik Desjardins [Sun, 15 Aug 2021 18:26:14 +0000 (14:26 -0400)]
add regression test

2 years agoRevert "Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk"
Erik Desjardins [Sun, 15 Aug 2021 17:25:17 +0000 (13:25 -0400)]
Revert "Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk"

This reverts commit 8007b506ac5da629f223b755f5a5391edd5f6d01, reversing
changes made to e55c13e1099b78b1a485202fabc9c1b10b1f1d15.

2 years agoDocument private items for rustfmt
Joshua Nelson [Wed, 14 Jul 2021 01:09:03 +0000 (21:09 -0400)]
Document private items for rustfmt

This is possible now that rustdoc allows passing
`--document-private-items` more than once.

2 years agoAuto merge of #80357 - c410-f3r:new-hir-let, r=matthewjasper
bors [Mon, 16 Aug 2021 00:31:42 +0000 (00:31 +0000)]
Auto merge of #80357 - c410-f3r:new-hir-let, r=matthewjasper

Introduce `hir::ExprKind::Let` - Take 2

Builds on #68577 and depends on #79328.

cc #53667

2 years agoAdd `--target` flag to `issue-85019-moved-src-dir`
Aaron Hill [Sun, 15 Aug 2021 22:37:26 +0000 (17:37 -0500)]
Add `--target` flag to `issue-85019-moved-src-dir`

2 years agoAuto merge of #87590 - Amanieu:deprecate_llvm_asm, r=nagisa
bors [Sun, 15 Aug 2021 21:22:02 +0000 (21:22 +0000)]
Auto merge of #87590 - Amanieu:deprecate_llvm_asm, r=nagisa

Deprecate llvm_asm!

We would like to remove `llvm_asm!` from the compiler once `asm!` is stabilized. This PR deprecates `llvm_asm!` to encourage any remaining users to migrate to `asm!` (or if `asm!` is not supported for their target, to add this support to rustc).

The only remaining user of `llvm_asm!` in the standard library was `black_box`, which has been rewritten to use volatile operations when `asm!` is not available on the current target.

cc `@rust-lang/wg-inline-asm`

cc `@RalfJung` for the changes to `black_box` which might affect Miri.

r? `@nagisa`

2 years agoCopy over run-make ignores from issue-83112-incr-test-moved-file
Aaron Hill [Sun, 15 Aug 2021 20:19:41 +0000 (15:19 -0500)]
Copy over run-make ignores from issue-83112-incr-test-moved-file

2 years agoUpdate rustc_codegen_cratelift for working_dir change
Aaron Hill [Thu, 12 Aug 2021 21:46:58 +0000 (16:46 -0500)]
Update rustc_codegen_cratelift for working_dir change

2 years agoInclude (potentially remapped) working dir in crate hash
Aaron Hill [Thu, 12 Aug 2021 20:30:40 +0000 (15:30 -0500)]
Include (potentially remapped) working dir in crate hash

Fixes #85019

A `SourceFile` created during compilation may have a relative
path (e.g. if rustc itself is invoked with a relative path).
When we write out crate metadata, we convert all relative paths
to absolute paths using the current working direction.

However, the working directory is not included in the crate hash.
This means that the crate metadata can change while the crate
hash remains the same. Among other problems, this can cause a
fingerprint mismatch ICE, since incremental compilation uses
the crate metadata hash to determine if a foreign query is green.

This commit moves the field holding the working directory from
`Session` to `Options`, including it as part of the crate hash.

2 years agoIntroduce hir::ExprKind::Let - Take 2
Caio [Sun, 8 Aug 2021 14:49:13 +0000 (11:49 -0300)]
Introduce hir::ExprKind::Let - Take 2

2 years agoUse correct drop scopes for if expressions
Matthew Jasper [Thu, 25 Feb 2021 22:37:22 +0000 (22:37 +0000)]
Use correct drop scopes for if expressions

2 years agoAuto merge of #87982 - m-ou-se:non-fmt-panic-assert-str, r=cjgillot
bors [Sun, 15 Aug 2021 17:57:39 +0000 (17:57 +0000)]
Auto merge of #87982 - m-ou-se:non-fmt-panic-assert-str, r=cjgillot

Add automatic migration for assert!(.., string).

Fixes part of #87313.

2 years agoUpdate RELEASES.md for 1.55.0
Erin Power [Fri, 30 Jul 2021 11:32:16 +0000 (13:32 +0200)]
Update RELEASES.md for 1.55.0

Co-authored-by: Eric Huss <eric@huss.org>
Co-authored-by: inquisitivecrystal <22333129+inquisitivecrystal@users.noreply.github.com>
Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
Co-authored-by: Daniel Giger <danielg3432@gmail.com>
2 years agoUpdate redox_syscall
bjorn3 [Sun, 15 Aug 2021 16:40:40 +0000 (18:40 +0200)]
Update redox_syscall

The currently pinned version doesn't compile with the latest rustc nightly

2 years agoAuto merge of #87792 - GuillaumeGomez:ci-fetch, r=pietroalbini
bors [Sun, 15 Aug 2021 14:02:40 +0000 (14:02 +0000)]
Auto merge of #87792 - GuillaumeGomez:ci-fetch, r=pietroalbini

Remove git fetch from CI

https://github.com/rust-lang/rust/pull/86623 added a call to `git fetch`, which is problematic for releases.

r? `@pietroalbini`

2 years agoFix ui tests for llvm_asm! deprecation
Amanieu d'Antras [Thu, 29 Jul 2021 17:45:13 +0000 (19:45 +0200)]
Fix ui tests for llvm_asm! deprecation

2 years agoAllow the use of the deprecated llvm_asm! in black_box
Amanieu d'Antras [Wed, 11 Aug 2021 23:18:53 +0000 (00:18 +0100)]
Allow the use of the deprecated llvm_asm! in black_box

2 years agoDeprecate llvm_asm!
Amanieu d'Antras [Thu, 29 Jul 2021 14:51:32 +0000 (16:51 +0200)]
Deprecate llvm_asm!

2 years agoAuto merge of #86692 - dns2utf8:parallelize_rustdoc-gui_tests, r=GuillaumeGomez
bors [Sun, 15 Aug 2021 10:56:35 +0000 (10:56 +0000)]
Auto merge of #86692 - dns2utf8:parallelize_rustdoc-gui_tests, r=GuillaumeGomez

Run rustdoc-gui tests in parallel

I hid the passing tests and only show the failed ones in alphabetical order:
![image](https://user-images.githubusercontent.com/739070/123663020-84e63100-d825-11eb-9b35-0a8c30cd219c.png)

Also this PR cuts down the execution time from ~40 to ~9 seconds

2 years agoAuto merge of #87975 - m-ou-se:unused-import-attributes, r=nagisa
bors [Sun, 15 Aug 2021 07:40:53 +0000 (07:40 +0000)]
Auto merge of #87975 - m-ou-se:unused-import-attributes, r=nagisa

Include attributes in removal span for unused imports.

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

2 years agoAuto merge of #87974 - steffahn:slice_split_size_hints, r=dtolnay
bors [Sun, 15 Aug 2021 04:48:42 +0000 (04:48 +0000)]
Auto merge of #87974 - steffahn:slice_split_size_hints, r=dtolnay

Test and fix `size_hint` for slice’s [r]split* iterators

Adds extensive test (of `size_hint`) for all the _[r]split*_ iterators.
Fixes `size_hint` upper bound for _split_inclusive*_ iterators which was one higher than necessary for non-empty slices.
Fixes `size_hint` lower bound for _[r]splitn*_ iterators when _n == 0_, which was one too high.

**Lower bound being one too high was a logic error, violating the correctness condition of `size_hint`.**

_Edit:_ I’ve opened an issue for that bug, so this PR fixes #87978

2 years agoAuto merge of #87581 - Amanieu:asm_clobber_abi, r=nagisa
bors [Sat, 14 Aug 2021 22:29:27 +0000 (22:29 +0000)]
Auto merge of #87581 - Amanieu:asm_clobber_abi, r=nagisa

Add support for clobber_abi to asm!

This PR adds the `clobber_abi` feature that was proposed in #81092.

Fixes #81092

cc `@rust-lang/wg-inline-asm`

r? `@nagisa`

2 years agoMore spacing between the different blocks of results
Stefan Schindler [Sat, 14 Aug 2021 21:36:17 +0000 (23:36 +0200)]
More spacing between the different blocks of results

2 years agoImplement a finish method for the status_bar and some cleanup
Stefan Schindler [Sat, 14 Aug 2021 21:19:28 +0000 (23:19 +0200)]
Implement a finish method for the status_bar and some cleanup

2 years agoAuto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk
bors [Sat, 14 Aug 2021 19:59:08 +0000 (19:59 +0000)]
Auto merge of #83417 - erikdesjardins:enableremovezsts, r=oli-obk

Run RemoveZsts pass at mir-opt-level=1

per https://github.com/rust-lang/rust/pull/83177#issuecomment-803942217

This pass removes assignments to ZST places.

Perf (from https://github.com/rust-lang/rust/pull/83177#issuecomment-803442557): https://perf.rust-lang.org/compare.html?start=41b315a470d583f6446599984ff9ad3bd61012b2&end=bd5d1b96f0c64c9938feea831789e1b5bb2cd4a2

r? `@oli-obk`

2 years agoFix `reachable_set` for non-function items in non-library crates
hyd-dev [Sat, 14 Aug 2021 15:24:33 +0000 (23:24 +0800)]
Fix `reachable_set` for non-function items in non-library crates

2 years agoAuto merge of #87324 - asquared31415:named-asm-labels, r=Amanieu
bors [Sat, 14 Aug 2021 17:33:38 +0000 (17:33 +0000)]
Auto merge of #87324 - asquared31415:named-asm-labels, r=Amanieu

Lint against named asm labels

This adds a deny-by-default lint to prevent the use of named labels in inline `asm!`.  Without a solution to #81088 about whether the compiler should rewrite named labels or a special syntax for labels, a lint against them should prevent users from writing assembly that could break for internal compiler reasons, such as inlining or anything else that could change the number of actual inline assembly blocks emitted.

This does **not** resolve the issue with rewriting labels, that still needs a decision if the compiler should do any more work to try to make them work.

2 years agoAssign FIXMEs to me and remove obsolete ones
Deadbeef [Sat, 14 Aug 2021 15:57:46 +0000 (15:57 +0000)]
Assign FIXMEs to me and remove obsolete ones

Also fixed capitalization of documentation

2 years agoAuto merge of #87913 - a1phyr:vec_spec_clone_from, r=dtolnay
bors [Sat, 14 Aug 2021 14:52:33 +0000 (14:52 +0000)]
Auto merge of #87913 - a1phyr:vec_spec_clone_from, r=dtolnay

Specialize `Vec::clone_from` for `Copy` types

This should improve performance and reduce code size.

This also improves `clone_from` for `String`, `OsString` and `PathBuf`.

2 years agoAuto merge of #87375 - fee1-dead:move-constness-to-traitpred, r=oli-obk
bors [Sat, 14 Aug 2021 12:06:34 +0000 (12:06 +0000)]
Auto merge of #87375 - fee1-dead:move-constness-to-traitpred, r=oli-obk

Try filtering out non-const impls when we expect const impls

**TL;DR**: Associated types on const impls are now bounded; we now disallow calling a const function with bounds when the specified type param only has a non-const impl.

r? `@oli-obk`

2 years agoAuto merge of #87600 - JohnTitor:classify-ui-tests, r=petrochenkov
bors [Sat, 14 Aug 2021 09:25:33 +0000 (09:25 +0000)]
Auto merge of #87600 - JohnTitor:classify-ui-tests, r=petrochenkov

Move some UI tests to more suitable subdirs

The classifui result: https://gist.github.com/JohnTitor/c9e00840990b5e4a8fc562ec3571e427/e06c42226c6038da91e403c33b9947843420cf44

Some notes:
- backtrace-debuginfo.rs: previously I skipped this, I'm still not sure what the best dir is. Any ideas?
- estr-subtyping.rs: Seems a quite old test so removed, shouldn't?
- deref-suggestion.rs: moved to inference as `suggestions` is not an ideal dir.
- issue-43023.rs: a bit misclassified, moved to `derives`

cc #73494
r? `@petrochenkov`

2 years agoAuto merge of #85020 - lrh2000:named-upvars, r=tmandry
bors [Sat, 14 Aug 2021 07:01:36 +0000 (07:01 +0000)]
Auto merge of #85020 - lrh2000:named-upvars, r=tmandry

Name the captured upvars for closures/generators in debuginfo

Previously, debuggers print closures as something like
```
y::main::closure-0 (0x7fffffffdd34)
```
The pointer actually references to an upvar. It is not very obvious, especially for beginners.

It's because upvars don't have names before, as they are packed into a tuple. This PR names the upvars, so we can expect to see something like
```
y::main::closure-0 {_captured_ref__b: 0x[...]}
```

r? `@tmandry`
Discussed at https://github.com/rust-lang/rust/pull/84752#issuecomment-831639489 .

2 years agoAuto merge of #88006 - GuillaumeGomez:update-browser-ui-test-dep, r=notriddle
bors [Sat, 14 Aug 2021 04:09:22 +0000 (04:09 +0000)]
Auto merge of #88006 - GuillaumeGomez:update-browser-ui-test-dep, r=notriddle

Update browser-ui-test package version

r? `@notriddle`

2 years agoAuto merge of #87997 - sl4m:update-favicon-order, r=GuillaumeGomez
bors [Sat, 14 Aug 2021 01:12:22 +0000 (01:12 +0000)]
Auto merge of #87997 - sl4m:update-favicon-order, r=GuillaumeGomez

Updates favicon order of precedence as it matters to Chrome

Hi, this updates #75438 to fix an order of precedence issue for Chrome. Unfortunately, the last favicon defined wins when it comes to Chrome, hence the primary icon being placed last. I [brought it up](https://bugs.chromium.org/p/chromium/issues/detail?id=1104663) with the Chromium team last year, but so far it's a non-issue.

I've created an example website that mimics the behaviour in Chrome. https://sl4m.github.io/chrome-favicon/

This is what I'm seeing at the moment when viewing https://doc.rust-lang.org/core/index.html in Chrome. It's falling back to the PNG.

<img width="80" alt="Screenshot 2021-08-12 at 21 11 58" src="https://user-images.githubusercontent.com/47347/129304041-b598213e-fcd3-4df1-addb-e6feac6c35b1.png">

2 years agoAuto merge of #87478 - jackh726:issue-84931, r=estebank
bors [Fri, 13 Aug 2021 22:28:01 +0000 (22:28 +0000)]
Auto merge of #87478 - jackh726:issue-84931, r=estebank

Point to where clause for GATs to add bound

Fixes #84931

r? `@estebank`

2 years agoPoint to where clause for GATs
jackh726 [Mon, 26 Jul 2021 02:12:34 +0000 (22:12 -0400)]
Point to where clause for GATs

2 years agoAuto merge of #86492 - hyd-dev:no-mangle-method, r=petrochenkov
bors [Fri, 13 Aug 2021 19:47:03 +0000 (19:47 +0000)]
Auto merge of #86492 - hyd-dev:no-mangle-method, r=petrochenkov

Associated functions that contain extern indicator or have `#[rustc_std_internal_symbol]` are reachable

Previously these fails to link with ``undefined reference to `foo'``:

<details>
<summary>Example 1</summary>

```rs
struct AssocFn;

impl AssocFn {
    #[no_mangle]
    fn foo() {}
}

fn main() {
    extern "Rust" {
        fn foo();
    }
    unsafe { foo() }
}
```
([Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f1244afcdd26e2a28445f6e82ca46b50))
</details>

<details>
<summary>Example 2</summary>

```rs
#![crate_name = "lib"]
#![crate_type = "lib"]

struct AssocFn;

impl AssocFn {
    #[no_mangle]
    fn foo() {}
}
```
```rs
extern crate lib;

fn main() {
    extern "Rust" {
        fn foo();
    }
    unsafe { foo() }
}
```
</details>

But I believe they should link successfully, because this works:
<details>

```rs
#[no_mangle]
fn foo() {}

fn main() {
    extern "Rust" {
        fn foo();
    }
    unsafe { foo() }
}
```
([Playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=789b3f283ee6126f53939429103ed98d))
</details>

This PR fixes the problem, by adding associated functions that have "custom linkage" to `reachable_set`, just like normal functions.

I haven't tested whether #76211 and [Miri](https://github.com/rust-lang/miri/issues/1837) are fixed by this PR yet, but I'm submitting this anyway since this fixes the examples above.

I added a `run-pass` test that combines my two examples above, but I'm not sure if that's the right way to test this. Maybe I should add / modify an existing codegen test (`src/test/codegen/export-no-mangle.rs`?) instead?

2 years agoAuto merge of #87984 - m-ou-se:closure-lint-wording, r=Aaron1011
bors [Fri, 13 Aug 2021 16:57:34 +0000 (16:57 +0000)]
Auto merge of #87984 - m-ou-se:closure-lint-wording, r=Aaron1011

Closure lint wording

Some small changes to the wording of the closure migration lint.

r? `@Aaron1011`

2 years agoEnable `--all-targets` for `x.py check` unconditionally
Joshua Nelson [Fri, 13 Aug 2021 16:03:17 +0000 (11:03 -0500)]
Enable `--all-targets` for `x.py check` unconditionally

Now that Cargo deduplicates diagnostics from different targets, this doesn't flood the console with
duplicate errors.

Note that this doesn't add `--all-targets` in `Builder::cargo` directly because `impl Step for Std`
actually wants to omit `--all-targets` the first time while it's still building libtest.

When passed `--all-targets`, this warns that the option isn't needed, but still continues to compile.

2 years agoUpdate tests for new closure migration lint wording.
Mara Bos [Thu, 12 Aug 2021 19:13:00 +0000 (21:13 +0200)]
Update tests for new closure migration lint wording.

2 years agoUpdate closure migration diagnostic wording.
Mara Bos [Thu, 12 Aug 2021 19:12:12 +0000 (21:12 +0200)]
Update closure migration diagnostic wording.

2 years agoAuto merge of #88009 - GuillaumeGomez:rollup-f194yyk, r=GuillaumeGomez
bors [Fri, 13 Aug 2021 14:16:12 +0000 (14:16 +0000)]
Auto merge of #88009 - GuillaumeGomez:rollup-f194yyk, r=GuillaumeGomez

Rollup of 4 pull requests

Successful merges:

 - #87795 (Avoid ICE caused by suggestion)
 - #87966 (Fix `command-create-pidfd` test inside unprivileged Docker containers)
 - #87969 (Revert "Rollup merge of #87779 - Aaron1011:stmt-ast-id, r=petrochenkov")
 - #88005 (Add rustdoc GUI test for headers)

Failed merges:

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

2 years agoRollup merge of #88005 - GuillaumeGomez:headers-gui-tests, r=notriddle
Guillaume Gomez [Fri, 13 Aug 2021 13:29:12 +0000 (15:29 +0200)]
Rollup merge of #88005 - GuillaumeGomez:headers-gui-tests, r=notriddle

Add rustdoc GUI test for headers

Add test for #87861.

r? ``@notriddle``

2 years agoRollup merge of #87969 - Aaron1011:revert-stmt-id, r=petrochenkov
Guillaume Gomez [Fri, 13 Aug 2021 13:29:12 +0000 (15:29 +0200)]
Rollup merge of #87969 - Aaron1011:revert-stmt-id, r=petrochenkov

Revert "Rollup merge of #87779 - Aaron1011:stmt-ast-id, r=petrochenkov"

Fixes #87877

This change interacts badly with `noop_flat_map_stmt`,
which synthesizes multiple statements with the same `NodeId`.

I'm working on a better fix that will still allow us to
remove this special case. For now, let's revert the change
to fix the ICE.

This reverts commit a4262cc9841d91d48ef994b36eab323e615a7083, reversing
changes made to 8ee962f88e1be7e29482b13c7776c26b98a93bf7.

2 years agoRollup merge of #87966 - pietroalbini:fix-pidfd-test, r=m-ou-se
Guillaume Gomez [Fri, 13 Aug 2021 13:29:11 +0000 (15:29 +0200)]
Rollup merge of #87966 - pietroalbini:fix-pidfd-test, r=m-ou-se

Fix `command-create-pidfd` test inside unprivileged Docker containers

In `src/test/ui/command/command-create-pidfd.rs` (added #81825), the detection code to skip the test on unsupported platforms doesn't account for unprivileged Docker containers (CI uses privileged containers), which leads to a test failure as you can't call the `clone3` syscall in that environment. This PR enhances the detection code to also consider unprivileged containers.

2 years agoRollup merge of #87795 - estebank:erase-lifetimes-in-suggestion, r=oli-obk
Guillaume Gomez [Fri, 13 Aug 2021 13:29:10 +0000 (15:29 +0200)]
Rollup merge of #87795 - estebank:erase-lifetimes-in-suggestion, r=oli-obk

Avoid ICE caused by suggestion

When suggesting dereferencing something that can be iterable in a `for`
loop, erase lifetimes and use a fresh `ty::ParamEnv` to avoid 'region
constraints already solved' panic.

Fix #87657, fix #87709, fix #87651.

2 years agoImprove wording, correct -> tight.
Frank Steffahn [Fri, 13 Aug 2021 12:41:50 +0000 (14:41 +0200)]
Improve wording, correct -> tight.

2 years agoUpdate browser-ui-test package version
Guillaume Gomez [Fri, 13 Aug 2021 12:52:28 +0000 (14:52 +0200)]
Update browser-ui-test package version

2 years agoAdd rustdoc GUI test for headers
Guillaume Gomez [Fri, 13 Aug 2021 12:23:13 +0000 (14:23 +0200)]
Add rustdoc GUI test for headers

2 years agoFix Cargo.lock and ui test
Deadbeef [Fri, 13 Aug 2021 11:30:33 +0000 (11:30 +0000)]
Fix Cargo.lock and ui test

2 years agoUse is_diagnostic_item instead of get_diagnostic_item.
Mara Bos [Thu, 12 Aug 2021 17:21:46 +0000 (19:21 +0200)]
Use is_diagnostic_item instead of get_diagnostic_item.

2 years agoUpdate non-fmt-panic tests.
Mara Bos [Thu, 12 Aug 2021 17:15:47 +0000 (19:15 +0200)]
Update non-fmt-panic tests.

2 years agoConsistent use of `impl Trait` arguments in the test's helper function.
Frank Steffahn [Fri, 13 Aug 2021 10:02:03 +0000 (12:02 +0200)]
Consistent use of `impl Trait` arguments in the test's helper function.

2 years agonon_fmt_panic: machine app. suggestion for assert with string msg.
Mara Bos [Thu, 12 Aug 2021 17:14:54 +0000 (19:14 +0200)]
non_fmt_panic: machine app. suggestion for assert with string msg.

2 years agomake check less conservative and add explanation
Deadbeef [Tue, 27 Jul 2021 01:51:57 +0000 (09:51 +0800)]
make check less conservative and add explanation

2 years agoBless test
Deadbeef [Mon, 26 Jul 2021 10:02:18 +0000 (18:02 +0800)]
Bless test

2 years agoMake assoc types work with `?const `opt=out
Deadbeef [Mon, 26 Jul 2021 09:25:01 +0000 (17:25 +0800)]
Make assoc types work with `?const `opt=out

2 years agoallow incomplete features for now
Deadbeef [Mon, 26 Jul 2021 08:53:36 +0000 (16:53 +0800)]
allow incomplete features for now

2 years agoMoved ui test
Deadbeef [Mon, 26 Jul 2021 06:04:55 +0000 (14:04 +0800)]
Moved ui test

2 years agoFix tests
Deadbeef [Mon, 26 Jul 2021 04:29:18 +0000 (12:29 +0800)]
Fix tests

2 years agoFix call-generic-method-nonconst test
Deadbeef [Mon, 26 Jul 2021 04:06:55 +0000 (12:06 +0800)]
Fix call-generic-method-nonconst test

2 years agoDon't transform predicates in Inherited
Deadbeef [Mon, 26 Jul 2021 04:06:32 +0000 (12:06 +0800)]
Don't transform predicates in Inherited