about summary refs log tree commit diff
path: root/src/libcore/task.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-09-07 18:53:14 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-09-10 12:48:42 -0700
commit22b875770543ec1fe93cfb35fd07c692db5675e2 (patch)
tree62004747db05cf0fb7d82b85133210c67e2c7bb3 /src/libcore/task.rs
parent9a15c50f6c3cec5320ef91f000142af0367890a4 (diff)
downloadrust-22b875770543ec1fe93cfb35fd07c692db5675e2.tar.gz
rust-22b875770543ec1fe93cfb35fd07c692db5675e2.zip
rustc: Make shape-based compare glue never called for comparison operators.
Only called for string patterns.
Diffstat (limited to 'src/libcore/task.rs')
-rw-r--r--src/libcore/task.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/libcore/task.rs b/src/libcore/task.rs
index bee810fceba..ced39ef067b 100644
--- a/src/libcore/task.rs
+++ b/src/libcore/task.rs
@@ -158,6 +158,46 @@ enum SchedMode {
     PlatformThread
 }
 
+impl SchedMode : cmp::Eq {
+    pure fn eq(&&other: SchedMode) -> bool {
+        match self {
+            SingleThreaded => {
+                match other {
+                    SingleThreaded => true,
+                    _ => false
+                }
+            }
+            ThreadPerCore => {
+                match other {
+                    ThreadPerCore => true,
+                    _ => false
+                }
+            }
+            ThreadPerTask => {
+                match other {
+                    ThreadPerTask => true,
+                    _ => false
+                }
+            }
+            ManualThreads(e0a) => {
+                match other {
+                    ManualThreads(e0b) => e0a == e0b,
+                    _ => false
+                }
+            }
+            PlatformThread => {
+                match other {
+                    PlatformThread => true,
+                    _ => false
+                }
+            }
+        }
+    }
+    pure fn ne(&&other: SchedMode) -> bool {
+        !self.eq(other)
+    }
+}
+
 /**
  * Scheduler configuration options
  *