about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2020-01-21 23:07:07 +0000
committervarkor <github@varkor.com>2020-02-22 00:28:18 +0000
commit039045c49bec06f3a42aed90d3bc94520d92514e (patch)
tree3091e29070119dfda744b3c9661f49fccd8a996b /src/test
parent750e673491114cd8454f1715ce1fda8dd02b7ac0 (diff)
downloadrust-039045c49bec06f3a42aed90d3bc94520d92514e.tar.gz
rust-039045c49bec06f3a42aed90d3bc94520d92514e.zip
Move generic arg / param validation to `create_substs_for_generic_args`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/const-generics/const-arg-type-arg-misordered.rs10
-rw-r--r--src/test/ui/const-generics/const-arg-type-arg-misordered.stderr17
-rw-r--r--src/test/ui/const-generics/const-param-after-const-literal-arg.rs10
-rw-r--r--src/test/ui/const-generics/const-param-after-const-literal-arg.stderr8
-rw-r--r--src/test/ui/const-generics/const-param-before-other-params.rs1
-rw-r--r--src/test/ui/const-generics/const-param-before-other-params.stderr12
-rw-r--r--src/test/ui/parser/issue-14303-fncall.rs2
-rw-r--r--src/test/ui/parser/issue-14303-fncall.stderr7
-rw-r--r--src/test/ui/parser/issue-14303-path.rs2
-rw-r--r--src/test/ui/parser/issue-14303-path.stderr7
-rw-r--r--src/test/ui/suggestions/suggest-move-types.rs8
-rw-r--r--src/test/ui/suggestions/suggest-move-types.stderr21
-rw-r--r--src/test/ui/traits/trait-object-vs-lifetime.rs2
-rw-r--r--src/test/ui/traits/trait-object-vs-lifetime.stderr15
14 files changed, 90 insertions, 32 deletions
diff --git a/src/test/ui/const-generics/const-arg-type-arg-misordered.rs b/src/test/ui/const-generics/const-arg-type-arg-misordered.rs
new file mode 100644
index 00000000000..f024eb6a957
--- /dev/null
+++ b/src/test/ui/const-generics/const-arg-type-arg-misordered.rs
@@ -0,0 +1,10 @@
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+
+type Array<T, const N: usize> = [T; N];
+
+fn foo<const N: usize>() -> Array<N, ()> { //~ ERROR constant provided when a type was expected
+    unimplemented!()
+}
+
+fn main() {}
diff --git a/src/test/ui/const-generics/const-arg-type-arg-misordered.stderr b/src/test/ui/const-generics/const-arg-type-arg-misordered.stderr
new file mode 100644
index 00000000000..225e1cd547e
--- /dev/null
+++ b/src/test/ui/const-generics/const-arg-type-arg-misordered.stderr
@@ -0,0 +1,17 @@
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+  --> $DIR/const-arg-type-arg-misordered.rs:1:12
+   |
+LL | #![feature(const_generics)]
+   |            ^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(incomplete_features)]` on by default
+
+error[E0747]: constant provided when a type was expected
+  --> $DIR/const-arg-type-arg-misordered.rs:6:35
+   |
+LL | fn foo<const N: usize>() -> Array<N, ()> {
+   |                                   ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/const-generics/const-param-after-const-literal-arg.rs b/src/test/ui/const-generics/const-param-after-const-literal-arg.rs
new file mode 100644
index 00000000000..683bcc867c7
--- /dev/null
+++ b/src/test/ui/const-generics/const-param-after-const-literal-arg.rs
@@ -0,0 +1,10 @@
+// check-pass
+
+#![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
+
+struct Foo<const A: usize, const B: usize>;
+
+impl<const A: usize> Foo<1, A> {} // ok
+
+fn main() {}
diff --git a/src/test/ui/const-generics/const-param-after-const-literal-arg.stderr b/src/test/ui/const-generics/const-param-after-const-literal-arg.stderr
new file mode 100644
index 00000000000..a949a6ec9ff
--- /dev/null
+++ b/src/test/ui/const-generics/const-param-after-const-literal-arg.stderr
@@ -0,0 +1,8 @@
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+  --> $DIR/const-param-after-const-literal-arg.rs:3:12
+   |
+LL | #![feature(const_generics)]
+   |            ^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(incomplete_features)]` on by default
+
diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs
index 5bdbfd8ff1f..2c81681b85e 100644
--- a/src/test/ui/const-generics/const-param-before-other-params.rs
+++ b/src/test/ui/const-generics/const-param-before-other-params.rs
@@ -1,4 +1,5 @@
 #![feature(const_generics)]
