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

@ -11,7 +11,7 @@ fn foo<'a, 'b>(start: &'a usize, end: &'a usize) {
let _x = (*start..*end)
.map(|x| S { a: start, b: end })
.collect::<Vec<S<_, 'a>>>();
//~^ ERROR lifetime arguments must be declared prior to type arguments
//~^ ERROR type provided when a lifetime was expected
}
fn main() {}

View file

@ -1,8 +1,11 @@
error: lifetime arguments must be declared prior to type arguments
--> $DIR/issue-14303-fncall.rs:13:29
error[E0747]: type provided when a lifetime was expected
--> $DIR/issue-14303-fncall.rs:13:26
|
LL | .collect::<Vec<S<_, 'a>>>();
| ^^
| ^
|
= note: lifetime arguments must be provided before type arguments
error: aborting due to previous error
For more information about this error, try `rustc --explain E0747`.

View file

@ -8,6 +8,6 @@ mod foo {
}
fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
//~^ ERROR lifetime arguments must be declared prior to type arguments
//~^ ERROR type provided when a lifetime was expected
fn main() {}

View file

@ -1,8 +1,11 @@
error: lifetime arguments must be declared prior to type arguments
--> $DIR/issue-14303-path.rs:10:40
error[E0747]: type provided when a lifetime was expected
--> $DIR/issue-14303-path.rs:10:37
|
LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {}
| ^^ ^^
| ^
|
= note: lifetime arguments must be provided before type arguments
error: aborting due to previous error
For more information about this error, try `rustc --explain E0747`.