- match (a, b) {
- (ty::LazyConst::Evaluated(a_eval), ty::LazyConst::Evaluated(b_eval)) => {
- // Only consts whose types are equal should be compared.
- assert_eq!(a_eval.ty, b_eval.ty);
-
- // Currently, the values that can be unified are those that
- // implement both `PartialEq` and `Eq`, corresponding to
- // `structural_match` types.
- // FIXME(const_generics): check for `structural_match` synthetic attribute.
- match (a_eval.val, b_eval.val) {
- (ConstValue::Infer(_), _) | (_, ConstValue::Infer(_)) => {
- // The caller should handle these cases!
- bug!("var types encountered in super_relate_consts: {:?} {:?}", a, b)
- }
- (ConstValue::Param(a_p), ConstValue::Param(b_p)) if a_p.index == b_p.index => {
- Ok(a)
- }
- (ConstValue::Placeholder(p1), ConstValue::Placeholder(p2)) if p1 == p2 => {
- Ok(a)
- }
- (ConstValue::Scalar(Scalar::Bits { .. }), _) if a == b => {
- Ok(a)
- }
- (ConstValue::ByRef(..), _) => {
- bug!(
- "non-Scalar ConstValue encountered in super_relate_consts {:?} {:?}",
- a,
- b,
- );
- }
- _ => {
- Err(TypeError::ConstMismatch(expected_found(relation, &a, &b)))
- }
- }
+ // Currently, the values that can be unified are those that
+ // implement both `PartialEq` and `Eq`, corresponding to
+ // `structural_match` types.
+ // FIXME(const_generics): check for `structural_match` synthetic attribute.
+ match (a.val, b.val) {
+ (ConstValue::Infer(_), _) | (_, ConstValue::Infer(_)) => {
+ // The caller should handle these cases!
+ bug!("var types encountered in super_relate_consts: {:?} {:?}", a, b)