+//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
 
 fn bar<const X: (), 'a>(_: &'a ()) {
     //~^ ERROR lifetime parameters must be declared prior to const parameters
diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr
index 87622f7e500..fccf732de4c 100644
--- a/src/test/ui/const-generics/const-param-before-other-params.stderr
+++ b/src/test/ui/const-generics/const-param-before-other-params.stderr
@@ -1,14 +1,22 @@
 error: lifetime parameters must be declared prior to const parameters
-  --> $DIR/const-param-before-other-params.rs:3:21
+  --> $DIR/const-param-before-other-params.rs:4:21
    |
 LL | fn bar<const X: (), 'a>(_: &'a ()) {
    |       --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>`
 
 error: type parameters must be declared prior to const parameters
-  --> $DIR/const-param-before-other-params.rs:7:21
+  --> $DIR/const-param-before-other-params.rs:8:21
    |
 LL | fn foo<const X: (), T>(_: &T) {
    |       --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>`
 
+warning: the feature `const_generics` is incomplete and may cause the compiler to crash
+  --> $DIR/const-param-before-other-params.rs:1:12
+   |
+LL | #![feature(const_generics)]
+   |            ^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(incomplete_features)]` on by default
+
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/parser/issue-14303-fncall.rs b/src/test/ui/parser/issue-14303-fncall.rs
index 39694198cdb..46ece84d69e 100644
--- a/src/test/ui/parser/issue-14303-fncall.rs
+++ b/src/test/ui/parser/issue-14303-fncall.rs
@@ -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() {}
diff --git a/src/test/ui/parser/issue-14303-fncall.stderr b/src/test/ui/parser/issue-14303-fncall.stderr
index 8ef9f1a1a6c..cdda0d001c7 100644
--- a/src/test/ui/parser/issue-14303-fncall.stderr
+++ b/src/test/ui/parser/issue-14303-fncall.stderr
@@ -1,8 +1,9 @@
-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>>>();
-   |                             ^^
+   |                          ^
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/parser/issue-14303-path.rs b/src/test/ui/parser/issue-14303-path.rs
index 386d19859e4..89ef914aba2 100644
--- a/src/test/ui/parser/issue-14303-path.rs
+++ b/src/test/ui/parser/issue-14303-path.rs
@@ -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() {}
diff --git a/src/test/ui/parser/issue-14303-path.stderr b/src/test/ui/parser/issue-14303-path.stderr
index 19f2995ebee..841e63ecbe9 100644
--- a/src/test/ui/parser/issue-14303-path.stderr
+++ b/src/test/ui/parser/issue-14303-path.stderr
@@ -1,8 +1,9 @@
-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>) {}
-   |                                        ^^  ^^
+   |                                     ^
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/suggestions/suggest-move-types.rs b/src/test/ui/suggestions/suggest-move-types.rs
index 890950ea08c..6505a97de6e 100644
--- a/src/test/ui/suggestions/suggest-move-types.rs
+++ b/src/test/ui/suggestions/suggest-move-types.rs
@@ -33,7 +33,7 @@ struct A<T, M: One<A=(), T>> { //~ ERROR associated type bindings must be declar
 
 struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> {
 //~^ ERROR associated type bindings must be declared after generic parameters
-//~^^ ERROR lifetime arguments must be declared prior to type arguments
+//~^^ ERROR type provided when a lifetime was expected
     m: M,
     t: &'a T,
 }
@@ -47,7 +47,7 @@ struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> { //~ ERROR associated ty
 
 struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> {
 //~^ ERROR associated type bindings must be declared after generic parameters
-//~^^ ERROR lifetime arguments must be declared prior to type arguments
+//~^^ ERROR type provided when a lifetime was expected
     m: M,
     t: &'a T,
     u: &'b U,
@@ -63,7 +63,7 @@ struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> { //~ ERROR associated ty
 
 struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> {
 //~^ ERROR associated type bindings must be declared after generic parameters
-//~^^ ERROR lifetime arguments must be declared prior to type arguments
+//~^^ ERROR lifetime provided when a type was expected
     m: M,
     t: &'a T,
     u: &'b U,
@@ -79,7 +79,7 @@ struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> { //~ ERROR associated ty
 
 struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> {
 //~^ ERROR associated type bindings must be declared after generic parameters
-//~^^ ERROR lifetime arguments must be declared prior to type arguments
+//~^^ ERROR lifetime provided when a type was expected
     m: M,
     t: &'a T,
     u: &'b U,
diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr
index 552fb78cd3f..07ad1a31508 100644
--- a/src/test/ui/suggestions/suggest-move-types.stderr
+++ b/src/test/ui/suggestions/suggest-move-types.stderr
@@ -74,29 +74,30 @@ LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, '
    |                                                            |     this associated type binding should be moved after the generic parameters
    |                                                            this associated type binding should be moved after the generic parameters
 
-error: lifetime arguments must be declared prior to type arguments
-  --> $DIR/suggest-move-types.rs:34:46
+error[E0747]: type provided when a lifetime was expected
+  --> $DIR/suggest-move-types.rs:34:43
    |
 LL | struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> {
-   |                                              ^^
+   |                                           ^
 
-error: lifetime arguments must be declared prior to type arguments
-  --> $DIR/suggest-move-types.rs:48:80
+error[E0747]: type provided when a lifetime was expected
+  --> $DIR/suggest-move-types.rs:48:71
    |
 LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> {
-   |                                                                                ^^  ^^  ^^
+   |                                                                       ^
 
-error: lifetime arguments must be declared prior to type arguments
+error[E0747]: lifetime provided when a type was expected
   --> $DIR/suggest-move-types.rs:64:56
    |
 LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> {
-   |                                                        ^^                       ^^     ^^
+   |                                                        ^^
 
-error: lifetime arguments must be declared prior to type arguments
+error[E0747]: lifetime provided when a type was expected
   --> $DIR/suggest-move-types.rs:80:56
    |
 LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> {
-   |                                                        ^^                 ^^           ^^
+   |                                                        ^^
 
 error: aborting due to 12 previous errors
 
+For more information about this error, try `rustc --explain E0747`.
diff --git a/src/test/ui/traits/trait-object-vs-lifetime.rs b/src/test/ui/traits/trait-object-vs-lifetime.rs
index e0ff7349483..e885cd2f68a 100644
--- a/src/test/ui/traits/trait-object-vs-lifetime.rs
+++ b/src/test/ui/traits/trait-object-vs-lifetime.rs
@@ -12,6 +12,6 @@ fn main() {
     //~^ ERROR wrong number of lifetime arguments: expected 1, found 2
     //~| ERROR wrong number of type arguments: expected 1, found 0
     let _: S<dyn 'static +, 'static>;
-    //~^ ERROR lifetime arguments must be declared prior to type arguments
+    //~^ ERROR type provided when a lifetime was expected
     //~| ERROR at least one trait is required for an object type
 }
diff --git a/src/test/ui/traits/trait-object-vs-lifetime.stderr b/src/test/ui/traits/trait-object-vs-lifetime.stderr
index be1958770a4..d1e5a65c0ad 100644
--- a/src/test/ui/traits/trait-object-vs-lifetime.stderr
+++ b/src/test/ui/traits/trait-object-vs-lifetime.stderr
@@ -1,9 +1,3 @@
-error: lifetime arguments must be declared prior to type arguments
-  --> $DIR/trait-object-vs-lifetime.rs:14:29
-   |
-LL |     let _: S<dyn 'static +, 'static>;
-   |                             ^^^^^^^
-
 error[E0224]: at least one trait is required for an object type
   --> $DIR/trait-object-vs-lifetime.rs:9:23
    |
@@ -28,6 +22,13 @@ error[E0224]: at least one trait is required for an object type
 LL |     let _: S<dyn 'static +, 'static>;
    |              ^^^^^^^^^^^^^
 
+error[E0747]: type provided when a lifetime was expected
+  --> $DIR/trait-object-vs-lifetime.rs:14:14
+   |
+LL |     let _: S<dyn 'static +, 'static>;
+   |              ^^^^^^^^^^^^^
+
 error: aborting due to 5 previous errors
 
-For more information about this error, try `rustc --explain E0107`.
+Some errors have detailed explanations: E0107, E0747.
+For more information about an error, try `rustc --explain E0107`.