rust-analyzer/crates
bors 5bd98e36bc Auto merge of #13335 - lowr:patch/change-generic-param-order, r=Veykril
internal: change generic parameter order

tl;dr: This PR changes the `Substitution` for trait items and methods like so:

```rust
trait Trait<TP, const CP: usize> { // note the implicit Self as first parameter
  type Type<TC, const CC: usize>;
  fn f<TC, const CC: usize>() {}
}
impl<TP, const CP: usize> S {
  fn f<TC, const CC: usize>() {}
}
```

- before this PR: `[Self, TP, CP, TC, CC]` for each trait item, `[TP, CP, TC, CC]` for `S::f`
- after this PR: `[TC, CC, Self, TP, CP]` for each trait item, `[TC, CC, TP, CP]` for `S::f`

---

This PR "inverts" the generic parameters/arguments of an item and its parent. This is to fulfill [chalk's expectation](d875af0ff1/chalk-solve/src/rust_ir.rs (L498-L502)) on the order of generic arguments in `Substitution`s for generic associated types and it's one step forward for GATs support (hopefully). Although chalk doesn't put any constraint for other items, it feels more natural to get everything aligned than special casing GATs.

One complication is that `TyBuilder` now demands its users to pass in parent's `Substitution` upon construction unless it's obvious that the the item has no parent (e.g. an ADT never has parent). All users *should* already know the parent of the item in question, and without this, it cannot be easily reasoned about whether we're pushing the argument for the item or for its parent.

Some additional notes:
- f8f5a5ea57: This isn't related to the change, but I felt it's nicer.

- 78977cd86c: There's one major change here other than the generic param order: Default arguments are now bound by the same `Binder` as the item in question rather than a `Binder` limited to parameters they can refer to (i.e. arguments that syntactically appear before them). Now that the order of generic parameters is changed, it would be somewhat complicated to make such `Binder`s as before, and the "full" `Binder`s shouldn't be a problem because we already make sure that the default arguments don't refer to the generic arguments after them with `fallback_bound_vars()`.

- 7556f74b16: This is split from 4385d3dcd0 to make it easy to revert if it turns out that the GATs with const generics panic is actually not resolved with this PR. cc #11878 #11957
2022-10-03 12:13:25 +00:00
..
base-db formatting 2022-09-26 18:35:06 +01:00
cfg Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
flycheck Prioritize restart messages in flycheck 2022-10-03 14:03:54 +02:00
hir Adapt to the new generic parameter/argument order 2022-10-03 02:40:07 +09:00
hir-def Auto merge of #13189 - unexge:unconfigured-diagnostics-for-fields, r=Veykril 2022-09-27 12:59:45 +00:00
hir-expand Auto merge of #13324 - Veykril:trait-impl-completion, r=Veykril 2022-10-01 13:35:08 +00:00
hir-ty Remove hack 2022-10-03 02:40:12 +09:00
ide Auto merge of #13318 - Veykril:annotations, r=Veykril 2022-09-30 22:31:05 +00:00
ide-assists Auto merge of #13321 - Veykril:format-str-args, r=Veykril 2022-09-30 22:42:40 +00:00
ide-completion Fix trait impl item completions using macro file text ranges 2022-10-01 15:34:45 +02:00
ide-db Auto merge of #12966 - OleStrohm:master, r=Veykril 2022-09-20 14:01:16 +00:00
ide-diagnostics Collect diagnostics in queries instead of nameres 2022-09-26 19:06:29 +01:00
ide-ssr Add config to unconditionally prefer core imports over std 2022-09-09 20:04:56 +02:00
limit Properly cfg the max field of Limit 2022-07-31 19:27:20 +02:00
mbe mbe: Remove unneeded unwrap 2022-09-14 23:49:08 +02:00
parser Auto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon, r=jonas-schievink 2022-09-01 21:00:14 +00:00
paths Auto merge of #12808 - Veykril:check-workspace, r=Veykril 2022-08-04 12:57:04 +00:00
proc-macro-api remove imports that are also in edition 2021's prelude 2022-08-09 01:16:32 +02:00
proc-macro-srv Don't run proc-macro-srv tests on the rust-analyzer repo 2022-09-24 00:08:28 +02:00
proc-macro-srv-cli Gate and rename binary, use it if it's in the sysroot 2022-07-25 16:22:39 +02:00
proc-macro-test revert nightly rustfmt formatting that accidentally slipped in 2022-07-25 14:18:30 +02:00
profile Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
project-model Add proc-macro dependency to rustc crates 2022-10-01 21:29:14 +02:00
rust-analyzer Add config for supplying sysroot path 2022-10-01 21:17:06 +02:00
sourcegen Remove obsolete in-rust-tree feature from sourcegen 2022-09-26 11:34:30 +02:00
stdx Update test fixtures 2022-08-25 21:07:24 +02:00
syntax Generate From impls manually 2022-09-26 19:29:28 +01:00
test-utils Add tests for type inference for generators 2022-09-13 02:43:07 +09:00
text-edit Enable extra warnings required by rust-lang/rust 2022-07-20 15:00:17 +02:00
toolchain Enable extra warnings required by rust-lang/rust 2022-07-20 15:00:17 +02:00
tt Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
vfs Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
vfs-notify Bump notify 2022-08-19 21:37:05 +03:00