]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/ty/error.rs
Rollup merge of #68738 - kennytm:derive-clone-eq-for-fromutf8error, r=sfackler
[rust.git] / src / librustc / ty / error.rs
index 217ca0ca3f6f51d38e464b578ddadaaf16593370..0282f409b328d620bc158df4370c9adcf1098edc 100644 (file)
@@ -15,6 +15,16 @@ pub struct ExpectedFound<T> {
     pub found: T,
 }
 
+impl<T> ExpectedFound<T> {
+    pub fn new(a_is_expected: bool, a: T, b: T) -> Self {
+        if a_is_expected {
+            ExpectedFound { expected: a, found: b }
+        } else {
+            ExpectedFound { expected: b, found: a }
+        }
+    }
+}
+
 // Data structures used in type unification
 #[derive(Clone, Debug, TypeFoldable)]
 pub enum TypeError<'tcx> {