Commit Graph

19931 Commits

Author SHA1 Message Date
Esteban Küber
165efabbee review comments 2022-12-13 11:36:43 -08:00
Esteban Küber
7d1e47aeb0 Suggest : Type instead of : _ 2022-12-13 10:39:44 -08:00
Esteban Küber
3e25bcb020 Mention implementations that satisfy the trait 2022-12-13 10:39:44 -08:00
Esteban Küber
b3fba5e18a Remove unnecessary code and account for turbofish suggestion
Remove previously existing fallback that tried to give a good turbofish
suggestion, `need_type_info` is already good enough.

Special case `::<Vec<_>` suggestion for `Iterator::collect`.
2022-12-13 10:39:44 -08:00
Esteban Küber
9d5e7d3c04 Suggest collecting into Vec<_> 2022-12-13 10:39:44 -08:00
bors
ed620cf969 Auto merge of #105612 - oli-obk:bind_rustdoc, r=GuillaumeGomez
use ty::Binder in rustdoc instead of `skip_binder`

r? `@GuillaumeGomez`

this is a preliminary cleanup required to be able to normalize correctly/conveniently in rustdoc
2022-12-13 13:09:40 +00:00
bors
109cccbe4f Auto merge of #105350 - compiler-errors:faster-binder-relate, r=oli-obk
Fast-path some binder relations

A simpler approach than #104598

Fixes #104583

r? types
2022-12-13 07:10:53 +00:00
bors
71ec1457ee Auto merge of #105436 - nnethercote:inline-place_contents_drop_state_cannot_differ, r=spastorino
Inline and remove `place_contents_drop_state_cannot_differ`.

It has a single call site and is hot enough to be worth inlining. And make sure `is_terminal_path` is inlined, too.

r? `@ghost`
2022-12-13 03:28:57 +00:00
Michael Goulet
2025a96ee1 Fast path some binder relations 2022-12-13 03:17:14 +00:00
Matthias Krüger
2707801858
Rollup merge of #105625 - matthiaskrgr:clippy_dec12, r=compiler-errors
minor code cleanups

r? `@compiler-errors`
2022-12-13 01:17:10 +01:00
Matthias Krüger
4069792d73
Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors
Remove unnecessary uses of `clone`
2022-12-13 01:17:10 +01:00
Matthias Krüger
8917cc0f23
Rollup merge of #105332 - estebank:iterator-chains, r=oli-obk
Point out the type of associated types in every method call of iterator chains

Partially address #105184 by pointing out the type of associated types in every method call of iterator chains:

```
note: the expression is of type `Map<std::slice::Iter<'_, {integer}>, [closure@src/test/ui/iterators/invalid-iterator-chain.rs:12:18: 12:21]>`
    --> src/test/ui/iterators/invalid-iterator-chain.rs:12:14
     |
10   |         vec![0, 1]
     |         ---------- this expression has type `Vec<{integer}>`
11   |             .iter()
     |              ------ associated type `std::iter::Iterator::Item` is `&{integer}` here
12   |             .map(|x| { x; })
     |              ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `()` here
