Commit graph

8620 commits

Author SHA1 Message Date
bors
25ec827385 Auto merge of #89363 - oli-obk:in_tracing_we_trust, r=Mark-Simulacrum
Fix performance regression with #[instrument]

linked tracing PR: https://github.com/tokio-rs/tracing/pull/1600

regression introduced by #89048
2021-10-05 12:52:43 +00:00
bors
55111d656f Auto merge of #89266 - cjgillot:session-ich, r=michaelwoerister
Move ICH to rustc_query_system

Based on https://github.com/rust-lang/rust/pull/89183

The StableHashingContext does not need to be in rustc_middle.

This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-05 09:45:11 +00:00
Manish Goregaokar
bf62c6d710
Rollup merge of #89504 - Aaron1011:rpit-nll-static, r=nikomatsakis
Don't suggest replacing region with 'static in NLL

Fixes #73159

This is similar to #69350 - if the user didn't initially
write out a 'static lifetime, adding 'static in response to
a lifetime error is usually the wrong thing to do.
2021-10-04 23:56:24 -07:00
Manish Goregaokar
04314a6061
Rollup merge of #89482 - hkmatsumoto:patch-diagnostics, r=joshtriplett
Follow the diagnostic output style guide

Detected by #89455.
2021-10-04 23:56:23 -07:00
Manish Goregaokar
87f782ede6
Rollup merge of #89423 - DevinR528:reachable-fields, r=Nadrieril
Fix ICE caused by non_exaustive_omitted_patterns struct lint

fixes #89382

Add check that a list of `Pat`s is non empty to prevent ICE in `FnCtxt::lint_non_exhaustive_omitted_patterns`.

Is related to #89374 and #89105
2021-10-04 23:56:20 -07:00
Jubilee
c9158db1f3
Rollup merge of #89494 - FabianWolff:issue-84075, r=davidtwco
Deny `where` clauses on `auto` traits

Fixes #84075.
2021-10-04 21:12:43 -07:00
Jubilee
90e96f9fc3
Rollup merge of #89487 - FabianWolff:issue-89396, r=petrochenkov
Try to recover from a `=>` -> `=` or `->` typo in a match arm

Fixes #89396.
2021-10-04 21:12:42 -07:00
Jubilee
ec4145510e
Rollup merge of #89478 - zvavybir:master, r=jyn514
Fixed numerus of error message

When there are redundant trait requirements and these are hidden, a message is generated by the following code snippet:
`format!("{} redundant requirements hidden", count)`
But if there is only a single hidden requirement, it will still print this message in plural instead of singular.
2021-10-04 21:12:40 -07:00
Jubilee
c2bfe45e66
Rollup merge of #89473 - FabianWolff:issue-89469, r=joshtriplett
Fix extra `non_snake_case` warning for shorthand field bindings

Fixes #89469. The problem is the innermost `if` condition here:
d14731cb3c/compiler/rustc_lint/src/nonstandard_style.rs (L435-L452)

This code runs for every `PatKind::Binding`, so if a struct has multiple fields, say A and B, and both are bound in a pattern using shorthands, the call to `self.check_snake_case()` will indeed be skipped in the `check_pat()` call for `A`; but when `check_pat()` is called for `B`, the loop will still iterate over `A`, and `field.ident (= A) != ident (= B)` will be true. I have fixed this by only looking at non-shorthand bindings, and only the binding that `check_pat()` was actually called for.
2021-10-04 21:12:38 -07:00
Jubilee
36f173f0a9
Rollup merge of #89466 - Mark-Simulacrum:query-macros, r=oli-obk
Fix bug with query modifier parsing

The previous macro_rules! parsers failed when an additional modifier was added
with ambiguity errors. The error is pretty unclear as to what exactly the cause
here is, but this change simplifies the argument parsing code such that the
error is avoided.

Extracted from other work, and somewhat duplicates 0358edeb5 from #85830, but
this approach seems a little simpler to me. Not technically currently necessary but seems
like a good cleanup.
2021-10-04 21:12:37 -07:00
Jubilee
05b4cd6789
Rollup merge of #89413 - matthewjasper:spec-marker-fix, r=nikomatsakis
Correctly handle supertraits for min_specialization

Supertraits of specialization markers could circumvent checks for
min_specialization. Elaborating predicates prevents this.

r? ````@nikomatsakis````
2021-10-04 21:12:35 -07:00
Jubilee
4f6afee4e5
Rollup merge of #88090 - nbdd0121:inference, r=nikomatsakis
Perform type inference in range pattern

Fix #88074
2021-10-04 21:12:33 -07:00
Jubilee
99e6e3ff07
Rollup merge of #87993 - kornelski:try_reserve_stable, r=joshtriplett
Stabilize try_reserve

