Commit graph

133002 commits

Author SHA1 Message Date
Aman Arora
bb8c5e5d8b Fix case when ExprUseVisitor is called after typeck writeback
Clippy uses `ExprUseVisitor` and atleast in some cases it runs
after writeback.

We currently don't writeback the min_capture results of closure
capture analysis since no place within the compiler itself uses it.

In the short term to fix clippy we add a fallback when walking captures
of a closure to check if closure_capture analysis has any entries in it.

Writeback for closure_min_captures will be implemented in
rust-lang/project-rfc-2229#18
2020-11-15 17:09:51 -05:00
Aman Arora
c50e57f946 Log closure as well 2020-11-13 16:10:12 -05:00
Aman Arora
d0fac05d8f Add test for capturing enums 2020-11-10 22:54:04 -05:00
Aman Arora
deeb025f39 Address review comments 2 2020-11-10 20:58:58 -05:00
Aman Arora
43423f67a0 Address review comments 2020-11-10 20:58:57 -05:00
Aman Arora
abc40040be Remove local testing env var 2020-11-10 20:58:57 -05:00
Aman Arora
be77402ee3 More pattern testcases 2020-11-10 20:58:56 -05:00
Aman Arora
fa381600dc Handle let _ = x patterns in closure liveness analysis 2020-11-10 20:58:56 -05:00
Roxane Fruytier
825e9e45d1 Reduce verbosity of capture analysis logs
Co-authored-by: Jenny Wills <wills.jenniferg@gmail.com>
Co-authored-by: Aman Arora <me@aman-arora.com>
2020-11-10 20:58:55 -05:00
Aman Arora
b16815b58d Update tests with min capture information
Co-authored-by: Chris Pardy <chrispardy36@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-11-10 20:58:55 -05:00
Aman Arora
8f0c0d656d Initial work for doing minimum capture analysis for RFC-2229
Co-authored-by: Chris Pardy <chrispardy36@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-11-10 20:58:54 -05:00
Aman Arora
145312075f Add helper function for Capture Esclations and expressions
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
2020-11-10 20:58:53 -05:00
Aman Arora
58e8f8fd2c Add initial set of testcases for RFC 2229
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
2020-11-10 20:58:52 -05:00
Aman Arora
88310cc0eb Indroduce feature flag for RFC-2229
Signed-off-by: Aman Arora <me@aman-arora.com>
2020-11-10 20:58:28 -05:00
Aman Arora
127a6ede1d Use Places to express closure/generator Captures
Co-authored-by: Archer Zhang <archer.xn@gmail.com>
2020-11-10 20:44:47 -05:00
bors
cf9cf7c923 Auto merge of #78904 - Dylan-DPC:rollup-8d2w3vu, r=Dylan-DPC
Rollup of 12 pull requests

Successful merges:

 - #74754 (Add `#[cfg(panic = '...')]`)
 - #76468 (Improve lifetime name annotations for closures & async functions)
 - #77016 (Test clippy on PR CI on changes)
 - #78480 (BTreeMap: fix pointer provenance rules)
 - #78502 (Update Chalk to 0.36.0)
 - #78513 (Infer the default host target from the host toolchain if possible)
 - #78566 (Enable LLVM Polly via llvm-args.)
 - #78580 (inliner: Break inlining cycles)
 - #78710 (rustc_ast: Do not panic by default when visiting macro calls)
 - #78746 (Demote i686-unknown-freebsd to tier 2 compiler target)
 - #78830 (fix `super_visit_with` for `Terminator`)
 - #78844 (Monomorphize a type argument of size-of operation during codegen)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-10 10:43:14 +00:00
Dylan DPC
c150b933ac
Rollup merge of #78844 - tmiasko:monomorphize-sizeof, r=oli-obk
Monomorphize a type argument of size-of operation during codegen

This wasn't necessary until MIR inliner started to consider drop glue as
a candidate for inlining; introducing for the first time a generic use
of size-of operation.

No test at this point since this only happens with a custom inlining
threshold.
2020-11-09 19:07:02 +01:00
Dylan DPC
7924ecc341
Rollup merge of #78830 - lcnr:mir-folder, r=oli-obk
fix `super_visit_with` for `Terminator`

fixes https://github.com/rust-lang/rust/pull/78182#discussion_r509265149