```

We also reduce the number of impls we mention when any of the candidates is an "exact match". This benefits the output of cases with numerics greatly.

Outstanding work would be to provide a structured suggestion for appropriate changes, like in this case detecting the spurious `;` in the closure.
2022-12-13 01:17:09 +01:00
Matthias Krüger
6dbaf86672
Rollup merge of #104864 - chenyukang:yukang/fix-104700-binding, r=estebank
Account for item-local in inner scope for E0425

Fixes #104700
2022-12-13 01:17:08 +01:00
Esteban Küber
f4ed2d1cca Do not skip_binders 2022-12-12 11:53:39 -08:00
Matthias Krüger
2ea368e53c minor code cleanups 2022-12-12 19:49:53 +01:00
Matthias Krüger
666366444c
Rollup merge of #105615 - WaffleLapkin:remove_opt_scope_span_mention, r=compiler-errors
Fixup method doc that mentions removed param

The param was removed in https://github.com/rust-lang/rust/pull/61872 (101a2f59b4)
2022-12-12 19:20:36 +01:00
Matthias Krüger
c8b07c0529
Rollup merge of #105614 - lukas-code:ascription, r=Nilstrieb
delete mentions of type ascription from lint descriptions

Tracking Issue: https://github.com/rust-lang/rust/issues/101728
2022-12-12 19:20:36 +01:00
Matthias Krüger
38d97d3ea7
Rollup merge of #105593 - jruderman:patch-3, r=Dylan-DPC
Fix typo in comment: length_limit
2022-12-12 19:20:35 +01:00
Matthias Krüger
f4cca46078
Rollup merge of #105561 - TaKO8Ki:fix-105449, r=fee1-dead
Normalize receiver substs and erase the regions

Fixes #105449
2022-12-12 19:20:34 +01:00
Esteban Küber
348386985d Move logic to their own methods 2022-12-12 09:23:36 -08:00
Takayuki Maeda
ee40a67cd9 remove unnecessary uses of clone 2022-12-13 02:06:24 +09:00
Lukas Markeffsky
6abffffdff delete mentions of type ascription from lint descriptions
Move it to the historical context section instead.
2022-12-12 17:43:15 +01:00
Maybe Waffle
613c1216b7 Fixup method doc that mentions removed param 2022-12-12 15:43:04 +00:00
Oli Scherer
30754517d1 Avoid trying to normalize unnormalizable types 2022-12-12 14:39:08 +00:00
Oli Scherer
21917b0866 Round 3: require binders for substs 2022-12-12 13:20:36 +00:00
Takayuki Maeda
3bc54baa61 normalize receiver substs and erase the regions
use a smaller example
2022-12-12 22:16:51 +09:00
Oli Scherer
dbf4b8a436 Round 1: add some binders (fails due to losing bound vars and then rebinding them with Binder::dummy) 2022-12-12 12:12:40 +00:00
bors
37d7de3379 Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa
Use struct types during codegen in less places

This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.
2022-12-12 10:38:31 +00:00
bors
2176e3a7a4 Auto merge of #105592 - matthiaskrgr:rollup-1cazogq, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #104997 (Move tests)
 - #105569 (`bug!` with a better error message for failing `Instance::resolve`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-12 07:57:41 +00:00
Matthias Krüger
5877a3fce1
Rollup merge of #105569 - compiler-errors:resolve-bug-better, r=TaKO8Ki
`bug!` with a better error message for failing `Instance::resolve`

Better ICE message when `.unwrap().unwrap()` fails.
2022-12-12 08:21:32 +01:00
Jesse Ruderman
c27d7949a1
Fix typo in comment: length_limit 2022-12-11 23:21:10 -08:00
bors
2cd2070af7 Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov
Remove `token::Lit` from `ast::MetaItemLit`.

Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time.

r? `@petrochenkov`
2022-12-12 05:16:50 +00:00
bors
b397bc0727 Auto merge of #105485 - nnethercote:fix-lint-perf-regressions, r=cjgillot
Fix lint perf regressions

#104863 caused small but widespread regressions in lint performance. I tried to improve things in #105291 and #105416 with minimal success, before fully understanding what caused the regression. This PR effectively reverts all of #105291 and part of #104863 to fix the perf regression.

r? `@cjgillot`
2022-12-12 02:17:08 +00:00
Esteban Küber
2838b8e515 Point at method call when it is the source of the bound error 2022-12-11 14:49:50 -08:00
Matthias Krüger
79f99e7969
Rollup merge of #105555 - krasimirgg:llvm-int-opt-2, r=cuviper
llvm-wrapper: adapt for LLVM API changes

This is a follow-up of 75aec4703d. There, I updated the wrapper to only include llvm/ADT/Optional.h for LLVM version below 16. But I missed updating some of the None references.

Found by our experimental rust + llvm at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15587#0185006b-e0af-49e5-8b06-280ed125ff0d/200-539
2022-12-11 23:36:47 +01:00
Matthias Krüger
6042f5bca7
Rollup merge of #105521 - tshepang:keep-heading-separate, r=nagisa
separate heading from body
2022-12-11 23:36:46 +01:00
Matthias Krüger
6ed8cb6616
Rollup merge of #105472 - spastorino:make-encoder-use-queries, r=oli-obk
Make encode_info_for_trait_item use queries instead of accessing the HIR

This change avoids accessing the HIR on `encode_info_for_trait_item` and uses queries. We will need to execute this function for elements that have no HIR and by using queries we will be able to feed for definitions that have no HIR.

r? ``@oli-obk``
2022-12-11 23:36:46 +01:00
Matthias Krüger
4154e14f9a
Rollup merge of #105369 - chenyukang:yukang/fix-105226, r=TaKO8Ki
Detect spurious ; before assoc fn body

Fixes #105226

r? ``@TaKO8Ki``
2022-12-11 23:36:46 +01:00
Matthias Krüger
aa7b5b32e3
Rollup merge of #105283 - compiler-errors:ty-var-in-hir-wfcheck, r=nagisa
Don't call `diagnostic_hir_wf_check` query if we have infer variables

Fixes #105260
2022-12-11 23:36:45 +01:00
Nicholas Nethercote
4ff5a3655f Speed up the "builtin lints only" case.
This commit partly undoes #104863, which combined the builtin lints pass
with other lints. This caused a slowdown, because often there are no
other lints, and it's faster to do a pass with a single lint directly
than it is to do a combined pass with a `passes` vector containing a
single lint.
2022-12-12 08:59:27 +11:00
Nicholas Nethercote
3c53781800 Reinstate {Early,Late}LintPassObjects.
I removed these in #105291, and subsequently learned they are necessary
for performance.

This commit reinstates them with the new and more descriptive names
`RuntimeCombined{Early,Late}LintPass`, similar to the existing passes
like `BuiltinCombinedEarlyLintPass`. It also adds some comments,
particularly emphasising how we have ways to combine passes at both
compile-time and runtime. And it moves some comments around.
2022-12-12 08:59:27 +11:00
Nicholas Nethercote
2b05f84115 Rename run_early_passes as lint_callback.
This matches the name used in `late.rs`.
2022-12-12 08:59:27 +11:00
Michael Goulet
bc293ed53e bug! with a better error message for failing Instance::resolve 2022-12-11 19:48:24 +00:00
Esteban Küber
ce486d538b Use with_forced_trimmed_paths 2022-12-11 11:38:43 -08:00
Esteban Küber
78f97595a3 Only point at methods that might be relevant 2022-12-11 09:46:02 -08:00
Esteban Küber
aff0ab43c8 Add label to method chains where assoc type remains the same 2022-12-11 09:46:02 -08:00
Esteban Küber
c77ad2d765 Remove mention of "assoc type" in label as it is already in the note message 2022-12-11 09:46:02 -08:00
Esteban Küber
71db025cfa Account for method call chains split across multiple bindings 2022-12-11 09:46:02 -08:00
Esteban Küber
64bc975d27 Mention only assoc types changes 2022-12-11 09:46:01 -08:00
Michael Goulet
bc60d50eaa Provide associated type information in method chains
When encountering an unmet obligation that affects a method chain, like
in iterator chains where one of the links has the wrong associated
type, we point at every method call and mention their evaluated
associated type at that point to give context to the user of where
expectations diverged from the code as written.

```
note: the expression is of type `Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/invalid-iterator-chain.rs:12:18: 12:21]>`
  --> $DIR/invalid-iterator-chain.rs:12:14
   |
LL |         vec![0, 1]
   |         ---------- this expression has type `Vec<{integer}>`
LL |             .iter()
   |              ------ associated type `std::iter::Iterator::Item` is `&{integer}` here
LL |             .map(|x| { x; })
   |              ^^^^^^^^^^^^^^^ associated type `std::iter::Iterator::Item` is `()` here
```
2022-12-11 09:46:01 -08:00