]> git.lizzy.rs Git - rust.git/commitdiff
Fix tests
authorYuki OKUSHI <huyuumi.dev@gmail.com>
Tue, 30 Apr 2019 11:43:10 +0000 (20:43 +0900)
committerYuki OKUSHI <huyuumi.dev@gmail.com>
Tue, 30 Apr 2019 11:43:10 +0000 (20:43 +0900)
14 files changed:
src/test/ui/existential_types/existential-types-with-no-traits.rs [new file with mode: 0644]
src/test/ui/existential_types/existential-types-with-no-traits.stderr [new file with mode: 0644]
src/test/ui/existential_types/generic_nondefining_use.rs
src/test/ui/existential_types/generic_nondefining_use.stderr
src/test/ui/existential_types/generic_not_used.rs
src/test/ui/existential_types/generic_not_used.stderr
src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs
src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr
src/test/ui/existential_types/generic_underconstrained.rs
src/test/ui/existential_types/generic_underconstrained.stderr
src/test/ui/existential_types/generic_underconstrained2.rs
src/test/ui/existential_types/generic_underconstrained2.stderr
src/test/ui/existential_types/unused_generic_param.rs
src/test/ui/existential_types/unused_generic_param.stderr [new file with mode: 0644]

diff --git a/src/test/ui/existential_types/existential-types-with-no-traits.rs b/src/test/ui/existential_types/existential-types-with-no-traits.rs
new file mode 100644 (file)
index 0000000..46339c7
--- /dev/null
@@ -0,0 +1,14 @@
+#![feature(existential_type)]
+
+existential type Foo: 'static;
+//~^ ERROR: at least one trait must be specified
+
+fn foo() -> Foo {
+    "foo"
+}
+
+fn bar() -> impl 'static { //~ ERROR: at least one trait must be specified
+    "foo"
+}
+
+fn main() {}
diff --git a/src/test/ui/existential_types/existential-types-with-no-traits.stderr b/src/test/ui/existential_types/existential-types-with-no-traits.stderr
new file mode 100644 (file)
index 0000000..1464e8b
--- /dev/null
@@ -0,0 +1,14 @@
+error: at least one trait must be specified
+  --> $DIR/existential-types-with-no-traits.rs:3:1
+   |
+LL | existential type Foo: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: at least one trait must be specified
+  --> $DIR/existential-types-with-no-traits.rs:10:13
+   |
+LL | fn bar() -> impl 'static {
+   |             ^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
index 75af5d9570ff2ca7a4a3676719e5f710aec82c6d..ffc965aca47c92eab9f8661243324b21d9fc51eb 100644 (file)
@@ -4,6 +4,8 @@ fn main() {}
 
 existential type Cmp<T>: 'static;
 //~^ ERROR could not find defining uses
