about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2021-07-15 12:42:18 -0300
committerSantiago Pastorino <spastorino@gmail.com>2021-07-18 09:30:10 -0300
commit5cefdbdab5f1308c86193db7c92f807e4e49a402 (patch)
treed361336b1813360d8443be75ff1caa47b82e61ef
parent000b945ceaed1b74b101f96889b63d48d877ba69 (diff)
downloadrust-5cefdbdab5f1308c86193db7c92f807e4e49a402.tar.gz
rust-5cefdbdab5f1308c86193db7c92f807e4e49a402.zip
Use == to compare OpaqueTyOrigin values
-rw-r--r--compiler/rustc_hir/src/hir.rs2
-rw-r--r--compiler/rustc_typeck/src/check/writeback.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs
index fd5ee75effe..5c7d10560ca 100644
--- a/compiler/rustc_hir/src/hir.rs
+++ b/compiler/rustc_hir/src/hir.rs
@@ -2264,7 +2264,7 @@ pub struct OpaqueTy<'hir> {
 }
 
 /// From whence the opaque type came.
-#[derive(Copy, Clone, Encodable, Decodable, Debug, HashStable_Generic)]
+#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
 pub enum OpaqueTyOrigin {
     /// `-> impl Trait`
     FnReturn,
diff --git a/compiler/rustc_typeck/src/check/writeback.rs b/compiler/rustc_typeck/src/check/writeback.rs
index 190ce782cfe..935bcc9f32e 100644
--- a/compiler/rustc_typeck/src/check/writeback.rs
+++ b/compiler/rustc_typeck/src/check/writeback.rs
@@ -521,7 +521,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
             let mut skip_add = false;
 
             if let ty::Opaque(definition_ty_def_id, _substs) = *definition_ty.kind() {
-                if let hir::OpaqueTyOrigin::TyAlias = opaque_defn.origin {
+                if opaque_defn.origin == hir::OpaqueTyOrigin::TyAlias {
                     if opaque_type_key.def_id == definition_ty_def_id {
                         debug!(
                             "skipping adding concrete definition for opaque type {:?} {:?}",