Auto merge of #68434 - varkor:astconv-mismatch-error, r=nikomatsakis

Move generic arg/param validation to `create_substs_for_generic_args` to resolve various const generics issues

This changes some diagnostics, but I think they're around as helpful as the previous ones, and occur infrequently regardless.

Fixes https://github.com/rust-lang/rust/issues/68257.
Fixes https://github.com/rust-lang/rust/issues/68398.

r? @eddyb
This commit is contained in:
bors 2020-02-27 18:38:19 +00:00
commit 6d69caba11
25 changed files with 349 additions and 233 deletions

View file

@ -0,0 +1,20 @@
Generic arguments must be provided in the same order as the corresponding
generic parameters are declared.
Erroneous code example:
```compile_fail,E0747
struct S<'a, T>(&'a T);
type X = S<(), 'static>; // error: the type argument is provided before the
// lifetime argument
```
The argument order should be changed to match the parameter declaration
order, as in the following.
```
struct S<'a, T>(&'a T);
type X = S<'static, ()>; // ok
```