]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_trait_selection/src/traits/query/type_op/eq.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / compiler / rustc_trait_selection / src / traits / query / type_op / eq.rs
CommitLineData
9c376795 1use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
9fa01778 2use crate::traits::query::Fallible;
ba9703b0 3use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
8faf50e0 4
ba9703b0 5pub use rustc_middle::traits::query::type_op::Eq;
8faf50e0 6
dc9dc135 7impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
0bf4aa26 8 type QueryResponse = ();
8faf50e0
XL
9
10 fn try_fast_path(
dc9dc135 11 _tcx: TyCtxt<'tcx>,
8faf50e0 12 key: &ParamEnvAnd<'tcx, Eq<'tcx>>,
0bf4aa26 13 ) -> Option<Self::QueryResponse> {
dfeec247 14 if key.value.a == key.value.b { Some(()) } else { None }
8faf50e0
XL
15 }
16
17 fn perform_query(
dc9dc135 18 tcx: TyCtxt<'tcx>,
9c376795
FG
19 canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Self>>,
20 ) -> Fallible<CanonicalQueryResponse<'tcx, ()>> {
8faf50e0
XL
21 tcx.type_op_eq(canonicalized)
22 }
8faf50e0 23}