about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2021-08-27 17:13:41 -0400
committerNiko Matsakis <niko@alum.mit.edu>2021-08-27 17:13:41 -0400
commitc4dba5a64efe340a779d8a1ee8c332140c51180e (patch)
tree6a718225b73b0f38b62404f582668b61033a37b4
parentf34909d68f1410c89e3a97bdee04d7e6e7cfbe5e (diff)
downloadrust-c4dba5a64efe340a779d8a1ee8c332140c51180e.tar.gz
rust-c4dba5a64efe340a779d8a1ee8c332140c51180e.zip
use `|=`
-rw-r--r--compiler/rustc_typeck/src/expr_use_visitor.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_typeck/src/expr_use_visitor.rs b/compiler/rustc_typeck/src/expr_use_visitor.rs
index d999c17b579..1c60ef7bda0 100644
--- a/compiler/rustc_typeck/src/expr_use_visitor.rs
+++ b/compiler/rustc_typeck/src/expr_use_visitor.rs
@@ -262,12 +262,14 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
                                     | Res::Def(DefKind::AssocConst, _) => {
                                         // Named constants have to be equated with the value
                                         // being matched, so that's a read of the value being matched.
+                                        //
+                                        // FIXME: We don't actually  reads for ZSTs.
                                         needs_to_be_read = true;
                                     }
                                     _ => {
                                         // Otherwise, this is a struct/enum variant, and so it's
                                         // only a read if we need to read the discriminant.
-                                        needs_to_be_read = is_multivariant_adt(place.place.ty());
+                                        needs_to_be_read |= is_multivariant_adt(place.place.ty());
                                     }
                                 }
                             }
@@ -279,9 +281,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
                                 // perform some reads).
 
                                 let place_ty = place.place.ty();
-                                if is_multivariant_adt(place_ty) {
-                                    needs_to_be_read = true;
-                                }
+                                needs_to_be_read |= is_multivariant_adt(place_ty);
                             }
                             PatKind::Lit(_) | PatKind::Range(..) => {
                                 // If the PatKind is a Lit or a Range then we want