about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2021-11-21 19:09:14 -0800
committerDavid Tolnay <dtolnay@gmail.com>2021-11-21 19:10:39 -0800
commita4bff741d0bd128dc92a7e36c96af91461bd3611 (patch)
treecf159b518db6f3e7c5a7b122267db3cb9f7bdfa2
parentcebd2dda1d9071f2209079370c412f4ef9ef2b82 (diff)
downloadrust-a4bff741d0bd128dc92a7e36c96af91461bd3611.tar.gz
rust-a4bff741d0bd128dc92a7e36c96af91461bd3611.zip
Test not never
Currently fails to build:

    error[E0600]: cannot apply unary operator `!` to type `!`
       --> library/core/tests/ops.rs:239:8
        |
    239 |     if !return () {}
        |        ^^^^^^^^^^ cannot apply unary operator `!`
-rw-r--r--library/core/tests/ops.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/library/core/tests/ops.rs b/library/core/tests/ops.rs
index aa79dbac8f3..0c81cba35b3 100644
--- a/library/core/tests/ops.rs
+++ b/library/core/tests/ops.rs
@@ -232,3 +232,9 @@ fn deref_on_ref() {
     let y = deref(&mut x);
     assert_eq!(y, 4);
 }
+
+#[test]
+#[allow(unreachable_code)]
+fn test_not_never() {
+    if !return () {}
+}