X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fty%2Ferror.rs;h=0282f409b328d620bc158df4370c9adcf1098edc;hb=0b50319af69d52ce9806e91fba777986dec4e417;hp=217ca0ca3f6f51d38e464b578ddadaaf16593370;hpb=5d5587795eabba0b51362ab14deb7873a0119c27;p=rust.git diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 217ca0ca3f6..0282f409b32 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -15,6 +15,16 @@ pub struct ExpectedFound { pub found: T, } +impl ExpectedFound { + 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> {