r? `@oli-obk`

cc `@LeSeulArtichaut`
2020-11-09 19:06:59 +01:00
Dylan DPC
4e0695b79f
Rollup merge of #78746 - pietroalbini:i686-freebsd, r=Mark-Simulacrum
Demote i686-unknown-freebsd to tier 2 compiler target

While technically the `i686-unknown-freebsd` target has been a tier 2 development platform for a long time, with full toolchain tarballs available on static.rust-lang.org, due to a bug in the manifest generation the target was never available for download through rustup.

The infrastructure team privately inquired the FreeBSD package maintainers, and they weren't relying on those tarballs either, so it's a fair assumption to say practically nobody is using those tarballs.

This PR then removes the CI builder that produces full tarballs for the target, and moves the compilation of `rust-std` for the target in `dist-various-2`. The `x86_64-unknown-freebsd` target is *not* affected.

cc `@rust-lang/infra` `@rust-lang/compiler` `@rust-lang/release`
r? `@Mark-Simulacrum`
2020-11-09 19:06:57 +01:00
Dylan DPC
8ebca242bc
Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco
rustc_ast: Do not panic by default when visiting macro calls

Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them.

The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.
2020-11-09 19:06:55 +01:00
Dylan DPC
ee1fedf392
Rollup merge of #78580 - tmiasko:inline-loop, r=oli-obk
inliner: Break inlining cycles

Keep track of all instances inlined so far. When examining a new call
sites from an inlined body, skip those where callee had been inlined
already to avoid potential inlining cycles.

Fixes #78573.
2020-11-09 19:06:53 +01:00
Dylan DPC
7ac079f047
Rollup merge of #78566 - JRF63:polly, r=Mark-Simulacrum
Enable LLVM Polly via llvm-args.

I think doing it this way is better than in #51061. Polly has other useful options and we probably don't want to create a `-Z` flag for each one of them.

