2019-09-25 22:40:24 +02:00
|
|
|
use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
|
2019-02-05 18:20:45 +01:00
|
|
|
use crate::traits::query::Fallible;
|
2020-01-07 22:07:22 +01:00
|
|
|
use rustc::ty::{ParamEnvAnd, TyCtxt};
|
2018-06-09 03:04:03 +02:00
|
|
|
|
2020-01-22 09:04:50 +01:00
|
|
|
pub use rustc::traits::query::type_op::Eq;
|
2018-06-09 03:04:03 +02:00
|
|
|
|
2019-06-13 23:48:52 +02:00
|
|
|
impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
|
2018-09-24 21:27:47 +02:00
|
|
|
type QueryResponse = ();
|
2018-06-09 03:04:03 +02:00
|
|
|
|
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>>,
|
2018-09-24 21:27:47 +02:00
|
|
|
) -> Option<Self::QueryResponse> {
|
2019-12-22 23:42:04 +01:00
|
|
|
if key.value.a == key.value.b { Some(()) } else { None }
|
2018-06-09 03:04:03 +02:00
|
|
|
}
|
|
|
|
|
2018-06-11 10:11:37 +02:00
|
|
|
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)
|
2018-06-11 10:11:37 +02:00
|
|
|
}
|
|
|
|
}
|