+//~^^ ERROR: at least one trait must be specified
+
 
 // not a defining use, because it doesn't define *all* possible generics
 fn cmp() -> Cmp<u32> { //~ ERROR defining existential type use does not fully define
index ef579260f061cd55c2549dfc09f90166d5e332cd..7bde5f3ee5e6947576138acc1fdb7dde3ab74db5 100644 (file)
@@ -1,5 +1,11 @@
+error: at least one trait must be specified
+  --> $DIR/generic_nondefining_use.rs:5:1
+   |
+LL | existential type Cmp<T>: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error: defining existential type use does not fully define existential type
-  --> $DIR/generic_nondefining_use.rs:9:1
+  --> $DIR/generic_nondefining_use.rs:11:1
    |
 LL | / fn cmp() -> Cmp<u32> {
 LL | |     5u32
@@ -12,5 +18,5 @@ error: could not find defining uses
 LL | existential type Cmp<T>: 'static;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
index bfe7b8c4a1d537d0942872eb1eef711f597aacef..054e6f5f2ade99fda0bd2ed82ce68ee6acbc7946 100644 (file)
@@ -3,6 +3,7 @@
 fn main() {}
 
 existential type WrongGeneric<T: 'static>: 'static;
+//~^ ERROR: at least one trait must be specified
 
 fn wrong_generic<U: 'static, V: 'static>(_: U, v: V) -> WrongGeneric<U> {
 //~^ ERROR type parameter `V` is part of concrete type but not used in parameter list
index 1ae4ab65929f03e7e392b1ecbc7e78850305c026..4bce35ea09dc3903948b13b705087daf1438761a 100644 (file)
@@ -1,5 +1,11 @@
+error: at least one trait must be specified
+  --> $DIR/generic_not_used.rs:5:1
+   |
+LL | existential type WrongGeneric<T: 'static>: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error: type parameter `V` is part of concrete type but not used in parameter list for existential type
-  --> $DIR/generic_not_used.rs:7:73
+  --> $DIR/generic_not_used.rs:8:73
    |
 LL |   fn wrong_generic<U: 'static, V: 'static>(_: U, v: V) -> WrongGeneric<U> {
    |  _________________________________________________________________________^
@@ -8,5 +14,5 @@ LL | |     v
 LL | | }
    | |_^
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
index 02bb151ccb618dfa810171cf6c5e6fb3e4227fbc..d9eedd6dca7c1d8621d3578fa178da6da9099c33 100644 (file)
@@ -8,6 +8,7 @@ fn main() {
 
 existential type WrongGeneric<T>: 'static;
 //~^ ERROR the parameter type `T` may not live long enough
+//~^^ ERROR: at least one trait must be specified
 
 fn wrong_generic<T>(t: T) -> WrongGeneric<T> {
     t
index 002acc41553b63e613f2db1c5ea95c3c020ade9c..1e4c49f3f316b123653232eb0c994b69f14f43c8 100644 (file)
@@ -1,3 +1,9 @@
+error: at least one trait must be specified
+  --> $DIR/generic_type_does_not_live_long_enough.rs:9:1
+   |
+LL | existential type WrongGeneric<T>: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error[E0308]: mismatched types
   --> $DIR/generic_type_does_not_live_long_enough.rs:6:18
    |
@@ -22,7 +28,7 @@ note: ...so that the type `T` will meet its required lifetime bounds
 LL | existential type WrongGeneric<T>: 'static;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
 Some errors have detailed explanations: E0308, E0310.
 For more information about an error, try `rustc --explain E0308`.
index 967faca067c1eca6daefd8276388a48768fb2ee9..cc0db893c6aa703ef1f6d0d72326cb9030dfad35 100644 (file)
@@ -4,6 +4,7 @@ fn main() {}
 
 trait Trait {}
 existential type Underconstrained<T: Trait>: 'static; //~ ERROR the trait bound `T: Trait`
+//~^ ERROR: at least one trait must be specified
 
 // no `Trait` bound
 fn underconstrain<T>(_: T) -> Underconstrained<T> {
index 8551a939e8ed8635424eb6ba1bcc10c5a78a228d..d5e9ecc1abe772ddcffa8567aa048acf2af84f1e 100644 (file)
@@ -1,3 +1,9 @@
+error: at least one trait must be specified
+  --> $DIR/generic_underconstrained.rs:6:1
+   |
+LL | existential type Underconstrained<T: Trait>: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error[E0277]: the trait bound `T: Trait` is not satisfied
   --> $DIR/generic_underconstrained.rs:6:1
    |
@@ -7,6 +13,6 @@ LL | existential type Underconstrained<T: Trait>: 'static;
    = help: consider adding a `where T: Trait` bound
    = note: the return type of a function must have a statically known size
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0277`.
index 98d9da832cfd303a88f0688e191cdd242cbf5c6c..c6263eacd53e3c4d75df015b90133f79115bcb4f 100644 (file)
@@ -4,6 +4,7 @@ fn main() {}
 
 existential type Underconstrained<T: std::fmt::Debug>: 'static;
 //~^ ERROR `U` doesn't implement `std::fmt::Debug`
+//~^^ ERROR: at least one trait must be specified
 
 // not a defining use, because it doesn't define *all* possible generics
 fn underconstrained<U>(_: U) -> Underconstrained<U> {
@@ -12,6 +13,7 @@ fn underconstrained<U>(_: U) -> Underconstrained<U> {
 
 existential type Underconstrained2<T: std::fmt::Debug>: 'static;
 //~^ ERROR `V` doesn't implement `std::fmt::Debug`
+//~^^ ERROR: at least one trait must be specified
 
 // not a defining use, because it doesn't define *all* possible generics
 fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
index c7b6d6ade557c34f752cf771f4edce3bcf7099db..df726dde42966c6d14cdd3fee095e46de3d3b651 100644 (file)
@@ -1,3 +1,15 @@
+error: at least one trait must be specified
+  --> $DIR/generic_underconstrained2.rs:5:1
+   |
+LL | existential type Underconstrained<T: std::fmt::Debug>: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: at least one trait must be specified
+  --> $DIR/generic_underconstrained2.rs:14:1
+   |
+LL | existential type Underconstrained2<T: std::fmt::Debug>: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error[E0277]: `U` doesn't implement `std::fmt::Debug`
   --> $DIR/generic_underconstrained2.rs:5:1
    |
@@ -9,7 +21,7 @@ LL | existential type Underconstrained<T: std::fmt::Debug>: 'static;
    = note: the return type of a function must have a statically known size
 
 error[E0277]: `V` doesn't implement `std::fmt::Debug`
-  --> $DIR/generic_underconstrained2.rs:13:1
+  --> $DIR/generic_underconstrained2.rs:14:1
    |
 LL | existential type Underconstrained2<T: std::fmt::Debug>: 'static;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
@@ -18,6 +30,6 @@ LL | existential type Underconstrained2<T: std::fmt::Debug>: 'static;
    = help: consider adding a `where V: std::fmt::Debug` bound
    = note: the return type of a function must have a statically known size
 
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0277`.
index 7af6508788129e868c5c8d6c2370762e252c53da..5455b39f4cbe220b0255826a29d2a34ac9a992cc 100644 (file)
@@ -1,18 +1,17 @@
-// compile-pass
 #![feature(existential_type)]
 
 fn main() {
 }
 
-// test that unused generic parameters are ok
 existential type PartiallyDefined<T>: 'static;
+//~^ ERROR: at least one trait must be specified
 
 fn partially_defined<T: std::fmt::Debug>(_: T) -> PartiallyDefined<T> {
     4u32
 }
 
-// test that unused generic parameters are ok
 existential type PartiallyDefined2<T>: 'static;
+//~^ ERROR: at least one trait must be specified
 
 fn partially_defined2<T: std::fmt::Debug>(_: T) -> PartiallyDefined2<T> {
     4u32
diff --git a/src/test/ui/existential_types/unused_generic_param.stderr b/src/test/ui/existential_types/unused_generic_param.stderr
new file mode 100644 (file)
index 0000000..8c563e9
--- /dev/null
@@ -0,0 +1,14 @@
+error: at least one trait must be specified
+  --> $DIR/unused_generic_param.rs:6:1
+   |
+LL | existential type PartiallyDefined<T>: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: at least one trait must be specified
+  --> $DIR/unused_generic_param.rs:13:1
+   |
+LL | existential type PartiallyDefined2<T>: 'static;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+