Stabilization PR for the [`try_reserve` feature](https://github.com/rust-lang/rust/issues/48043#issuecomment-898040475).
2021-10-04 21:12:33 -07:00
Josh Triplett
c35a700be2 Make an initial guess for metadata size to reduce buffer resizes 2021-10-04 19:23:13 -07:00
Dylan MacKenzie
02c2a35c66 Discuss field-sensitivity and enums in context of MaybeLiveLocals 2021-10-04 14:09:19 -07:00
Jubilee
9866b090f4
Rollup merge of #89508 - jhpratt:stabilize-const_panic, r=joshtriplett
Stabilize `const_panic`

Closes #51999

FCP completed in #89006

```@rustbot``` label +A-const-eval +A-const-fn +T-lang

cc ```@oli-obk``` for review (not `r?`'ing as not on lang team)
2021-10-04 13:58:17 -07:00
Jubilee
3d4467dfcc
Rollup merge of #89500 - FabianWolff:issue-87308, r=petrochenkov
Fix ICE with buffered lint referring to AST node deleted by everybody_loops

Fixes #87308. Note the following comment:
08759c691e/compiler/rustc_lint/src/early.rs (L415-L417)

As it turns out, this is not _always_ a bug, because `-Zunpretty=everybody_loops` causes a lot of AST nodes to be deleted, and thus some buffered lints will refer to non-existent node ids. To fix this, my changes simply ignore buffered lints if `-Zunpretty=everybody_loops` is enabled, which, from my understanding, shouldn't be a big issue because it only affects pretty-printing. Of course, a more elegant solution would only ignore buffered lints that actually point at deleted node ids, but I haven't figured out an easy way of achieving this.

For the concrete example in #87308, the buffered lint is created [here](08759c691e/compiler/rustc_expand/src/mbe/macro_rules.rs (L145-L151)) with the `lint_node_id` from [here](08759c691e/compiler/rustc_expand/src/mbe/macro_rules.rs (L319)), i.e. it points at the macro _expansion_, which then gets deleted by `ReplaceBodyWithLoop` [here](08759c691e/compiler/rustc_interface/src/passes.rs (L377)).
2021-10-04 13:58:16 -07:00
Jubilee
5352e17df3
Rollup merge of #89483 - hkmatsumoto:patch-diagnostics-2, r=estebank
Practice diagnostic message convention

Detected by #89455.

r? ```@estebank```
2021-10-04 13:58:15 -07:00
Jubilee
2bc89ce0bf
Rollup merge of #89453 - waywardmonkeys:consistent-supertrait-usage, r=nagisa
Consistently use 'supertrait'.

A subset of places referred to 'super-trait', so this changes them
to all use 'supertrait'. This matches 'supertype' and some other
usages. An exception is 'auto-trait' which is consistently used
in that manner.
2021-10-04 13:58:14 -07:00
Jubilee
08dd4148f1
Rollup merge of #89447 - FabianWolff:issue-89388, r=davidtwco
Improve error message for missing angle brackets in `[_]::method`

Fixes #89388.
2021-10-04 13:58:13 -07:00
Jubilee
9381d7a898
Rollup merge of #89407 - pierwill:recommend-clean-E0514, r=davidtwco
Recommend running `cargo clean` in E0514 output

This suggestion has worked for me before. Seems to me it could help others.
2021-10-04 13:58:10 -07:00
Jubilee
a2c6075dff
Rollup merge of #88451 - theo-lw:issue-87771, r=jackh726
Fix an ICE caused by type mismatch errors being ignored

This PR fixes #87771. It turns out that the check on `compiler/rustc_typeck/src/check/demand.rs:148` leads to the ICE. I removed it because the early return in [`check_expr_assign`](dec7fc3ced/compiler/rustc_typeck/src/check/expr.rs (L928)) already prevents unnecessary error messages from the call to `check_expr_coercable_to_type`.
2021-10-04 13:58:07 -07:00
Jubilee
4e9cf04c98
Rollup merge of #83655 - sebpop:arm64-outline-atomics, r=workingjubilee
[aarch64] add target feature outline-atomics

Enable outline-atomics by default as enabled in clang by the following commit
https://reviews.llvm.org/rGc5e7e649d537067dec7111f3de1430d0fc8a4d11

Performance improves by several orders of magnitude when using the LSE instructions
instead of the ARMv8.0 compatible load/store exclusive instructions.

Tested on Graviton2 aarch64-linux with
x.py build && x.py install && x.py test
2021-10-04 13:58:06 -07:00
Fabian Wolff
079c075f24 Use TokenKind::similar_tokens() 2021-10-04 22:13:00 +02:00
Fabian Wolff
388bcc1cb0 Fix suggestion to borrow when casting from pointer to reference 2021-10-04 21:15:02 +02:00
Guillaume Gomez
40fe064c63 Add a check for duplicated doc aliases in unused lint 2021-10-04 20:57:05 +02:00
Aaron Hill
32a5abc6fe
Make proc_macro_derive_resolution_fallback a future-breakage lint
When `cargo report future-incompatibilities` is stabilized
(see #71249), this will cause dependencies that trigger
this lint to be included in the report.
2021-10-04 11:05:48 -05:00
bors
a4797664ba Auto merge of #89489 - FabianWolff:issue-89485, r=oli-obk
Fix unsound optimization with explicit variant discriminants

Fixes #89485.
2021-10-04 10:09:04 +00:00
Kornel
00152d8977 Stabilize try_reserve 2021-10-04 10:29:46 +01:00
kadmin
9cb30f465e Move generic error message to separate branches
This decomposes an error message in generic constants into more specific branches, for better
readability.
2021-10-04 06:49:49 +00:00
Jacob Pratt
bce8621983
Stabilize const_panic 2021-10-04 02:33:33 -04:00
Manish Goregaokar
5215b855b0
Rollup merge of #88481 - bjorn3:remove_feature_gates, r=cjgillot
Remove some feature gates

The first commit removes various feature gates that are unused. The second commit replaces some `Fn` implementations with `Iterator` implementations, which is much cleaner IMO. The third commit replaces an unboxed_closures feature gate with min_specialization. For some reason the unboxed_closures feature gate suppresses the min_specialization feature gate from triggering on an `TrustedStep` impl. The last comment just turns a regular comment into a doc comment as drive by cleanup. I can move it to a separate PR if preferred.
2021-10-03 23:13:20 -07:00
Aaron Hill
fdd8a0dde5
Don't suggest replacing region with 'static in NLL
Fixes #73159

This is similar to #69350 - if the user didn't initially
write out a 'static lifetime, adding 'static in response to
a lifetime error is usually the wrong thing to do.
2021-10-03 21:53:48 -05:00
bors
e737694a4d Auto merge of #88175 - camsteffen:let-desugar-span, r=Manishearth
Add expansion to while desugar spans

In the same vein as #88163, this reverts a change in Clippy behavior as a result of #80357 (and reverts some `#[allow]`s): This changes `clippy::blocks_in_if_conditions` to not fire on `while` loops. Though we might actually want Clippy to lint those cases, we should introduce the change purposefully, with tests, and possibly under a different lint name.

The actual change here is to add a desugaring expansion to the spans when lowering a `while` loop.

r? `@Manishearth`
2021-10-03 21:44:10 +00:00
Fabian Wolff
dd9b4763a4 Disable SimplifyBranchSame optimization for now 2021-10-03 22:58:24 +02:00
Fabian Wolff
20489eaca2 Update comments 2021-10-03 21:06:49 +02:00
Fabian Wolff
a28a78f247 Fix ICE with buffered lint referring to AST node deleted by everybody_loops 2021-10-03 21:04:36 +02:00
Mark Rousskov
1c2ad79f9d Add two inline annotations for hot functions
These two functions are essentially no-ops (and compile to just a load and
return), but show up in process_obligations profiles with a high call count --
so worthwhile to try and inline them away.
2021-10-03 12:43:43 -04:00
Fabian Wolff
e34fd54611 Deny where clauses on auto traits 2021-10-03 18:06:21 +02:00
bjorn3
9f4cb862ca Replace Fn impls with RPIT impls in rustc_index
This is cleaner and removes an unstable feature usage
2021-10-03 17:50:53 +02:00
Camille GILLOT
b2ed9c4007 Add some inlining. 2021-10-03 16:08:57 +02:00
Camille GILLOT
fedd7785fe Access StableHashingContext in rustc_query_system. 2021-10-03 16:08:55 +02:00
Camille GILLOT
471cb5c149 Fully remove rustc_middle::ich. 2021-10-03 16:08:55 +02:00
Camille GILLOT
02025d86ac Remove re-export. 2021-10-03 16:08:54 +02:00
Camille GILLOT
c355b2e5cd Move ICH to rustc_query_system. 2021-10-03 16:08:53 +02:00
Camille GILLOT
2d38c53767 Remove StableHashProvider. 2021-10-03 16:08:52 +02:00
Camille GILLOT
8961616e60 Move rustc_middle::middle::cstore to rustc_session. 2021-10-03 16:08:51 +02:00
Camille GILLOT
b66dfaaa64 Move some HashStable impls. 2021-10-03 16:08:50 +02:00
Fabian Wolff
529c35331b Fix unsound optimization with explicit variant discriminants 2021-10-03 16:04:38 +02:00
Fabian Wolff
9626f2bd84 Fix extra non_snake_case warning for shorthand field bindings 2021-10-03 14:33:14 +02:00
Fabian Wolff
cf19131cb3 Try to recover from a => -> = or -> typo in a match arm 2021-10-03 14:14:35 +02:00
Matthias Kaak
d6a7e74c81 Combined 4 commits into 1
Fixed numerus of error message

Removed superfluous argument

Using pluralize!() instead of code duplication

Adjusted a test
2021-10-03 11:53:12 +00:00
Hirochika Matsumoto
3818981ca1 Practice diagnostic message convention 2021-10-03 16:16:28 +09:00
Hirochika Matsumoto
fb0b1a5466 Follow the diagnostic output style guide 2021-10-03 14:28:39 +09:00
Charles Lew
250d1260e6 Add deref_into_dyn_supertrait lint. 2021-10-03 12:36:40 +08:00
bors
77f1e504a9 Auto merge of #89479 - camsteffen:diag-naming, r=Manishearth
Make diangostic item naming consistent

Right now there is about a 50/50 split of naming diagnostic items as `vec_type` vs `Vec`. So it is hard to guess a diagnostic item name with confidence. I know it's not great to change these retroactively, but I think it will be much easier to maintain consistency after consistency is established.
2021-10-03 03:43:21 +00:00
bors
c70b35efd8 Auto merge of #84267 - dtolnay:ptrunit, r=nagisa
Make *const (), *mut () okay for FFI

Pointer-to-() is used occasionally in the standard library to mean "pointer to none-of-your-business". Examples:

- `RawWakerVTable::new` https://doc.rust-lang.org/1.51.0/std/task/struct.RawWakerVTable.html#method.new
- `<*const T>::to_raw_parts` https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.to_raw_parts

I believe it's useful for the same purpose in FFI signatures, even while `()` itself is not FFI safe. The following should be allowed:

```rust
extern "C" {
    fn demo(pc: *const (), pm: *mut ());
}
```

Prior to this PR, those pointers were not considered okay for an extern signature.

```console
warning: `extern` block uses type `()`, which is not FFI-safe
 --> src/main.rs:2:17
  |
2 |     fn demo(pc: *const (), pm: *mut ());
  |                 ^^^^^^^^^ not FFI-safe
  |
  = note: `#[warn(improper_ctypes)]` on by default
  = help: consider using a struct instead
  = note: tuples have unspecified layout

warning: `extern` block uses type `()`, which is not FFI-safe
 --> src/main.rs:2:32
  |
2 |     fn demo(pc: *const (), pm: *mut ());
  |                                ^^^^^^^ not FFI-safe
  |
  = help: consider using a struct instead
  = note: tuples have unspecified layout
```
2021-10-03 00:41:49 +00:00
Cameron Steffen
eec856bfbc Make diangostic item names consistent 2021-10-02 19:38:19 -05:00
Cameron Steffen
67ea84d97a Add desugaring mark to while loop 2021-10-02 17:41:14 -05:00
Devin Ragotzy
b06409ebcd Rename etc -> has_rest_pat 2021-10-02 17:51:31 -04:00
Devin Ragotzy
f7a8980347 Reorder etc check for non_exhaustive_omitted_patterns 2021-10-02 17:50:53 -04:00
Devin Ragotzy
8cbcc893a6 Fix ICE caused by non_exaustive_omitted_patterns struct lint 2021-10-02 17:50:53 -04:00
bors
2801a770ce Auto merge of #89345 - jackh726:89333, r=estebank
Don't lose binders when printing trait bound suggestion

Fixes #89333
2021-10-02 21:30:51 +00:00
bors
f03eb6bef8 Auto merge of #89341 - audunhalland:derive-type-params-with-bound-generic-params, r=jackh726
Deriving: Include bound generic params in type parameters for where clause

Fixes #89188.

The `derive` macro ignored the `for<'s>` needed with the `Fn` trait in that code example.

edit: I'm unsure if this might cause regressions. I'm not an experienced compiler developer so I'm not used to thinking about unwanted side effects code changes like this might have.
2021-10-02 18:46:27 +00:00
bjorn3
e98f28907e Turn a module non-doc comment into a doc comment 2021-10-02 19:09:29 +02:00
bjorn3
998753c6f7 Swap out unboxed_closures feature gate for min_specialization
For some reason unboxed_closures supresses the feature gate for
min_specialization when implementing TrustedStep. min_specialization is
the true feature that is used.
2021-10-02 19:09:29 +02:00
bjorn3
83ddedf170 Remove various unused feature gates 2021-10-02 19:09:18 +02:00
bjorn3
e2d3e09b9c Prevent macro ambiguity errors
The previous macro_rules! parsers failed when an additional modifier was added
with ambiguity errors. The error is pretty unclear as to what exactly the cause
here is, but this change simplifies the argument parsing code such that the
error is avoided.
2021-10-02 13:00:19 -04:00
bors
d14731cb3c Auto merge of #89239 - petrochenkov:modcache, r=cjgillot
resolve: Cache module loading for all foreign modules

It was previously cached for modules loaded from `fn get_module`, but not for modules loaded from `fn build_reduced_graph_for_external_crate_res`.
This also makes all foreign modules use their real parent, span and expansion instead of possibly a parent/span/expansion of their reexport.
Modules are also often compared using referential equality (`ptr::eq`), this change makes such comparisons correct in all cases.

An ICE happening on attempt to decode expansions for foreign enums and traits is avoided.

Also local enums and traits are now added to the module map.

Follow up to https://github.com/rust-lang/rust/pull/88872.
r? `@cjgillot`
2021-10-02 16:17:13 +00:00
Vadim Petrochenkov
d7d07657cd rustc_span: Make hygiene debug printing reproducible 2021-10-02 18:31:50 +03:00
Vadim Petrochenkov
ded08e44c6 resolve: Avoid comparing modules by optional def-id
It makes all block modules identical during comparison
2021-10-02 18:31:50 +03:00
Vadim Petrochenkov
5aa732a364 resolve: Cache module loading for all foreign modules
It was previously cached for modules loaded from `fn get_module`, but not for modules loaded from `fn build_reduced_graph_for_external_crate_res`.
This also makes all foreign modules use their real parent, span and expansion instead of possibly a parent/span/expansion of their reexport.

An ICE happening on attempt to decode expansions for foreign enums and traits is avoided.

Also local enums and traits are now added to the module map.
2021-10-02 18:31:42 +03:00
Erik Desjardins
bec5a91450 only check for automatically_derived on impls, not individual methods
this matches behavior of existing code
b27661eb33/compiler/rustc_passes/src/liveness.rs (L326-L333)
2021-10-02 09:53:51 -04:00
bors
edebf77e00 Auto merge of #89408 - Mark-Simulacrum:fix-query-nondet, r=petrochenkov
Avoid nondeterminism in trimmed_def_paths

Previously this query depended on the global interning order of Symbols, which
meant that irrelevant changes could influence the query and cause
recompilations. This commit ensures that the return set is stable and will not
be affected by the global order by deterministically (in lexicographic order)
choosing a name to use if there are multiple names for a single DefId.

This should fix the cause of the [regressions] in #83343.

[regressions]: https://perf.rust-lang.org/compare.html?start=9620f3a84b079decfdc2e557be007580b097fe43&end=addb4da686a97da46159f0123cb6cdc2ce3d7fdb
2021-10-02 13:36:27 +00:00
bors
b27661eb33 Auto merge of #89405 - GuillaumeGomez:fix-clippy-lints, r=cjgillot
Fix clippy lints

I'm currently working on allowing clippy to run on librustdoc after a discussion I had with `@Mark-Simulacrum.` So in the meantime, I fixed a few lints on the compiler crates.
2021-10-02 10:52:09 +00:00
Oli Scherer
69274aa549 Bump tracing to get the instrumentation perf improvement 2021-10-02 08:22:03 +00:00
Erik Desjardins
eb4ba58572 perf: only check for rustc_trivial_field_reads attribute on traits
The checks removed here caused a small perf regression:
https://github.com/rust-lang/rust/pull/88824#issuecomment-932664761

Since the attribute is currently only applied to traits, I don't think
it's worth keeping the additional checks for now.
If/when we decide to apply the attribute somewhere else, we can
(partially) revert this and evaluate if the perf impact is acceptable.
2021-10-01 22:07:22 -04:00
Bruce Mitchener
058a21d5cf Consistently use 'supertrait'.
A subset of places referred to 'super-trait', so this changes them
to all use 'supertrait'. This matches 'supertype' and some other
usages. An exception is 'auto-trait' which is consistently used
in that manner.
2021-10-02 08:05:44 +07:00
bors
6e12110812 Auto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearth
Rollup of 7 pull requests

Successful merges:

 - #85223 (rustdoc: Clarified the attribute which prompts the warning)
 - #88847 (platform-support.md: correct ARMv7+MUSL platform triple notes)
 - #88963 (Coerce const FnDefs to implement const Fn traits )
 - #89376 (Fix use after drop in self-profile with llvm events)
 - #89422 (Replace whitespaces in doctests' name with dashes)
 - #89440 (Clarify a sentence in the documentation of Vec (#84488))
 - #89441 (Normalize after substituting via `field.ty()`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-01 22:47:22 +00:00
Manish Goregaokar
5ab1245303
Rollup merge of #89441 - Nadrieril:fix-89393, r=tmandry
Normalize after substituting via `field.ty()`

Back in https://github.com/rust-lang/rust/issues/72476 I hadn't understood where the problem was coming from, and only worked around the issue. What happens is that calling `field.ty()` on a field of a generic struct substitutes the appropriate generics but doesn't normalize the resulting type.
As a consumer of types I'm surprised that one would substitute without normalizing, feels like a footgun, so I added a comment.

Fixes https://github.com/rust-lang/rust/issues/89393.
2021-10-01 14:46:52 -07:00
Manish Goregaokar
1781e4b81a
Rollup merge of #89376 - andjo403:selfProfileUseAfterDropFix, r=Mark-Simulacrum
Fix use after drop in self-profile with llvm events

self-profile with `-Z self-profile-events=llvm` have failed with a segmentation fault due to this use after drop.
this type of events can be more useful now that the new passmanager is the default.
2021-10-01 14:46:49 -07:00
Manish Goregaokar
743e842afb
Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk
Coerce const FnDefs to implement const Fn traits

You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`.

r? ``@oli-obk``

``@rustbot`` label T-compiler F-const_trait_impl
2021-10-01 14:46:48 -07:00
Guillaume Gomez
759eba0a08 Fix clippy lints 2021-10-01 23:17:19 +02:00
Fabian Wolff
d92c683933 Improve error message for missing angle brackets in [_]::method 2021-10-01 23:03:28 +02:00
bors
c02371c442 Auto merge of #88880 - cjgillot:no-krate, r=oli-obk
Rework HIR API to make invocations of the hir_crate query harder.

`hir_crate` forces the recomputation of queries that depend on it.

This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.
2021-10-01 20:06:34 +00:00
jackh726
b2b34351de Don't lose binders when printing trait bound suggestion 2021-10-01 16:04:32 -04:00
Nadrieril
68b76a4835 Normalize after substituting via field.ty() 2021-10-01 19:45:19 +01:00
Manish Goregaokar
534946cba1
Rollup merge of #89415 - wesleywiser:inliner_caller_callsite_message, r=michaelwoerister
Correct caller/callsite confusion in inliner message

`callee_body` is the MIR `Body` for the `callsite.callee` so this message basically says `"Inline {bar span} into bar"` when it should say `"Inline bar into foo"`.

Extracted out of #82280
2021-10-01 09:18:20 -07:00
Manish Goregaokar
d388428aaa
Rollup merge of #89340 - FabianWolff:issue-89173, r=petrochenkov
Improve error message for `printf`-style format strings

Fixes #89173. The following is actually supported today:
```rust
fn main() {
    let num = 5;
    let width = 20;
    print!("%*2$x", num, width);
}
```
```
error: multiple unused formatting arguments
 --> src/main.rs:4:21
  |
4 |     print!("%*2$x", num, width);
  |            -------  ^^^  ^^^^^ argument never used
  |            ||       |
  |            ||       argument never used
  |            |help: format specifiers use curly braces: `{:1$x}`
  |            multiple missing formatting specifiers
  |
  = note: printf formatting not supported; see the documentation for `std::fmt`
```
However, as noted in #89173, something like
```rust
    print!("%0*x", width, num);
```
does not give a helpful suggestion. I think this is partly intended, because there actually _is_ no Rust equivalent to this; you always have to use a positional or named argument to specify the width (instead of just using the "next" argument, as `printf` or even `.*` as a precision specifier in Rust would). Therefore, I have added a note:
```
[...]
note: format specifiers use curly braces, and you have to use a positional or named parameter for the width
 --> t2.rs:4:13
  |
4 |     print!("%0*x", width, num);
  |             ^^^^
  = note: printf formatting not supported; see the documentation for `std::fmt`
```
This is not perfect, but it should at least point the user in the right direction, instead of issuing no explanation at all.

cc ```@lcnr```
2021-10-01 09:18:19 -07:00
Manish Goregaokar
2f67063fbe
Rollup merge of #89322 - tmiasko:rm-optimization-fuel, r=michaelwoerister
Reapply "Remove optimization_fuel_crate from Session"
2021-10-01 09:18:18 -07:00
Manish Goregaokar
1708219940
Rollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebank
feat(rustc_parse): recover from pre-RFC-2000 const generics syntax

Fixes #89013
2021-10-01 09:18:17 -07:00
Manish Goregaokar
6f1e930581
Rollup merge of #88820 - hlopko:add_pie_relocation_model, r=petrochenkov
Add `pie` as another `relocation-model` value

MCP: https://github.com/rust-lang/compiler-team/issues/461
2021-10-01 09:18:16 -07:00
Manish Goregaokar
37df2753fc
Rollup merge of #87868 - Kixiron:packing-on-the-pounds, r=eddyb
Added -Z randomize-layout flag

An implementation of #77316, it currently randomly shuffles the fields of `repr(rust)` types based on their `DefPathHash`
r? ``@eddyb``
2021-10-01 09:18:16 -07:00
bors
69eb996b26 Auto merge of #89417 - Manishearth:rollup-j2gdu95, r=Manishearth
Rollup of 7 pull requests

Successful merges:

 - #88838 (Do not suggest importing inaccessible items)
 - #89251 (Detect when negative literal indices are used and suggest appropriate code)
 - #89321 (Rebase resume argument projections during state transform)
 - #89327 (Pick one possible lifetime in case there are multiple choices)
 - #89344 (Cleanup lower_generics_mut and make span be the bound itself)
 - #89397 (Update `llvm` submodule to fix function name mangling on x86 Windows)
 - #89412 (Add regression test for issues #88969 and #89119 )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-01 09:00:42 +00:00
Manish Goregaokar
746e46548c
Rollup merge of #89344 - jackh726:maybe-bound-eror, r=cjgillot
Cleanup lower_generics_mut and make span be the bound itself

Closes #86298 (supersedes those changes)

r? `@cjgillot` since you reviewed the other PR

(Used wrong branch for #89338)
2021-09-30 23:41:09 -07:00
Manish Goregaokar
8c5114b4e8
Rollup merge of #89327 - oli-obk:nll_diag_infer_vars, r=wesleywiser
Pick one possible lifetime in case there are multiple choices

In case a lifetime variable is created, but doesn't have an obvious lifetime in the list of named lifetimes that it should be inferred to, just pick the first one for the diagnostic.

This happens e.g. in

```rust
fn foo<'a, 'b>(a: Struct<'a>, b: Struct<'b>) -> impl Trait<'a, 'b> {
    if bar() { a } else { b }
}
```

where we get a lifetime variable that combines the lifetimes of `a` and `b` creating a lifetime that is the intersection of both. Right now the type system cannot express this and thus we get an error, but that error also can't express this.

I can also create an entirely new diagnostic that mentions all involved lifetimes, so it would actually mention `'a` and `'b` instead of just `'b`.
2021-09-30 23:41:08 -07:00
Manish Goregaokar
27269554b8
Rollup merge of #89321 - tmiasko:rebase-resume-arg, r=estebank
Rebase resume argument projections during state transform

When remapping a resume argument with projections rebase them on top of
the new base.

The case where resume argument has projections is unusual, but might
arise with box syntax where the assignment is performed directly into
the box without an intermediate temporary.

Fixes #85635.
2021-09-30 23:41:07 -07:00
Manish Goregaokar
e77d163e82
Rollup merge of #89251 - estebank:negative-index-literals, r=davidtwco
Detect when negative literal indices are used and suggest appropriate code
2021-09-30 23:41:06 -07:00
Manish Goregaokar
9593e61f64
Rollup merge of #88838 - FabianWolff:issue-88472, r=estebank
Do not suggest importing inaccessible items

Fixes #88472. For this example:
```rust
mod a {
    struct Foo;
}

mod b {
    type Bar = Foo;
}
```
rustc currently emits:
```
error[E0412]: cannot find type `Foo` in this scope
 --> test.rs:6:16
  |
6 |     type Bar = Foo;
  |                ^^^ not found in this scope
  |
help: consider importing this struct
  |
6 |     use a::Foo;
  |
```
this is incorrect, as applying this suggestion leads to
```
error[E0603]: struct `Foo` is private
 --> test.rs:6:12
  |
6 |     use a::Foo;
  |            ^^^ private struct
  |
note: the struct `Foo` is defined here
 --> test.rs:2:5
  |
2 |     struct Foo;
  |     ^^^^^^^^^^^
```
With my changes, I get:
```
error[E0412]: cannot find type `Foo` in this scope
 --> test.rs:6:16
  |
6 |     type Bar = Foo;
  |                ^^^ not found in this scope
  |
  = note: this struct exists but is inaccessible:
          a::Foo
```
As for the wildcard mentioned in #88472, I would argue that the warning is actually correct, since the import _is_ unused. I think the real issue is the wrong suggestion, which I have fixed here.
2021-09-30 23:41:05 -07:00
bors
4e4942dfa6 Auto merge of #89395 - In-line:remove_visible_path_from_allowed_deprecated_lint, r=jyn514
Remove visible path calculation from allowed deprecation lint
2021-10-01 06:19:52 +00:00
Marcel Hlopko
198d90786b Add pie as another relocation-model value 2021-10-01 08:06:42 +02:00
bors
598d89bf14 Auto merge of #89414 - Manishearth:rollup-hs11bcq, r=Manishearth
Rollup of 8 pull requests

Successful merges:

 - #88782 (Fix ICE when `start` lang item has wrong generics)
 - #89202 (Resolve infered types when complaining about unexpected call type )
 - #89248 (Suggest similarly named associated items in trait impls)
 - #89303 (Add `#[must_not_suspend]` to some types in std)
 - #89306 (thread: implements available_concurrency on haiku)
 - #89314 (fix(lint): don't suggest refutable patterns to "fix" irrefutable bind)
 - #89370 (CTFE: tweak aggregate rvalue handling)
 - #89392 (bootstrap: Update comment in config.library.toml.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-01 03:23:17 +00:00
Wesley Wiser
3565e8a088 Correct caller/callsite confusion in inliner message 2021-09-30 21:39:02 -04:00
Manish Goregaokar
4661464961
Rollup merge of #89370 - RalfJung:ctfe-aggregate-rvalue, r=oli-obk
CTFE: tweak aggregate rvalue handling

I have not looked at this code in ages... I think Miri does not even hit it, since (most?) aggregate rvalues are lowered somewhere in the MIR pipeline, but CTFE does hit it.

So this adds some extra sanity assertions, and removes a ZST special case -- ZST should only be special cased fairly late (when the actual memory access happens); e.g. `!` is a ZST and we still want `copy_op` to be called for it since it will perform validation (and raise UB, since `!` is never valid).
2021-09-30 18:05:26 -07:00
Manish Goregaokar
fbc67b59a1
Rollup merge of #89314 - notriddle:notriddle/lint-fix-enum-variant-match, r=davidtwco
fix(lint): don't suggest refutable patterns to "fix" irrefutable bind

In function arguments and let bindings, do not suggest changing `C` to `Foo::C` unless `C` is the only variant of `Foo`, because it won't work.

The general warning is still kept, because code like this is confusing.

Fixes #88730

p.s. `src/test/ui/lint/lint-uppercase-variables.rs` already tests the one-variant case.
2021-09-30 18:05:25 -07:00
Manish Goregaokar
837ac87709
Rollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, r=estebank
Suggest similarly named associated items in trait impls

Fix #85942

Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types, and constants.
2021-09-30 18:05:22 -07:00
Manish Goregaokar
b437be45ea
Rollup merge of #89202 - estebank:infer-call-type, r=oli-obk
Resolve infered types when complaining about unexpected call type

```
error[E0618]: expected function, found `{integer}`
  --> $DIR/call-block.rs:2:13
   |
LL |     let _ = {42}();
   |             ^^^^--
   |             |
   |             call expression requires function
```
instead of
```
error[E0618]: expected function, found `_`
  --> $DIR/call-block.rs:2:13
   |
LL |     let _ = {42}();
   |             ^^^^--
   |             |
   |             call expression requires function
```
2021-09-30 18:05:21 -07:00
Manish Goregaokar
3d86aac990
Rollup merge of #88782 - asquared31415:issue-79559, r=cjgillot
Fix ICE when `start` lang item has wrong generics

In my previous pr #87875 I missed the requirements on the `start` lang item due to its relative difficulty to test and opting for more conservative estimates.  This fixes that by updating the requirement to be exactly one generic type.

The `start` lang item should have exactly one generic type for the return type of the `main` fn ptr passed to it.  I believe having zero would previously *sometimes* compile (often with the use of `fn() -> ()` as the fn ptr but it was likely UB to call if the return type of `main` was not `()` as far as I know) however it also sometimes would not for various errors including ICEs and LLVM errors depending on exact situations.  Having more than 1 generic has always failed with an ICE because only the one generic type is expected and provided.

Fixes #79559, fixes #73584, fixes #83117 (all duplicates)
Relevant to #9307

r? ````@cjgillot````
2021-09-30 18:05:20 -07:00
bors
1c0ed0d4c4 Auto merge of #89183 - cjgillot:noenc, r=oli-obk
Move encode_metadata out of CrateStore.

`rustc_metadata` is already accessible by all client crates. It does not need to be called trough a trait object.
2021-10-01 00:35:35 +00:00
Sebastian Pop
0f9f241aac [aarch64] add target feature outline-atomics
Enable outline-atomics by default as enabled in clang by the following commit
https://reviews.llvm.org/rGc5e7e649d537067dec7111f3de1430d0fc8a4d11

Performance improves by several orders of magnitude when using the LSE instructions
instead of the ARMv8.0 compatible load/store exclusive instructions.

Tested on Graviton2 aarch64-linux with
x.py build && x.py install && x.py test
2021-09-30 23:34:33 +00:00
Matthew Jasper
c8f86cad2d Elaborate predicates in min_specialization checks
Supertraits of specialization markers could circumvent checks for
min_specialization. Elaborating predicates prevents this.
2021-09-30 21:42:09 +01:00
bors
aa7aca3b95 Auto merge of #89282 - sexxi-goose:fix-88118, r=nikomatsakis
2229: Consume IfLet expr

When using the IfLet guard feature, we can ICE when attempting to resolve PlaceBuilders.
For pattern matching, we currently don't consume the IfLet expression when "visiting" the arms leading us to not "read" all variables and hence not being able to resolve them.

r? `@nikomatsakis`
Closes https://github.com/rust-lang/rust/issues/88118
2021-09-30 20:23:47 +00:00
Chase Wilson
09f1542418
Implemented -Z randomize-layout 2021-09-30 14:50:06 -05:00
Mark Rousskov
56fcf0725a Avoid nondeterminism in trimmed_def_paths
Previously this query depended on the global interning order of Symbols, which
meant that irrelevant changes could influence the query and cause
recompilations. This commit ensures that the return set is stable and will not
be affected by the global order by deterministically (in lexicographic order)
choosing a name to use if there are multiple names for a single DefId.
2021-09-30 14:27:57 -04:00
Camille GILLOT
2d51b78ca9 Rebase fallout. 2021-09-30 20:22:42 +02:00
pierwill
7ed75ce97c Recommend running cargo clean in E0514 output 2021-09-30 12:52:51 -05:00
Camille Gillot
79d14751a3 Update compiler/rustc_codegen_cranelift/scripts/filter_profile.rs
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-09-30 19:41:32 +02:00
Camille GILLOT
b244b98e7c Move EncodedMetadata to rustc_metadata. 2021-09-30 19:41:32 +02:00
Camille GILLOT
df54d3980b Move encode_metadata out of CrateStore. 2021-09-30 19:41:31 +02:00
Camille Gillot
77c300285c Apply suggestions from code review
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2021-09-30 17:40:17 +02:00
Camille GILLOT
faa7d4221b Do not pass hir::Crate to lints. 2021-09-30 17:39:54 +02:00
bors
6dc08b909b Auto merge of #87998 - nneonneo:master, r=oli-obk
Avoid spurious "previous iteration of loop" errors

Only follow backwards edges during `get_moved_indexes` if the move path is definitely initialized at loop entry. Otherwise, the error occurred prior to the loop, so we ignore the backwards edges to avoid generating misleading "value moved here, in previous iteration of loop" errors.

This patch also slightly improves the analysis of inits, including `NonPanicPathOnly` initializations (which are ignored by `drop_flag_effects::for_location_inits`). This is required for the definite initialization analysis, but may also help find certain skipped reinits in rare cases.

Patch passes all non-ignored src/test/ui testcases.

Fixes #72649.
2021-09-30 13:23:09 +00:00
Alik Aslanyan
d98ac573a4
Remove visible path calculation from allowed deprecation lint 2021-09-30 15:15:10 +04:00
bors
69c1c6a173 Auto merge of #89250 - Aaron1011:keep-bound-region-names, r=estebank
Don't anonymize bound region names during typeck

Once this anonymization has performed, we have no
way of recovering the original names during NLL
borrow checking. Keeping the original names allows
error messages in full NLL mode to contain the original
bound region names.

As a result, the typeck results may contain types that
differ only in the names used for their bound regions. However,
anonimization of bound regions does not guarantee that
all distinct types are unqual (e.g. not subtypes of each other).
For example, `for<'a> fn(&'a u32, &'a u32)` and
`for<'b, 'c> fn(&'b u32, &'c u32)` are subtypes of each other,
as explained here:

63cc2bb3d0/compiler/rustc_infer/src/infer/nll_relate/mod.rs (L682-L690)

Therefore, any code handling types with higher-ranked regions already
needs to handle the case where two distinct `Ty`s are 'actually'
equal.
2021-09-30 07:33:59 +00:00
bors
30acf6def3 Auto merge of #89386 - ehuss:rollup-idf4dmj, r=ehuss
Rollup of 13 pull requests

Successful merges:

 - #87428 (Fix union keyword highlighting in rustdoc HTML sources)
 - #88412 (Remove ignore-tidy-undocumented-unsafe from core::slice::sort)
 - #89098 (Fix generics where bounds order)
 - #89232 (Improve help for recursion limit errors)
 - #89294 (⬆️ rust-analyzer)
 - #89297 (Remove Never variant from clean::Type enum)
 - #89311 (Add unit assignment to MIR for `asm!()`)
 - #89313 (PassWrapper: handle function rename from upstream D36850)
 - #89315 (Clarify that `CString::from_vec_unchecked` appends 0 byte.)
 - #89335 (Optimize is_sorted for Range and RangeInclusive)
 - #89366 (rustdoc: Remove lazy_static dependency)
 - #89377 (Update cargo)
 - #89378 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-09-30 04:51:41 +00:00
Eric Huss
403e221dcf
Rollup merge of #89313 - durin42:llvm-14-thinLTOResolvePrevailingInModule, r=nikic
PassWrapper: handle function rename from upstream D36850

thinLTOResolvePrevailingInModule became thinLTOFinalizeInModule and
gained the ability to propagate noRecurse and noUnwind function
attributes. I ran codegen tests with it both on and off, as the upstream
patch uses it in both modes, and the tests pass both ways. Given that,
it seemed reasonable to go ahead and let the propagation be enabled in
rustc, and see what happens. See https://reviews.llvm.org/D36850 for
more examples of how the new version of the function gets used.

r? ``@nikic`` cc ``@nagisa``
2021-09-29 19:33:40 -07:00
Eric Huss
c5f8675291
Rollup merge of #89311 - FabianWolff:issue-89305, r=oli-obk
Add unit assignment to MIR for `asm!()`

Fixes #89305. `ExprKind::LlvmInlineAsm` gets a `push_assign_unit()` here:
2b6ed3b675/compiler/rustc_mir_build/src/build/expr/into.rs (L475-L479)

The same should probably happen for `ExprKind::InlineAsm`, which fixes the "use of possibly-uninitialized variable" error described in #89305.
2021-09-29 19:33:39 -07:00
Eric Huss
8087147f20
Rollup merge of #89232 - rossmacarthur:fix-76424, r=wesleywiser
Improve help for recursion limit errors

- Tweak help message and suggested limit (handle `0` case).
- Add test for #75602 (it was already fixed, maybe can be resolved too).

Fixes #76424
2021-09-29 19:33:37 -07:00
bors
4aa7879b55 Auto merge of #89110 - Aaron1011:adjustment-span, r=estebank
Use larger span for adjustment THIR expressions

Currently, we use a relatively 'small' span for THIR
expressions generated by an 'adjustment' (e.g. an autoderef,
autoborrow, unsizing). As a result, if a borrow generated
by an adustment ends up causing a borrowcheck error, for example:

```rust
let mut my_var = String::new();
let my_ref = &my_var
my_var.push('a');
my_ref;
```

then the span for the mutable borrow may end up referring
to only the base expression (e.g. `my_var`), rather than
the method call which triggered the mutable borrow
(e.g. `my_var.push('a')`)

Due to a quirk of the MIR borrowck implementation,
this doesn't always get exposed in migration mode,
but it does in many cases.

This commit makes THIR building consistently use 'larger'
spans for adjustment expressions. These spans are recoded
when we first create the adjustment during typecheck. For
example, an autoref adjustment triggered by a method call
will record the span of the entire method call.

The intent of this change it make it clearer to users
when it's the specific way in which a variable is
used (for example, in a method call) that produdes
a borrowcheck error. For example, an error message
claiming that a 'mutable borrow occurs here' might
be confusing if it just points at a usage of a variable
(e.g. `my_var`), when no `&mut` is in sight. Pointing
at the entire expression should help to emphasize
that the method call itself is responsible for
the mutable borrow.

In several cases, this makes the `#![feature(nll)]` diagnostic
output match up exactly with the default (migration mode) output.
As a result, several `.nll.stderr` files end up getting removed
entirely.
2021-09-30 01:40:30 +00:00
Camille GILLOT
abc57f63ad Move body_owners to tcx.hir(). 2021-09-29 23:16:48 +02:00
Camille GILLOT
db9fea508a Avoid more invocations of hir_crate query. 2021-09-29 23:16:47 +02:00
Andreas Jonson
d90934ce87 Fix use after drop in self-profile with llvm events 2021-09-29 22:58:33 +02:00
Ralf Jung
268bb46db2 CTFE: extra assertions for Aggregate rvalues; remove unnecessarily eager special case 2021-09-29 13:47:41 -04:00
Ralf Jung
35f74c24a3 remove outdated comment 2021-09-29 13:43:22 -04:00
jackh726
e1a9ecca26 Cleanup lower_generics_mut and make span be the bound itself, not the type 2021-09-29 13:31:03 -04:00
Michael Howell
6e973f0850 fix(lint): don't suggest refutable patterns to "fix" irrefutable bind
In function arguments and let bindings, do not suggest changing `C` to `Foo::C`
unless `C` is the only variant of `Foo`, because it won't work.

The general warning is still kept, because code like this is confusing.

Fixes #88730
2021-09-29 09:15:35 -07:00
bors
50f9f7810c Auto merge of #89331 - GuillaumeGomez:rollup-b10unye, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #87260 (Libgccjit codegen)
 - #89212 (x.py: run `rustup toolchain link` in setup)
 - #89233 (Hide `<...> defined here` note if the source is not available)
 - #89235 (make junit output more consistent with default format)
 - #89255 (Fix incorrect disambiguation suggestion for associated items)
 - #89276 (Fix the population of the `union.impls` field)
 - #89283 (Add regression test for issue #83564)
 - #89318 (rustc_session: Remove lint store from `Session`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-09-29 10:39:41 +00:00
Audun Halland
e559867d86 Fix truncate of 'bound params stack' by using the correct length 2021-09-29 03:18:56 +02:00
bors
6df1d82869 Auto merge of #88950 - Nadrieril:deconstruct-pat, r=oli-obk
Add an intermediate representation to exhaustiveness checking

The exhaustiveness checking algorithm keeps deconstructing patterns into a `Constructor` and some `Fields`, but does so a bit all over the place. This PR introduces a new representation for patterns that already has that information, so we only compute it once at the start.
I find this makes code easier to follow. In particular `DeconstructedPat::specialize` is a lot simpler than what happened before, and more closely matches the description of the algorithm. I'm also hoping this could help for the project of librarifying exhaustiveness for rust_analyzer since it decouples the algorithm from `rustc_middle::Pat`.
2021-09-29 00:16:17 +00:00
Fabian Wolff
6490ed30e1 Improve error message for printf-style format strings 2021-09-29 02:02:45 +02:00
Michael Howell
105b60f250 feat(rustc_typeck): avoid erroring with "wrong number of generics" if there's other problems
As shown in the two test requirements that got updated, if there's other problems,
then those other problems are probably the root cause of the incorrect generics count.
2021-09-28 15:56:45 -07:00
Audun Halland
f0e99827f8 Deriving: Include bound generic params for extracted type parameters in where clause 2021-09-29 00:46:29 +02:00
Ross MacArthur
d2613fb7a5
Improve help for recursion limit errors 2021-09-28 22:17:13 +02:00
Michael Howell
befdfb5c71 Improve error messages for bad type constraints
Co-authored-by: Esteban Kuber <esteban@kuber.com.ar>
2021-09-28 13:02:45 -07:00
Guillaume Gomez
d9ee68fa4c
Rollup merge of #89318 - petrochenkov:lstore, r=oli-obk
rustc_session: Remove lint store from `Session`

It was added in https://github.com/rust-lang/rust/pull/75534, but after the cleanup in https://github.com/rust-lang/rust/pull/87070 it's no longer necessary.
2021-09-28 20:00:18 +02:00
Guillaume Gomez
48b5d110ae
Rollup merge of #89255 - FabianWolff:issue-88806, r=cjgillot
Fix incorrect disambiguation suggestion for associated items

Fixes #88806. I have not added a new test case, because the erroneous behavior is already present in existing test cases.
2021-09-28 20:00:16 +02:00
Guillaume Gomez
3c60e040b2
Rollup merge of #89233 - FabianWolff:issue-89159, r=estebank
Hide `<...> defined here` note if the source is not available

Fixes #89159. Similar to #87088.

r? ``@estebank``
2021-09-28 20:00:14 +02:00
Guillaume Gomez
864290472f
Rollup merge of #87260 - antoyo:libgccjit-codegen, r=Mark-Simulacrum
Libgccjit codegen

This PR introduces a subtree for a gcc-based codegen backend to the repository, per decision in https://github.com/rust-lang/compiler-team/issues/442. We do not yet expect to ship this backend on nightly or run tests in CI, but we do verify that the backend checks (i.e., `cargo check`) successfully.

Work is expected to progress primarily in https://github.com/rust-lang/rustc_codegen_gcc, with semi-regular upstreaming, like with other subtrees.
2021-09-28 20:00:12 +02:00
Oli Scherer
87a4a79554 Pick one possible lifetime in case there are multiple choices 2021-09-28 16:24:13 +00:00
Esteban Kuber
e19d82f1bf review comments 2021-09-28 16:13:39 +00:00