Skip to content

Commit

Permalink
remove the RelateResultCompare trait
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed May 16, 2022
1 parent 9ad4bde commit 0ea7301
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions compiler/rustc_infer/src/infer/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,21 +776,6 @@ pub trait ConstEquateRelation<'tcx>: TypeRelation<'tcx> {
fn const_equate_obligation(&mut self, a: ty::Const<'tcx>, b: ty::Const<'tcx>);
}

pub trait RelateResultCompare<'tcx, T> {
fn compare<F>(&self, t: T, f: F) -> RelateResult<'tcx, T>
where
F: FnOnce() -> TypeError<'tcx>;
}

impl<'tcx, T: Clone + PartialEq> RelateResultCompare<'tcx, T> for RelateResult<'tcx, T> {
fn compare<F>(&self, t: T, f: F) -> RelateResult<'tcx, T>
where
F: FnOnce() -> TypeError<'tcx>,
{
self.clone().and_then(|s| if s == t { self.clone() } else { Err(f()) })
}
}

pub fn const_unification_error<'tcx>(
a_is_expected: bool,
(a, b): (ty::Const<'tcx>, ty::Const<'tcx>),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/nll_relate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ where

delegate: &'me mut D,

/// After we generalize this type, we are going to relative it to
/// After we generalize this type, we are going to relate it to
/// some other type. What will be the variance at this point?
ambient_variance: ty::Variance,

Expand Down

0 comments on commit 0ea7301

Please sign in to comment.