![results](https://user-images.githubusercontent.com/7283601/97695555-338f7180-1adf-11eb-82bd-5130e0e6fa89.png)

[Benchmark](https://gist.github.com/JRF63/9a6268b91720958e90dbe7abffe20298)

I noticed that `-lto` seems to interfere with polly in this specific microbenchmark, as enabling it causes the perf to drop to that of non-polly builds.

Other related PRs: #75615
2020-11-09 19:06:51 +01:00
Dylan DPC
62d3a4f9c2
Rollup merge of #78513 - jyn514:rustup-toolchain, r=Mark-Simulacrum
Infer the default host target from the host toolchain if possible

- `beta-x86_64-unknown-linux-gnu` has beta stripped
- `rustc2` is ignored

This fixes ongoing issues where x.py will detect the wrong host triple
between MSVC and GNU.

I don't think this will break anyone's workflow - I'd be very surprised if you a) had no `[build]` section in `config.toml`, b) had rustc installed, and c) expected the default target to be something other than the default target used by `rustc`. But I could be wrong - I'm happy to hear user stories :)

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

r? ``@Mark-Simulacrum``
cc ``@Lokathor``
2020-11-09 19:06:49 +01:00
Dylan DPC
0aed74aa43
Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis
Update Chalk to 0.36.0

This PR updates Chalk and fixes a number of bugs in the chalk integration code.

cc `@rust-lang/wg-traits`
r? `@nikomatsakis`
2020-11-09 19:06:46 +01:00
Dylan DPC
2187f3c7f2
Rollup merge of #78480 - ssomers:btree-alias, r=Mark-Simulacrum
BTreeMap: fix pointer provenance rules

Fixes #78477 and includes #78476

r? `@Mark-Simulacrum`
2020-11-09 19:06:44 +01:00
Dylan DPC
391136ed58
Rollup merge of #77016 - Mark-Simulacrum:clippy-tests, r=pietroalbini
Test clippy on PR CI on changes

This runs the tools builder (which builds and tests tools, including clippy) when the clippy submodule changes. This essentially returns us to the prior state when clippy was a submodule; it makes sense for us to test it on CI when it changes. It might make sense for it to be tested regardless of changing but it is somewhat rare for it to fail and we don't want to add to CI time for the majority of PRs which don't affect it.

Fixes #76999.
2020-11-09 19:06:42 +01:00
Dylan DPC
99f16e637b
Rollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum
Improve lifetime name annotations for closures & async functions

* Don't refer to async functions as "generators" in error output
* Where possible, emit annotations pointing exactly at the `&` in the return type of closures (when they have explicit return types) and async functions, like we do for arguments.
Addresses #74072, but I wouldn't call that *closed* until annotations are identical for async and non-async functions.
* Emit a better annotation when the lifetime doesn't appear in the full name type, which currently happens for opaque types like `impl Future`. Addresses #74497, but further improves could probably be made (why *doesn't* it appear in the type as `impl Future + '1`?)
This is included in the same PR because the changes to `give_name_if_anonymous_region_appears_in_output` would introduce ICE otherwise (it would return `None` in cases where it didn't previously, which then gets `unwrap`ped)
2020-11-09 19:06:39 +01:00
Dylan DPC
46bce9f8ef
Rollup merge of #74754 - davidhewitt:cfg-panic, r=ecstatic-morse
Add `#[cfg(panic = '...')]`

This PR adds conditional compilation according to the panic strategy.

I've come across a need for a flag like this a couple of times while writing tests: #74301 , https://github.com/rust-lang/rust/pull/73670#issuecomment-653629031

I'm not sure if I need to add a feature gate for this flag?
2020-11-09 19:06:37 +01:00
SNCPlay42
61b52a33b3 use RegionNameHighlight for async fn and closure returns 2020-11-09 16:14:40 +00:00
David Hewitt
8d43b3cbb9 Add #[cfg(panic = "...")] 2020-11-09 15:30:49 +00:00
bors
25f6938da4 Auto merge of #78201 - joshtriplett:rustc-tls-model, r=Mark-Simulacrum
Compile rustc crates with the initial-exec TLS model

This should produce more efficient code, with fewer calls to
__tls_get_addr. The tradeoff is that libraries using it won't work with
dlopen, but that shouldn't be a problem for rustc's internal libraries.
2020-11-09 11:08:07 +00:00
Stein Somers
7ca6e8f767 BTreeMap: fix pointer provenance rules, make borrowing explicit 2020-11-09 09:13:50 +01:00
bors
fe8f026908 Auto merge of #78889 - Dylan-DPC:rollup-6zjhahf, r=Dylan-DPC
Rollup of 12 pull requests

Successful merges:

 - #77640 (Refactor IntErrorKind to avoid "underflow" terminology)
 - #78026 (Define `fs::hard_link` to not follow symlinks.)
 - #78114 (Recognize `private_intra_doc_links` as a lint)
 - #78228 (Promote aarch64-unknown-linux-gnu to Tier 1)
 - #78345 (Fix handling of item names for HIR)
 - #78437 (BTreeMap: stop mistaking node for an orderly place)
 - #78476 (fix some incorrect aliasing in the BTree)
 - #78674 (inliner: Use substs_for_mir_body)
 - #78748 (Implement destructuring assignment for tuples)
 - #78868 (Fix tab focus on restyled switches)
 - #78878 (Avoid overlapping cfg attributes when both macOS and aarch64)
 - #78882 (Nicer hunk headers for rust files)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-09 00:36:58 +00:00
Dylan DPC
92adac9b10
Rollup merge of #78882 - bjorn3:nicer_hunk_headers, r=Mark-Simulacrum
Nicer hunk headers for rust files

I found this trick at <https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more>

Before the hunk headers for changes in methods would refer to the impl:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -678,7 +678,7 ``@@`` impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckResults<'tcx> {
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

After the hunk headers refer to the actual function signature:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -678,7 +678,7 ``@@`` fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

When the function signature is visible, it will use the function
signature of the previous method as hunk header:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..63058dfc837 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -992,6 +992,7 ``@@`` pub fn typeck_opt_const_arg(
     }

     pub fn alloc_steal_mir(self, mir: Body<'tcx>) -> &'tcx Steal<Body<'tcx>> {
+        // foo
         self.arena.alloc(Steal::new(mir))
     }
```
2020-11-09 01:13:50 +01:00
Dylan DPC
a8beaa3b3c
Rollup merge of #78878 - shepmaster:intersecting-ignores, r=Mark-Simulacrum
Avoid overlapping cfg attributes when both macOS and aarch64

r? ``@Mark-Simulacrum``
2020-11-09 01:13:48 +01:00
Dylan DPC
479817acb0
Rollup merge of #78868 - notriddle:master, r=GuillaumeGomez
Fix tab focus on restyled switches

Setting a checkbox to `display:none` makes it impossible to tab onto it, which makes the rustdoc settings page completely keyboard inaccessible.
2020-11-09 01:13:46 +01:00
Dylan DPC
abaa78baeb
Rollup merge of #78748 - fanzier:tuple-assignment, r=petrochenkov
Implement destructuring assignment for tuples

This is the first step towards implementing destructuring assignment (RFC: https://github.com/rust-lang/rfcs/pull/2909, tracking issue: #71126). This PR is the first part of #71156, which was split up to allow for easier review.

Quick summary: This change allows destructuring the LHS of an assignment if it's a (possibly nested) tuple.
It is implemented via a desugaring (AST -> HIR lowering) as follows:
```rust
(a,b) = (1,2)
```
... becomes ...
```rust
{
  let (lhs0,lhs1) = (1,2);
  a = lhs0;
  b = lhs1;
}
```

Thanks to `@varkor` who helped with the implementation, particularly around default binding modes.

r? `@petrochenkov`
2020-11-09 01:13:44 +01:00
Dylan DPC
b4589a86cc
Rollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obk
inliner: Use substs_for_mir_body

Changes from 68965 extended the kind of instances that are being
inlined. For some of those, the `instance_mir` returns a MIR body that
is already expressed in terms of the types found in substitution array,
and doesn't need further substitution.

Use `substs_for_mir_body` to take that into account.

Resolves #78529.
Resolves #78560.
2020-11-09 01:13:42 +01:00
Dylan DPC
5639d9793f
Rollup merge of #78476 - RalfJung:btree-alias, r=Mark-Simulacrum
fix some incorrect aliasing in the BTree

This line is wrong:
```
ptr::copy(slice.as_ptr().add(idx), slice.as_mut_ptr().add(idx + 1), slice.len() - idx);
```
When `slice.as_mut_ptr()` is called, that creates a mutable reference to the entire slice, which invalidates the raw pointer previously returned by `slice.as_ptr()`. (Miri currently misses this because raw pointers are not tracked properly.)

Cc ````````@ssomers````````
2020-11-09 01:13:40 +01:00
Dylan DPC
4e5b7add7f
Rollup merge of #78437 - ssomers:btree_no_ord_at_node_level, r=Mark-Simulacrum
BTreeMap: stop mistaking node for an orderly place

A second mistake in #77612 was to ignore the node module's rightful comment "this module doesn't care whether the entries are sorted". And there's a much simpler way to visit the keys in order, if you check this separately from a single pass checking everything.

r? ````````@Mark-Simulacrum````````
2020-11-09 01:13:38 +01:00
Dylan DPC
12c5f786ea
Rollup merge of #78345 - jyn514:proper-names, r=varkor
Fix handling of item names for HIR

- Handle variants, fields, macros in `Node::ident()`
- Handle the crate root in `opt_item_name`
- Rewrite `item_name` in terms of `opt_item_name`

I need this for both https://github.com/rust-lang/rust/pull/77820 and https://github.com/rust-lang/rust/pull/78082, so splitting it out into a separate PR so it can land early.
2020-11-09 01:13:35 +01:00
Dylan DPC
50086afb5d
Rollup merge of #78228 - pietroalbini:finally, r=Mark-Simulacrum
Promote aarch64-unknown-linux-gnu to Tier 1

This PR promotes the `aarch64-unknown-linux-gnu` target to Tier 1, as proposed by [RFC 2959]:

* The `aarch64-gnu` CI job is moved from `auto-fallible` to `auto`.
* The platform support documentation is updated, uplifting the target to Tiert 1 with a note about missing stack probes support.
* Building the documentation is enabled for the target, as we produce the `rust-docs` component for all Tier 1 platforms.

[RFC 2959]: https://github.com/rust-lang/rfcs/pull/2959
2020-11-09 01:13:33 +01:00
Dylan DPC
b9671ae5f8
Rollup merge of #78114 - jyn514:private, r=oli-obk
Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in https://github.com/rust-lang/rust/pull/77249#issuecomment-712339227.

r? ````````@Manishearth````````

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.
2020-11-09 01:13:31 +01:00
Dylan DPC
41134be153
Rollup merge of #78026 - sunfishcode:symlink-hard-link, r=dtolnay
Define `fs::hard_link` to not follow symlinks.

POSIX leaves it [implementation-defined] whether `link` follows symlinks.
In practice, for example, on Linux it does not and on FreeBSD it does.
So, switch to `linkat`, so that we can pick a behavior rather than
depending on OS defaults.

Pick the option to not follow symlinks. This is somewhat arbitrary, but
seems the less surprising choice because hard linking is a very
low-level feature which requires the source and destination to be on
the same mounted filesystem, and following a symbolic link could end
up in a different mounted filesystem.

[implementation-defined]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html
2020-11-09 01:13:28 +01:00
Dylan DPC
d69ee57f97
Rollup merge of #77640 - ethanboxx:int_error_matching_attempt_2, r=KodrAus
Refactor IntErrorKind to avoid "underflow" terminology

This PR is a continuation of #76455

# Changes

- `Overflow` renamed to `PosOverflow` and `Underflow` renamed to `NegOverflow` after discussion in #76455
- Changed some of the parsing code to return `InvalidDigit` rather than `Empty` for strings "+" and "-". https://users.rust-lang.org/t/misleading-error-in-str-parse-for-int-types/49178
- Carry the problem `char` with the `InvalidDigit` variant.
- Necessary changes were made to the compiler as it depends on `int_error_matching`.
- Redid tests to match on specific errors.

r? ```@KodrAus```
2020-11-09 01:13:25 +01:00
Tomasz Miąsko
dc4d74d149 inliner: Break inlining cycles
When examining candidates for inlining, reject those that are determined
to be recursive either because of self-recursive calls or calls to any
instances already inlined.
2020-11-09 00:00:00 +00:00
Tomasz Miąsko
b7f16c56d1 inliner: Make inline_call infallible
The inliner does not support inlining of divering calls. Reject them
early on and turn `inline_call` into an infallible operation.
2020-11-09 11:41:10 +01:00
bors
1773f60ea5 Auto merge of #78712 - petrochenkov:visitok, r=Aaron1011
rustc_ast: Visit tokens stored in AST nodes in mutable visitor

After #77271 token visiting is enabled only for one visitor in `rustc_expand\src\mbe\transcribe.rs` which applies hygiene marks to tokens produced by declarative macros (`macro_rules` or `macro`), so this change doesn't affect anything else.

When a macro has some interpolated token from an outer macro in its output
```rust
macro inner() {
    $interpolated
}
```
we can use the usual interpretation of interpolated tokens in token-based model - a None-delimited group - to write this macro in an equivalent form
```rust
macro inner() {
    ⟪ a b c d ⟫
}
```

When we are expanding the macro `inner` we need to apply hygiene marks to all tokens produced by it, including the tokens inside the group.

Before this PR we did this by visiting the AST piece inside the interpolated token and applying marks to all spans in it.
I'm not sure this is 100% correct (ideally we should apply the marks to tokens and then re-parse the AST from tokens), but it's a very good approximation at least.
We didn't however apply the marks to actual tokens stored in the nonterminal, so if we used the nonterminal as a token rather than as an AST piece (e.g. passed it to a proc macro), then we got hygiene bugs.
This PR applies the marks to tokens in addition to the AST pieces thus fixing the issue.

r? `@Aaron1011`
2020-11-08 20:00:51 +00:00
bjorn3
39046172ab Nicer hunk headers for rust files
I found this trick at
<https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more>

Before the hunk headers for changes in methods would refer to the impl:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -678,7 +678,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckResults<'tcx> {
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

After the hunk headers refer to the actual function signature:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -678,7 +678,7 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

When the function signature is visible, it will use the function
signature of the previous method as hunk header:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..63058dfc837 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -992,6 +992,7 @@ pub fn typeck_opt_const_arg(
     }

     pub fn alloc_steal_mir(self, mir: Body<'tcx>) -> &'tcx Steal<Body<'tcx>> {
+        // foo
         self.arena.alloc(Steal::new(mir))
     }
```
2020-11-08 16:46:53 +01:00
Jake Goulding
b13817a795 Avoid overlapping cfg attributes when both macOS and aarch64 2020-11-08 09:43:51 -05:00