rust/src/librustc_trait_selection/traits/query/type_op/eq.rs

24 lines
700 B
Rust
Raw Normal View History

use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
2019-02-05 18:20:45 +01:00
use crate::traits::query::Fallible;
use rustc::ty::{ParamEnvAnd, TyCtxt};
pub use rustc::traits::query::type_op::Eq;
2019-06-13 23:48:52 +02:00
impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
type QueryResponse = ();
2018-06-27 22:17:49 +02:00
fn try_fast_path(
2019-06-13 23:48:52 +02:00
_tcx: TyCtxt<'tcx>,
2018-06-27 22:17:49 +02:00
key: &ParamEnvAnd<'tcx, Eq<'tcx>>,
) -> Option<Self::QueryResponse> {
2019-12-22 23:42:04 +01:00
if key.value.a == key.value.b { Some(()) } else { None }
}
fn perform_query(
2019-06-13 23:48:52 +02:00
tcx: TyCtxt<'tcx>,
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
) -> Fallible<CanonicalizedQueryResponse<'tcx, ()>> {
2018-06-12 20:33:12 +02:00
tcx.type_op_eq(canonicalized)
}
}