about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-17 03:05:19 +0200
committerGitHub <noreply@github.com>2020-04-17 03:05:19 +0200
commit28964b4ef2f165fdc667367bd9ba6b8d4cf81d34 (patch)
tree42e3f3a3456786349d5ca1fbeff0a34221e2ad6a /src/libstd
parentb2e4d4836f7890fc069d5c62086e1015b9d94ff2 (diff)
parent2edd123a233fff2fbccd17299e0c14d2203e1acc (diff)
downloadrust-28964b4ef2f165fdc667367bd9ba6b8d4cf81d34.tar.gz
rust-28964b4ef2f165fdc667367bd9ba6b8d4cf81d34.zip
Rollup merge of #71220 - cuviper:std_or_patterns, r=Mark-Simulacrum
Dogfood or_patterns in the standard library

We can start using `or_patterns` in the standard library as a step toward stabilization.

cc #54883 @Centril
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/lib.rs1
-rw-r--r--src/libstd/sync/mpsc/oneshot.rs2
-rw-r--r--src/libstd/sync/mpsc/stream.rs2
3 files changed, 3 insertions, 2 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index a9a519f0a3a..59d845c619b 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -285,6 +285,7 @@
 #![feature(never_type)]
 #![feature(nll)]
 #![feature(optin_builtin_traits)]
+#![feature(or_patterns)]
 #![feature(panic_info_message)]
 #![feature(panic_internals)]
 #![feature(panic_unwind)]
diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs
index 5b41525e06a..75f5621fa12 100644
--- a/src/libstd/sync/mpsc/oneshot.rs
+++ b/src/libstd/sync/mpsc/oneshot.rs
@@ -260,7 +260,7 @@ impl<T> Packet<T> {
         let state = match self.state.load(Ordering::SeqCst) {
             // Each of these states means that no further activity will happen
             // with regard to abortion selection
-            s @ EMPTY | s @ DATA | s @ DISCONNECTED => s,
+            s @ (EMPTY | DATA | DISCONNECTED) => s,
 
             // If we've got a blocked thread, then use an atomic to gain ownership
             // of it (may fail)
diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs
index f33493ee0c9..26b4faebd86 100644
--- a/src/libstd/sync/mpsc/stream.rs
+++ b/src/libstd/sync/mpsc/stream.rs
@@ -205,7 +205,7 @@ impl<T> Packet<T> {
             // Messages which actually popped from the queue shouldn't count as
             // a steal, so offset the decrement here (we already have our
             // "steal" factored into the channel count above).
-            data @ Ok(..) | data @ Err(Upgraded(..)) => unsafe {
+            data @ (Ok(..) | Err(Upgraded(..))) => unsafe {
                 *self.queue.consumer_addition().steals.get() -= 1;
                 data
             },