Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update from upstream #1

Merged
merged 10,000 commits into from
May 22, 2020
Merged

update from upstream #1

merged 10,000 commits into from
May 22, 2020

Conversation

richkadel
Copy link
Owner

No description provided.

SOF3 and others added 30 commits May 15, 2020 22:41
PrefixComponent with Prefix::VerbatimDisk does not contain the trailing slash. The documentation here is also inconsistent with the documentation on other variants that reflect the `PrefixComponent::as_os_str()` return value.
unused_unit: lint also in type parameters and where clauses

changelog: unused_unit now also lints in type parameters and where clauses

Fixes #5585
Before:

    TokenStream [
        Ident {
            ident: "name",
            span: #0 bytes(37..41),
        },
        Punct {
            ch: '=',
            spacing: Alone,
            span: #0 bytes(42..43),
        },
        Literal { lit: Lit { kind: Str, symbol: "SNPP", suffix: None }, span: Span { lo: BytePos(44), hi: BytePos(50), ctxt: #0 } },
        Punct {
            ch: ',',
            spacing: Alone,
            span: #0 bytes(50..51),
        },
        Ident {
            ident: "owner",
            span: #0 bytes(56..61),
        },
        Punct {
            ch: '=',
            spacing: Alone,
            span: #0 bytes(62..63),
        },
        Literal { lit: Lit { kind: Str, symbol: "Canary M Burns", suffix: None }, span: Span { lo: BytePos(64), hi: BytePos(80), ctxt: #0 } },
    ]

After:

    TokenStream [
        Ident {
            ident: "name",
            span: #0 bytes(37..41),
        },
        Punct {
            ch: '=',
            spacing: Alone,
            span: #0 bytes(42..43),
        },
        Literal {
            kind: Str,
            symbol: "SNPP",
            suffix: None,
            span: #0 bytes(44..50),
        },
        Punct {
            ch: ',',
            spacing: Alone,
            span: #0 bytes(50..51),
        },
        Ident {
            ident: "owner",
            span: #0 bytes(56..61),
        },
        Punct {
            ch: '=',
            spacing: Alone,
            span: #0 bytes(62..63),
        },
        Literal {
            kind: Str,
            symbol: "Canary M Burns",
            suffix: None,
            span: #0 bytes(64..80),
        },
    ]
Downgrade useless_let_if_seq to nursery

I feel that this lint has the wrong balance of incorrect suggestions for a default-enabled lint.

The immediate code I faced was something like:

```rust
fn main() {
    let mut good = do1();
    if !do2() {
        good = false;
    }
    if good {
        println!("good");
    }
}

fn do1() -> bool { println!("1"); false }
fn do2() -> bool { println!("2"); false }
```

On this code Clippy calls it unidiomatic and suggests the following diff, which has different behavior in a way that I don't necessarily want.

```diff
- let mut good = do1();
- if !do2() {
-     good = false;
- }
+ let good = if !do2() {
+     false
+ } else {
+     do1()
+ };
```

On exploring issues filed about this lint, I have found that other users have also struggled with inappropriate suggestions (rust-lang/rust-clippy#4124, rust-lang/rust-clippy#3043, rust-lang/rust-clippy#2918, rust-lang/rust-clippy#2176) and suggestions that make the code worse (rust-lang/rust-clippy#3769, rust-lang/rust-clippy#2749). Overall I believe that this lint is still at nursery quality for now and should not be enabled.

---

changelog: Remove useless_let_if_seq from default set of enabled lints
Add explicit references to the BuildHasher trait

Fixes #71652
…ie27

Doc alias improvements

After [this message](#50146 (comment)), I realized that the **doc alias**. So this PR does the followings:

 * Align the alias discovery on items added into the search-index. It brings a few nice advantages:
   * Instead of cloning the data between the two (in rustdoc source code), we now have the search-index one and aliases which reference to the first one. So we go from one big map containing a lot of duplicated data to just integers...
 * In the front-end (main.js), I improved the code around aliases to allow them to go through the same transformation as other items when we show the search results.
 * Improve the search tester in order to perform multiple requests into one file (I think it's better in this case than having a file for each case considering how many there are...)
    * I also had to add the new function inside the tester (`handleAliases`)

Once this PR is merged, I intend to finally stabilize this feature.

r? @ollie27

cc @rust-lang/rustdoc
Suggest to await future before ? operator

Closes #71811
cc #61076
Suggest to await future before ? operator

Closes #71811
cc #61076
rustc_driver: factor out computing the exit code

In a recent Miri PR I [added a convenience wrapper](https://github.com/rust-lang/miri/pull/1405/files#diff-c3d602c5c8035a16699ce9c015bfeceaR125) around `catch_fatal_errors` and `run_compiler` that @oli-obk suggested I could upstream. However, after seeing what could be shared between `rustc_driver::main`, clippy and Miri, really the only thing I found is computing the exit code -- so that's what this PR does.

What prevents using the Miri convenience function in `rustc_driver::main` and clippy is that they do extra work inside `catch_fatal_errors`, and while I could abstract that away, clippy actually *computes the callbacks* inside there, and I fond no good way to abstract that and thus gave up. Maybe the clippy thing could be moved out, I am not sure if it ever can actually raise a `FatalErrorMarker` -- someone more knowledgeable in clippy would have to do that.
rustc_driver: factor out computing the exit code

In a recent Miri PR I [added a convenience wrapper](https://github.com/rust-lang/miri/pull/1405/files#diff-c3d602c5c8035a16699ce9c015bfeceaR125) around `catch_fatal_errors` and `run_compiler` that @oli-obk suggested I could upstream. However, after seeing what could be shared between `rustc_driver::main`, clippy and Miri, really the only thing I found is computing the exit code -- so that's what this PR does.

What prevents using the Miri convenience function in `rustc_driver::main` and clippy is that they do extra work inside `catch_fatal_errors`, and while I could abstract that away, clippy actually *computes the callbacks* inside there, and I fond no good way to abstract that and thus gave up. Maybe the clippy thing could be moved out, I am not sure if it ever can actually raise a `FatalErrorMarker` -- someone more knowledgeable in clippy would have to do that.
…ochenkov

Cleanup stale 'FIXME(#64197)'

(My first PR in rust-lang, any feedback is welcome. Please don't hesitate to let me know if I'm trying to do something pointless!)

Trivial cleanup of a stale `FIXME`, `StringReader.pos` is no longer exposed. For testing added `pos()` method that returns cloned value of `pos`.
make sure even unleashed miri does not do pointer stuff

r? @oli-obk
[const-prop] Don't replace Rvalues that are already constants

This cleans up a few mir-opt tests which have slight changes to spans for `consts` as a result of replacing them with new Rvalues.
doc: add links to rotate_(left|right)
Rollup of 9 pull requests

Successful merges:

 - #71662 (Implement FromStr for OsString)
 - #71677 (Add explicit references to the BuildHasher trait)
 - #71724 (Doc alias improvements)
 - #71948 (Suggest to await future before ? operator)
 - #72090 (rustc_driver: factor out computing the exit code)
 - #72206 (Cleanup stale 'FIXME(#64197)')
 - #72218 (make sure even unleashed miri does not do pointer stuff)
 - #72220 ([const-prop] Don't replace Rvalues that are already constants)
 - #72224 (doc: add links to rotate_(left|right))

Failed merges:

r? @ghost
The value passed in already has backticks surrounding the text.
update stacker to 0.1.9 to unbreak build on OpenBSD

the version 0.1.8 of stacker (what is currently pinned in Cargo.lock) doesn't build on OpenBSD (see rust-lang/stacker#34).

update the version to 0.1.9
Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
Miri interning: replace ICEs by proper errors

Fixes #71316

I also did some refactoring, as I kept being confused by all the parameters to `intern_shallow`, some of which have invalid combinations (such as a mutable const). So instead `InternMode` now contains all the information that is needed and invalid combinations are ruled out by the type system.

Also I removed interpreter errors from interning. We already ignored almost all errors, and the `ValidationFailure` errors that we handled separately actually cannot ever happen here. The only interpreter failure that was actually reachable was the UB on dangling pointers -- and arguably, a dangling raw pointer is not UB, so the error was not even correct. It's just that the rest of the compiler does not like "dangling" `AllocId`.

It should be possible to review the 3 commits separately.

r? @oli-obk
Cc @rust-lang/wg-const-eval
identity_op: allow `1 << 0`

I went for accepting `1 << 0` verbatim instead of something more general as it seems to be what everyone in the issue thread needed.

changelog: identity_op: allow `1 << 0` as it's a common pattern in bit manipulation code.

Fixes #3430
Fix comparison_chain false positive

changelog: comparison_chain: fix false positives when the binary operation is the same.

Fixes #5212
mati865 and others added 20 commits May 20, 2020 17:40
Workaround MSYS2/chocolatey issue again
Rollup of 6 pull requests

Successful merges:

 - #71863 (Suggest fixes and add error recovery for `use foo::self`)
 - #72139 (Make `fold` standalone.)
 - #72275 (Continue lowering for unsupported async generator instead of returning an error.)
 - #72361 (split_inclusive: add tracking issue number (72360))
 - #72364 (Remove unused dependencies)
 - #72366 (Adjust the zero check in `RawVec::grow`.)

Failed merges:

r? @ghost
Update to LLVM 10

LLVM 10 is going to be branched soon, so it's a good time to start finding all those tasty new miscompiles and performance regressions ;)

Status:

 * Preparation split off into #67900.
 * Optimization regressions:
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44419 => https://reviews.llvm.org/D72048 has landed.
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44423 => https://reviews.llvm.org/D72060 has landed.
   * [x] https://reviews.llvm.org/D72169 submitted.
   * [ ] https://bugs.llvm.org/show_bug.cgi?id=44461 reported. https://reviews.llvm.org/D72420 submitted, but unlikely eligible for LLVM 10.
 * Compile-time regressions:
   * [x] GlobalOpt regression identified. ~~fhahn proposed https://reviews.llvm.org/D72214.~~ fhahn has [reverted](llvm/llvm-project@192cce1) the patch.
   * [ ] Even with the revert, there are [large regressions](https://perf.rust-lang.org/compare.html?start=760ce94c69ca510d44087291c311296f6d9ccdf5&end=4e84f97d76e694bb9f59039f5bdeb6d8bca46d14).
 * Assertion failures / infinite loops:
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44600 => https://reviews.llvm.org/D73135, https://reviews.llvm.org/D73854 and https://reviews.llvm.org/D73908 have landed and been cherry-picked to the 10.x branch.
   * [x] https://bugs.llvm.org/show_bug.cgi?id=44835 => https://reviews.llvm.org/D74278 has landed and been cherry-picked.
Use `T`'s discriminant type in `mem::Discriminant<T>` instead of `u64`.

fixes #70509

Adds the lang-item `discriminant_kind`.
Updates the function signature of `intrinsics::discriminant_value`.
Adds the *probably permanently unstable* trait `DiscriminantKind`.
`mem::Discriminant` should now be smaller in some cases.

r? @ghost
Dumb NRVO

This is a very simple version of an NRVO pass, which scans backwards from the `return` terminator to see if there is an an assignment like `_0 = _1`. If a basic block with two or more predecessors is encountered during this scan without first seeing an assignment to the return place, we bail out. This avoids running a full "reaching definitions" dataflow analysis.

I wanted to see how much `rustc` would benefit from even a very limited version of this optimization. We should be able to use this as a point of comparison for more advanced versions that are based on live ranges.

r? @ghost
…nieu

Make `std::char` functions and constants associated to `char`.

First step to fix #71763.
rustc-book: Document `-Z strip=val` option

cc #72110
…behaviour, r=kinnison

Fix going back in history to a search result page on firefox

This bug was actually firefox not re-running JS script when you go back in history. To trigger it on the current docs:

 * Make a search
 * Pick an element (which isn't on the same page as the current element!)
 * Go back in history

Instead of having the search results, you'll see the normal doc page. You can find a small explanation about it [here](http://web.archive.org/web/20100428053932/http://www.firefoxanswer.com/firefox/672-firefoxanswer.html).

r? @kinnison

cc @ollie27
Suggest installing VS Build Tools in more situations

When MSVC's `link.exe` wasn't found but another `link.exe` was, the error message given can be [impenetrable](https://pastebin.com/MRMCr7HM) to many users. The usual suspect is GNU's `link` tool. In this case, inform the user that they may need to install VS build tools.

This only applies when Microsoft's link tool is expected.
…c-morse

Remove unused `StableHashingContext::node_to_hir_id` method

cc #50928
FIX - Char documentation for unexperienced users

This is my first PR on rust and even if I've read [CONTRIBUTING.md](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#pull-requests) I'm ensure everything is perfect. Sorry if I didn't follow the exact procedure.

**What it does:**
- Add an example in the char documentation

**Explanation**
Unexperienced users might not know that punctuation is `Case_Ignorable` and not `Uppercase` and `Lowercase` which mean that when checking if a string is uppercase one might be tempted to write:
```rust
my_string.chars().all(char::is_uppercase)
```

However this will return false for `"HELLO WORLD"` which is not intuitive. Since the function `is_case_ignorable` doesn't exists I believe the correct way to check is:
```rust
!my_string.chars().any(char::is_lowercase)
```

The aim of this example is to prevent unexperienced users to make an error which punctuation chars.
llvm: Expose tiny code model to users

This model is relevant to embedded AArch64 targets and was added to LLVM relatively recently (https://reviews.llvm.org/D49673, mid 2018), so rustc frontend didn't provide access to it with `-C code-model`. The gcc analogue is [`-mcmodel=tiny`](https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html).
(This is one of the options that are passed directly to LLVM without being interpreted by rustc.)

Follow up to #72248.
Rollup of 7 pull requests

Successful merges:

 - #71854 (Make `std::char` functions and constants associated to `char`.)
 - #72111 (rustc-book: Document `-Z strip=val` option)
 - #72272 (Fix going back in history to a search result page on firefox)
 - #72296 (Suggest installing VS Build Tools in more situations)
 - #72365 (Remove unused `StableHashingContext::node_to_hir_id` method)
 - #72371 (FIX - Char documentation for unexperienced users)
 - #72397 (llvm: Expose tiny code model to users)

Failed merges:

r? @ghost
Experimentally add `ffi_const` and `ffi_pure` extern fn attributes

Add FFI function attributes corresponding to clang/gcc/... `const` and `pure`.

Rebased version of #58327 by @gnzlbg with the following changes:

- Switched back from the `c_ffi_const` and `c_ffi_pure` naming to `ffi_const` and `ffi_pure`, as I agree with #58327 (comment) and this nicely aligns with `ffi_returns_twice`
- (Hopefully) took care of all of @hanna-kruppe's change requests in the original PR

r? @hanna-kruppe
De-abuse TyKind::Error in exhaustiveness checking

Replaces #71074. Context: #70866.

In order to remove the use of `TyKind::Error`, I had to make sure we skip over those fields whose inhabitedness should not be observed. This is potentially error-prone however, since we must be careful not to mix filtered and unfiltered lists of patterns. I managed to hide away most of the filtering behind a new `Fields` struct, that I used everywhere relevant. I quite like the result; I think the twin concepts of `Constructor` and `Fields` make a good mental model.

As usual, I tried to separate commits that shuffle code around from commits that require more thought to review.

cc @varkor @Centril
@richkadel richkadel merged commit a6127e3 into richkadel:master May 22, 2020
richkadel pushed a commit that referenced this pull request Jun 10, 2020
…ing opaque return type

Go from

```
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
  --> file8.rs:22:5
   |
22 | /     move || {
23 | |         *dest = g.get();
24 | |     }
   | |_____^
   |
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 18:1...
  --> file8.rs:18:1
   |
18 | / fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
19 | | where
20 | |     G: Get<T>
21 | | {
...  |
24 | |     }
25 | | }
   | |_^
note: ...so that the types are compatible
  --> file8.rs:22:5
   |
22 | /     move || { //~ ERROR cannot infer an appropriate lifetime
23 | |         *dest = g.get();
24 | |     }
   | |_____^
   = note: expected  `&mut T`
              found  `&mut T`
note: but, the lifetime must be valid for the lifetime `'a` as defined on the function body at 18:8...
  --> file8.rs:18:8
   |
18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
   |        ^^
note: ...so that return value is valid for the call
  --> file8.rs:18:45
   |
18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
   |                                             ^^^^^^^^^^^^^^^^^^^^^^^
```

to

```
error[E0621]: explicit lifetime required in the type of `dest`
  --> file8.rs:18:45
   |
18 | fn bat<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ + 'a
   |                                  ------     ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
   |                                  |
   |                                  help: add explicit lifetime `'a` to the type of `dest`: `&'a mut T`
   ```
richkadel pushed a commit that referenced this pull request Sep 22, 2020
* Fix `const-display.rs` XPATH queries

* Add `issue_76501.rs` test file

* Rename issue_76501.rs to issue-76501.rs
richkadel pushed a commit that referenced this pull request Nov 16, 2020
Before:

```
2:rustc INFO rustc_interface::passes Pre-codegen
2:rustcTy interner             total           ty lt ct all
2:rustc    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
2:rustc    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
2:rustc    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc                  total   1326         0.2%   0.1%  0.0%  0.0%
2:rustcInternalSubsts interner: rust-lang#437
2:rustcRegion interner: rust-lang#355
2:rustcStability interner: #1
2:rustcConst Stability interner: #0
2:rustcAllocation interner: #0
2:rustcLayout interner: #0
```

After:

```
 INFO rustc_interface::passes Post-codegen
Ty interner             total           ty lt ct all
    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
                  total   1326         0.2%   0.1%  0.0%  0.0%
InternalSubsts interner: rust-lang#437
Region interner: rust-lang#355
Stability interner: #1
Const Stability interner: #0
Allocation interner: #0
Layout interner: #0
```
richkadel pushed a commit that referenced this pull request Nov 16, 2020
Don't print thread ids and names in `tracing` logs

Before:

```
2:rustc INFO rustc_interface::passes Pre-codegen
2:rustcTy interner             total           ty lt ct all
2:rustc    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
2:rustc    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
2:rustc    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
2:rustc    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
2:rustc                  total   1326         0.2%   0.1%  0.0%  0.0%
2:rustcInternalSubsts interner: rust-lang#437
2:rustcRegion interner: rust-lang#355
2:rustcStability interner: #1
2:rustcConst Stability interner: #0
2:rustcAllocation interner: #0
2:rustcLayout interner: #0
```

After:

```
 INFO rustc_interface::passes Post-codegen
Ty interner             total           ty lt ct all
    Adt               :   1078 81.3%,  0.0%   0.0%  0.0%  0.0%
    Array             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    Slice             :      1  0.1%,  0.0%   0.0%  0.0%  0.0%
    RawPtr            :      2  0.2%,  0.0%   0.0%  0.0%  0.0%
    Ref               :      4  0.3%,  0.1%   0.1%  0.0%  0.0%
    FnDef             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    FnPtr             :     76  5.7%,  0.0%   0.0%  0.0%  0.0%
    Placeholder       :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Generator         :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    GeneratorWitness  :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Dynamic           :      3  0.2%,  0.0%   0.0%  0.0%  0.0%
    Closure           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Tuple             :     13  1.0%,  0.0%   0.0%  0.0%  0.0%
    Bound             :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Param             :    146 11.0%,  0.0%   0.0%  0.0%  0.0%
    Infer             :      2  0.2%,  0.1%   0.0%  0.0%  0.0%
    Projection        :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Opaque            :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
    Foreign           :      0  0.0%,  0.0%   0.0%  0.0%  0.0%
                  total   1326         0.2%   0.1%  0.0%  0.0%
InternalSubsts interner: rust-lang#437
Region interner: rust-lang#355
Stability interner: #1
Const Stability interner: #0
Allocation interner: #0
Layout interner: #0
```

Closes rust-lang#78931
r? ``@oli-obk``
richkadel pushed a commit that referenced this pull request Nov 29, 2020
```
Benchmark #1: ./raytracer_cg_clif_pre
  Time (mean ± σ):      9.553 s ±  0.129 s    [User: 9.543 s, System: 0.008 s]
  Range (min … max):    9.438 s …  9.837 s    10 runs

Benchmark #2: ./raytracer_cg_clif_post
  Time (mean ± σ):      9.463 s ±  0.055 s    [User: 9.452 s, System: 0.008 s]
  Range (min … max):    9.387 s …  9.518 s    10 runs

Summary
  './raytracer_cg_clif_post' ran
    1.01 ± 0.01 times faster than './raytracer_cg_clif_pre'
```
richkadel pushed a commit that referenced this pull request Nov 29, 2020
Don't run `resolve_vars_if_possible` in `normalize_erasing_regions`

Neither `@eddyb` nor I could figure out what this was for. I changed it to `assert_eq!(normalized_value, infcx.resolve_vars_if_possible(&normalized_value));` and it passed the UI test suite.

<details><summary>

Outdated, I figured out the issue - `needs_infer()` needs to come _after_ erasing the lifetimes

</summary>

Strangely, if I change it to `assert!(!normalized_value.needs_infer())` it panics almost immediately:

```
query stack during panic:
#0 [normalize_generic_arg_after_erasing_regions] normalizing `<str::IsWhitespace as str::pattern::Pattern>::Searcher`
#1 [needs_drop_raw] computing whether `str::iter::Split<str::IsWhitespace>` needs drop
#2 [mir_built] building MIR for `str::<impl str>::split_whitespace`
#3 [unsafety_check_result] unsafety-checking `str::<impl str>::split_whitespace`
#4 [mir_const] processing MIR for `str::<impl str>::split_whitespace`
#5 [mir_promoted] processing `str::<impl str>::split_whitespace`
#6 [mir_borrowck] borrow-checking `str::<impl str>::split_whitespace`
#7 [analysis] running analysis passes on this crate
end of query stack
```

I'm not entirely sure what's going on - maybe the two disagree?

</details>

For context, this came up while reviewing rust-lang#77467 (cc `@lcnr).`

Possibly this needs a crater run?

r? `@nikomatsakis`
cc `@matthewjasper`
richkadel pushed a commit that referenced this pull request Mar 19, 2021
HWAddressSanitizer support

#  Motivation
Compared to regular ASan, HWASan has a [smaller overhead](https://source.android.com/devices/tech/debug/hwasan). The difference in practice is that HWASan'ed code is more usable, e.g. Android device compiled with HWASan can be used as a daily driver.

# Example
```
fn main() {
    let xs = vec![0, 1, 2, 3];
    let _y = unsafe { *xs.as_ptr().offset(4) };
}
```
```
==223==ERROR: HWAddressSanitizer: tag-mismatch on address 0xefdeffff0050 at pc 0xaaaad00b3468
READ of size 4 at 0xefdeffff0050 tags: e5/00 (ptr/mem) in thread T0
    #0 0xaaaad00b3464  (/root/main+0x53464)
    #1 0xaaaad00b39b4  (/root/main+0x539b4)
    #2 0xaaaad00b3dd0  (/root/main+0x53dd0)
    #3 0xaaaad00b61dc  (/root/main+0x561dc)
    #4 0xaaaad00c0574  (/root/main+0x60574)
    #5 0xaaaad00b6290  (/root/main+0x56290)
    #6 0xaaaad00b6170  (/root/main+0x56170)
    #7 0xaaaad00b3578  (/root/main+0x53578)
    #8 0xffff81345e70  (/lib64/libc.so.6+0x20e70)
    #9 0xaaaad0096310  (/root/main+0x36310)

[0xefdeffff0040,0xefdeffff0060) is a small allocated heap chunk; size: 32 offset: 16
0xefdeffff0050 is located 0 bytes to the right of 16-byte region [0xefdeffff0040,0xefdeffff0050)
allocated here:
    #0 0xaaaad009bcdc  (/root/main+0x3bcdc)
    #1 0xaaaad00b1eb0  (/root/main+0x51eb0)
    #2 0xaaaad00b20d4  (/root/main+0x520d4)
    #3 0xaaaad00b2800  (/root/main+0x52800)
    #4 0xaaaad00b1cf4  (/root/main+0x51cf4)
    #5 0xaaaad00b33d4  (/root/main+0x533d4)
    #6 0xaaaad00b39b4  (/root/main+0x539b4)
    #7 0xaaaad00b61dc  (/root/main+0x561dc)
    #8 0xaaaad00b3578  (/root/main+0x53578)
    #9 0xaaaad0096310  (/root/main+0x36310)

Thread: T0 0xeffe00002000 stack: [0xffffc0590000,0xffffc0d90000) sz: 8388608 tls: [0xffff81521020,0xffff815217d0)
Memory tags around the buggy address (one tag corresponds to 16 bytes):
  0xfefcefffef80: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefcefffef90: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefcefffefa0: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefcefffefb0: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefcefffefc0: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefcefffefd0: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefcefffefe0: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefcefffeff0: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
=>0xfefceffff000: a2  a2  05  00  e5 [00] 00  00  00  00  00  00  00  00  00  00
  0xfefceffff010: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefceffff020: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefceffff030: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefceffff040: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefceffff050: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefceffff060: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefceffff070: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
  0xfefceffff080: 00  00  00  00  00  00  00  00  00  00  00  00  00  00  00  00
Tags for short granules around the buggy address (one tag corresponds to 16 bytes):
  0xfefcefffeff0: ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
=>0xfefceffff000: ..  ..  c5  ..  .. [..] ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
  0xfefceffff010: ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..  ..
See https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html#short-granules for a description of short granule tags
Registers where the failure occurred (pc 0xaaaad00b3468):
    x0  e500efdeffff0050  x1  0000000000000004  x2  0000ffffc0d8f5a0  x3  0200efff00000000
    x4  0000ffffc0d8f4c0  x5  000000000000004f  x6  00000ffffc0d8f36  x7  0000efff00000000
    x8  e500efdeffff0050  x9  0200efff00000000  x10 0000000000000000  x11 0200efff00000000
    x12 0200effe000006b0  x13 0200effe000006b0  x14 0000000000000008  x15 00000000c00000cf
    x16 0000aaaad00a0afc  x17 0000000000000003  x18 0000000000000001  x19 0000ffffc0d8f718
    x20 ba00ffffc0d8f7a0  x21 0000aaaad00962e0  x22 0000000000000000  x23 0000000000000000
    x24 0000000000000000  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
    x28 0000000000000000  x29 0000ffffc0d8f650  x30 0000aaaad00b3468
```

# Comments/Caveats
* HWASan is only supported on arm64.
* I'm not sure if I should add a feature gate or piggyback on the existing one for sanitizers.
* HWASan requires `-C target-feature=+tagged-globals`. That flag should probably be set transparently to the user. Not sure how to go about that.

# TODO
* Need more tests.
* Update documentation.
* Fix symbolization.
* Integrate with CI
richkadel pushed a commit that referenced this pull request Mar 19, 2021
bypass auto_da_alloc for metadata files

This saves about 0.7% when rerunning the UI test suite. I.e. when the metadata files exist and will be overwritten. No improvements expected for a clean build. So it might show up in incr-patched perf results.
```
regular rename:

Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui
  Time (mean ± σ):     47.305 s ±  0.170 s    [User: 1631.540 s, System: 412.648 s]
  Range (min … max):   47.125 s … 47.856 s    20 runs

non-durable rename:

Benchmark #1: touch src/tools/compiletest/src/main.rs ; RUSTC_WRAPPER="" schedtool -B -e ./x.py test src/test/ui
  Time (mean ± σ):     46.930 s ±  0.064 s    [User: 1634.344 s, System: 396.038 s]
  Range (min … max):   46.759 s … 47.043 s    20 runs
```

There are more places that trigger auto_da_alloc behavior by overwriting existing files with O_TRUNC, but those are much harder to locate because `O_TRUNC` is set on `open()` but the writeback is triggered on `close()`. The latter is the part which shows up in profiles.
richkadel pushed a commit that referenced this pull request May 11, 2021
…nt, r=Mark-Simulacrum

Show nicer error when an 'unstable fingerprints' error occurs

An example of the error produced by this PR:

```
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(9f2ad55260c30262-c36667639674ad83)
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p syn` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information

thread 'rustc' panicked at 'Found unstable fingerprints for evaluate_obligation(9f2ad55260c30262-c36667639674ad83): Ok(EvaluatedToOk)', /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:595:9
stack backtrace:
   0: rust_begin_unwind
             at /home/aaron/repos/rust/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /home/aaron/repos/rust/library/std/src/panicking.rs:435:5
   2: rustc_query_system::query::plumbing::incremental_verify_ich
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:595:9
   3: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:557:9
   4: rustc_query_system::query::plumbing::try_execute_query::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:473:21
   5: core::option::Option<T>::map
             at /home/aaron/repos/rust/library/core/src/option.rs:487:29
   6: rustc_query_system::query::plumbing::try_execute_query::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:471:13
   7: stacker::maybe_grow
             at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
   8: rustc_data_structures::stack::ensure_sufficient_stack
             at /home/aaron/repos/rust/compiler/rustc_data_structures/src/stack.rs:16:5
   9: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:169:17
  10: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
  11: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
  12: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
  13: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:168:13
  14: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1780:13
  15: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40
  16: rustc_middle::ty::context::tls::with_context_opt
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22
  17: rustc_middle::ty::context::tls::with_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9
  18: rustc_middle::ty::context::tls::with_related_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1777:9
  19: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:157:9
  20: rustc_query_system::query::plumbing::try_execute_query
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:469:22
  21: rustc_query_system::query::plumbing::get_query_impl
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:674:5
  22: rustc_query_system::query::plumbing::get_query
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:785:9
  23: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::evaluate_obligation
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:603:17
  24: rustc_middle::ty::query::TyCtxtAt::evaluate_obligation
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:204:17
  25: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::evaluate_obligation
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:185:17
  26: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
             at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:72:9
  27: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
             at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:82:15
  28: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_modulo_regions
             at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs:58:9
  29: rustc_trait_selection::traits::type_known_to_meet_bound_modulo_regions
             at /home/aaron/repos/rust/compiler/rustc_trait_selection/src/traits/mod.rs:146:18
  30: rustc_ty_utils::common_traits::is_item_raw::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_ty_utils/src/common_traits.rs:33:9
  31: rustc_infer::infer::InferCtxtBuilder::enter
             at /home/aaron/repos/rust/compiler/rustc_infer/src/infer/mod.rs:582:9
  32: rustc_ty_utils::common_traits::is_item_raw
             at /home/aaron/repos/rust/compiler/rustc_ty_utils/src/common_traits.rs:32:5
  33: rustc_query_system::query::config::QueryVtable<CTX,K,V>::compute
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/config.rs:44:9
  34: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:544:67
  35: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:46
  36: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
  37: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
  38: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
  39: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:13
  40: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40
  41: rustc_middle::ty::context::tls::with_context_opt
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22
  42: rustc_middle::ty::context::tls::with_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9
  43: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:74:9
  44: rustc_query_system::dep_graph::graph::DepGraph<K>::with_ignore
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:167:9
  45: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:544:22
  46: rustc_query_system::query::plumbing::try_execute_query::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:473:21
  47: core::option::Option<T>::map
             at /home/aaron/repos/rust/library/core/src/option.rs:487:29
  48: rustc_query_system::query::plumbing::try_execute_query::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:471:13
  49: stacker::maybe_grow
             at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
  50: rustc_data_structures::stack::ensure_sufficient_stack
             at /home/aaron/repos/rust/compiler/rustc_data_structures/src/stack.rs:16:5
  51: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:169:17
  52: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
  53: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
  54: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
  55: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:168:13
  56: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1780:13
  57: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40
  58: rustc_middle::ty::context::tls::with_context_opt
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22
  59: rustc_middle::ty::context::tls::with_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9
  60: rustc_middle::ty::context::tls::with_related_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1777:9
  61: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query
             at /home/aaron/repos/rust/compiler/rustc_query_impl/src/plumbing.rs:157:9
  62: rustc_query_system::query::plumbing::try_execute_query
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:469:22
  63: rustc_query_system::query::plumbing::get_query_impl
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:674:5
  64: rustc_query_system::query::plumbing::get_query
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/query/plumbing.rs:785:9
  65: rustc_middle::ty::query::TyCtxtAt::is_unpin_raw
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/query/mod.rs:204:17
  66: rustc_middle::ty::util::<impl rustc_middle::ty::TyS>::is_unpin
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/util.rs:727:38
  67: rustc_middle::ty::layout::<impl rustc_target::abi::TyAndLayoutMethods<C> for &rustc_middle::ty::TyS>::pointee_info_at
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2341:32
  68: rustc_target::abi::TyAndLayout<Ty>::pointee_info_at
             at /home/aaron/repos/rust/compiler/rustc_target/src/abi/mod.rs:1164:9
  69: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2781:36
  70: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2840:17
  71: rustc_target::abi::call::ArgAbi<Ty>::new
             at /home/aaron/repos/rust/compiler/rustc_target/src/abi/call/mod.rs:457:53
  72: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2838:27
  73: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2870:32
  74: core::iter::adapters::map::map_fold::{{closure}}
             at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:82:28
  75: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold::enumerate::{{closure}}
             at /home/aaron/repos/rust/library/core/src/iter/adapters/enumerate.rs:104:27
  76: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/aaron/repos/rust/library/core/src/ops/function.rs:269:13
  77: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /home/aaron/repos/rust/library/core/src/ops/function.rs:269:13
  78: core::iter::adapters::map::map_fold::{{closure}}
             at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:82:21
  79: core::iter::traits::iterator::Iterator::fold
             at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:2146:21
  80: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:122:9
  81: <core::iter::adapters::cloned::Cloned<I> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/cloned.rs:58:9
  82: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/chain.rs:119:19
  83: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/chain.rs:119:19
  84: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/enumerate.rs:110:9
  85: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /home/aaron/repos/rust/library/core/src/iter/adapters/map.rs:122:9
  86: core::iter::traits::iterator::Iterator::for_each
             at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:776:9
  87: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
             at /home/aaron/repos/rust/library/alloc/src/vec/spec_extend.rs:40:17
  88: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
             at /home/aaron/repos/rust/library/alloc/src/vec/spec_from_iter_nested.rs:56:9
  89: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
             at /home/aaron/repos/rust/library/alloc/src/vec/spec_from_iter.rs:36:9
  90: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
             at /home/aaron/repos/rust/library/alloc/src/vec/mod.rs:2448:9
  91: core::iter::traits::iterator::Iterator::collect
             at /home/aaron/repos/rust/library/core/src/iter/traits/iterator.rs:1788:9
  92: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::new_internal
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2864:19
  93: <rustc_target::abi::call::FnAbi<&rustc_middle::ty::TyS> as rustc_middle::ty::layout::FnAbiExt<C>>::of_instance
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/layout.rs:2670:9
  94: rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods for rustc_codegen_llvm::context::CodegenCx>::predefine_fn
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/mono_item.rs:57:22
  95: <rustc_middle::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::predefine
             at /home/aaron/repos/rust/compiler/rustc_codegen_ssa/src/mono_item.rs:76:17
  96: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/base.rs:122:17
  97: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:235:62
  98: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:46
  99: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
 100: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
 101: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
 102: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:77:13
 103: rustc_middle::ty::context::tls::with_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:40
 104: rustc_middle::ty::context::tls::with_context_opt
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1753:22
 105: rustc_middle::ty::context::tls::with_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1764:9
 106: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
             at /home/aaron/repos/rust/compiler/rustc_middle/src/dep_graph/mod.rs:74:9
 107: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:235:26
 108: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
             at /home/aaron/repos/rust/compiler/rustc_query_system/src/dep_graph/graph.rs:205:9
 109: rustc_codegen_llvm::base::compile_codegen_unit
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/base.rs:103:9
 110: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::ExtraBackendMethods>::compile_codegen_unit
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/lib.rs:109:9
 111: rustc_codegen_ssa::base::codegen_crate
             at /home/aaron/repos/rust/compiler/rustc_codegen_ssa/src/base.rs:655:38
 112: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
             at /home/aaron/repos/rust/compiler/rustc_codegen_llvm/src/lib.rs:270:18
 113: rustc_interface::passes::start_codegen::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:1021:9
 114: rustc_data_structures::profiling::VerboseTimingGuard::run
             at /home/aaron/repos/rust/compiler/rustc_data_structures/src/profiling.rs:573:9
 115: rustc_session::utils::<impl rustc_session::session::Session>::time
             at /home/aaron/repos/rust/compiler/rustc_session/src/utils.rs:16:9
 116: rustc_interface::passes::start_codegen
             at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:1020:19
 117: rustc_interface::queries::Queries::ongoing_codegen::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:296:20
 118: rustc_interface::passes::QueryContext::enter::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:755:42
 119: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:50
 120: rustc_middle::ty::context::tls::set_tlv
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1720:9
 121: rustc_middle::ty::context::tls::enter_context
             at /home/aaron/repos/rust/compiler/rustc_middle/src/ty/context.rs:1736:9
 122: rustc_interface::passes::QueryContext::enter
             at /home/aaron/repos/rust/compiler/rustc_interface/src/passes.rs:755:9
 123: rustc_interface::queries::Queries::ongoing_codegen::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:287:13
 124: rustc_interface::queries::Query<T>::compute
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:40:28
 125: rustc_interface::queries::Queries::ongoing_codegen
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:285:9
 126: rustc_driver::run_compiler::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_driver/src/lib.rs:442:13
 127: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
             at /home/aaron/repos/rust/compiler/rustc_interface/src/queries.rs:428:19
 128: rustc_driver::run_compiler::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_driver/src/lib.rs:337:22
 129: rustc_interface::interface::create_compiler_and_run::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:208:13
 130: rustc_span::with_source_map
             at /home/aaron/repos/rust/compiler/rustc_span/src/lib.rs:788:5
 131: rustc_interface::interface::create_compiler_and_run
             at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:202:5
 132: rustc_interface::interface::run_compiler::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/interface.rs:224:12
 133: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:155:13
 134: scoped_tls::ScopedKey<T>::set
             at /home/aaron/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
 135: rustc_span::with_session_globals
             at /home/aaron/repos/rust/compiler/rustc_span/src/lib.rs:105:5
 136: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:153:9
 137: rustc_interface::util::scoped_thread::{{closure}}
             at /home/aaron/repos/rust/compiler/rustc_interface/src/util.rs:128:24
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.54.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `quote::Tokens: std::marker::Unpin`
#1 [is_unpin_raw] computing whether `quote::Tokens` is `Unpin`
end of query stack
error: aborting due to previous error

error: could not compile `syn`

To learn more, run the command again with --verbose.
```

I've left in the panic and ICE following the pretty error, so that we still have all of the debug information available in a bug report.

This message can be reproduced by cloning the repository `https://github.com/Aaron1011/syn-crash`, and running the following shell script (with a `rustup override` set in the directory):

```
set -xe
cargo clean -p syn
cargo clean --release -p syn

git checkout minimize
cargo build --release -j 1

git checkout minimize-change
cargo build --release -j 1
```

r? ``@Mark-Simulacrum``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.