about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/util.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libcore/util.rs b/src/libcore/util.rs
index db9a17cf97f..ba176872b9a 100644
--- a/src/libcore/util.rs
+++ b/src/libcore/util.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -132,6 +132,20 @@ impl Drop for NonCopyable {
 
 pub fn NonCopyable() -> NonCopyable { NonCopyable { i: () } }
 
+
+/// A type with no inhabitants
+pub enum Void { }
+
+pub impl Void {
+    /// A utility function for ignoring this uninhabited type
+    fn uninhabited(&self) -> ! {
+        match *self {
+            // Nothing to match on
+        }
+    }
+}
+
+
 /**
 A utility function for indicating unreachable code. It will fail if
 executed. This is occasionally useful to put after loops that never