about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2021-07-24 20:11:38 +0800
committerDeadbeef <ent3rm4n@gmail.com>2021-08-13 09:28:50 +0000
commit779eef2dae8b2f01af1dc7c8c677388fa7ba1742 (patch)
tree93838eff1db95e54c6d0bd2805e29f351c5eaeaf /compiler/rustc_middle/src
parent3bab45d2acc24bf21c3fc760de0942b437e1ad54 (diff)
downloadrust-779eef2dae8b2f01af1dc7c8c677388fa7ba1742.tar.gz
rust-779eef2dae8b2f01af1dc7c8c677388fa7ba1742.zip
Relate impl
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/ty/relate.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs
index 8efb88d4040..9c48f05617e 100644
--- a/compiler/rustc_middle/src/ty/relate.rs
+++ b/compiler/rustc_middle/src/ty/relate.rs
@@ -214,6 +214,19 @@ impl<'tcx> Relate<'tcx> for ast::Constness {
     }
 }
 
+impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for ty::ConstnessAnd<T> {
+    fn relate<R: TypeRelation<'tcx>>(
+        relation: &mut R,
+        a: ty::ConstnessAnd<T>,
+        b: ty::ConstnessAnd<T>,
+    ) -> RelateResult<'tcx, ty::ConstnessAnd<T>> {
+        Ok(ty::ConstnessAnd {
+            constness: relation.relate(a.constness, b.constness)?,
+            value: relation.relate(a.value, b.value)?,
+        })
+    }
+}
+
 impl<'tcx> Relate<'tcx> for ast::Unsafety {
     fn relate<R: TypeRelation<'tcx>>(
         relation: &mut R,