]> git.lizzy.rs Git - rust.git/commitdiff
Add explanations to tests
authorAndrew Cann <shum@canndrew.org>
Thu, 11 Aug 2016 17:22:34 +0000 (01:22 +0800)
committerAndrew Cann <shum@canndrew.org>
Sat, 13 Aug 2016 13:37:09 +0000 (21:37 +0800)
17 files changed:
src/test/compile-fail/call-fn-never-arg-wrong-type.rs
src/test/compile-fail/never-assign-dead-code.rs
src/test/compile-fail/never-assign-wrong-type.rs
src/test/compile-fail/never-disabled.rs
src/test/compile-fail/never-fallback.rs
src/test/compile-fail/return-from-diverging.rs
src/test/compile-fail/return-unit-from-diverging.rs
src/test/run-fail/adjust_never.rs
src/test/run-fail/call-fn-never-arg.rs
src/test/run-fail/cast-never.rs
src/test/run-fail/never-associated-type.rs
src/test/run-fail/never-type-arg.rs
src/test/run-fail/return-never-coerce.rs
src/test/run-pass/impl-for-never.rs
src/test/run-pass/never-result.rs
src/test/run-pass/never_coercions.rs
src/test/run-pass/unit-fallback.rs

index cf340989ab7354af1e21e70155ce6d0fa84f04cd..583befed1e8287bf8d82f23f38a71f3e24a4a71b 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we can't pass other types for !
+
 #![feature(never_type)]
 
 fn foo(x: !) -> ! {
index 647ee74ac56451c5d23ce2f7b9d02a983876aa2e..57e0bca6a6d770a36b7b43e09671e1bdbcff8b7a 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that an assignment of type ! makes the rest of the block dead code.
+
 #![feature(never_type)]
 #![deny(unused, unreachable_code)]
 
index 60184fd21b230ca6fcb662fdcd086dc445eb7089..53d96aaf4fe89ad95c8e7350eac5362e0599e7fe 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we can't use another type in place of !
+
 #![feature(never_type)]
 
 fn main() {
index 00cb4f0b17a2422cd54a5120726beabc88414035..11b9f412957eb52c2ef5c5da3241c942a13733bd 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that ! errors when used in illegal positions with feature(never_type) disabled
+
 trait Foo {
     type Wub;
 }
index 24547bd7c8864f312466ce9f0f7af5ae94200663..ca7b715547d2596b8dc73d398ddbbb0b53533574 100644 (file)
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that diverging types default to ! when feature(never_type) is enabled. This test is the
+// same as run-pass/unit-fallback.rs except that ! is enabled.
+
 #![feature(never_type)]
 
 trait Balls: Sized {
index 1221e1097014accfaf198077da323264004ab1a2..cec59faa918bc6a9146846ec440088388f3755af 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that return another type in place of ! raises a type mismatch.
+
 fn fail() -> ! {
     return "wow"; //~ ERROR mismatched types
 }
index 6b66c75582c43a25a0f873ba2b6d0711cc8eb4c9..ae2a325b24a9236d5fede3ea2d6a9ce2f1218437 100644 (file)
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we get the usual error that we'd get for any other return type and not something about
+// diverging functions not being able to return.
+
 fn fail() -> ! {
     return; //~ ERROR in a function whose return type is not
 }
index b390aae6143443c3b28db254d484e7c37f466c9a..ccdb1ca15bba019f10811f2591326986990d1c00 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that a variable of type ! can coerce to another type.
+
 #![feature(never_type)]
 
 // error-pattern:explicit
index b129f17a43788969430249d091359a876b0e7d11..95101e70db95192aae510e6593b4a6175cbfa902 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we can use a ! for an argument of type !
+
 // error-pattern:wowzers!
 
 #![feature(never_type)]
index 02ef0ad29b2829b1d7a513eafe9526f766299a30..acd002494f4eea001af3e740ecf2660c2e78420e 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we can explicitly cast ! to another type
+
 #![feature(never_type)]
 
 // error-pattern:explicit
index 5fa2dfd3e8870ba374cf2a60efb7c0ce98a4d378..345674f3f522ad0c2f914a8c4c7c2c5e0bf732ab 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we can use ! as an associated type.
+
 #![feature(never_type)]
 
 // error-pattern:kapow!
index 7a563127f7f0c9f39a0d4c8ff1d7f535810ac822..826ca3a08c0e1dc5e67c30aa80b2c30fef3c33ac 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we can use ! as an argument to a trait impl.
+
 // error-pattern:oh no!
 
 #![feature(never_type)]
index 15e4834df881835bc7b0a0c67630a8b6471cd7db..4cd93ac7e1a5d23fd9e45cd12ef757a5c7f0013c 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that ! coerces to other types.
+
 // error-pattern:aah!
 
 fn call_another_fn<T, F: FnOnce() -> T>(f: F) -> T {
index 504779ebeb502494ac43243aacd3492e29f86862..4bb4e0128afa85d56b3ffab77018cc6ac2158a0c 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we can call static methods on ! both directly and when it appears in a generic
+
 #![feature(never_type)]
 
 trait StringifyType {
index 555b059ee89e63a92f1d18d33cf84e3a9e4fb292..5c0af392f44df27c659d6cebedccf666c1c4dee7 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we can extract a ! through pattern matching then use it as several different types.
+
 #![feature(never_type)]
 
 fn main() {
index cee2a0a7d529ca7be9d06065fa49ed137dd554f2..dfba5d2c3da0a754b7d1ac92113402f5d8778886 100644 (file)
@@ -8,6 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that having something of type ! doesn't screw up type-checking and that it coerces to the
+// LUB type of the other match arms.
+
 fn main() {
     let v: Vec<u32> = Vec::new();
     match 0u32 {
index 6c3a80b78acb70afb257bf8c9e15cc86d66f0e2e..c5c337dc0823e9828f47456a1a783e64b5b6281a 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that diverging types default to () (with feature(never_type) disabled).
+
 trait Balls: Sized {
     fn smeg() -> Result<Self, ()>;
 }