Move ExpectedFound::new to ty::error.

This commit is contained in:
Camille GILLOT 2020-01-22 13:55:05 +01:00
parent c851db9495
commit 551cc5ebe6
2 changed files with 10 additions and 10 deletions

View file

@ -557,16 +557,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
}
}
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 }
}
}
}
impl<'tcx, T> InferOk<'tcx, T> {
pub fn unit(self) -> InferOk<'tcx, ()> {
InferOk { value: (), obligations: self.obligations }

View 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> {