Rollup merge of #124610 - nnethercote:typenum, r=lcnr
Tweak `consts_may_unify` r? ````@lcnr````
This commit is contained in:
commit
a9edd38d18
@ -330,20 +330,19 @@ pub fn types_may_unify<'tcx>(self, obligation_ty: Ty<'tcx>, impl_ty: Ty<'tcx>) -
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn consts_may_unify(self, obligation_ct: ty::Const<'_>, impl_ct: ty::Const<'_>) -> bool {
|
pub fn consts_may_unify(self, obligation_ct: ty::Const<'_>, impl_ct: ty::Const<'_>) -> bool {
|
||||||
match impl_ct.kind() {
|
let impl_val = match impl_ct.kind() {
|
||||||
ty::ConstKind::Expr(_)
|
ty::ConstKind::Expr(_)
|
||||||
| ty::ConstKind::Param(_)
|
| ty::ConstKind::Param(_)
|
||||||
| ty::ConstKind::Unevaluated(_)
|
| ty::ConstKind::Unevaluated(_)
|
||||||
| ty::ConstKind::Error(_) => {
|
| ty::ConstKind::Error(_) => {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ty::ConstKind::Value(_) => {}
|
ty::ConstKind::Value(impl_val) => impl_val,
|
||||||
ty::ConstKind::Infer(_) | ty::ConstKind::Bound(..) | ty::ConstKind::Placeholder(_) => {
|
ty::ConstKind::Infer(_) | ty::ConstKind::Bound(..) | ty::ConstKind::Placeholder(_) => {
|
||||||
bug!("unexpected impl arg: {:?}", impl_ct)
|
bug!("unexpected impl arg: {:?}", impl_ct)
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
let k = impl_ct.kind();
|
|
||||||
match obligation_ct.kind() {
|
match obligation_ct.kind() {
|
||||||
ty::ConstKind::Param(_) => match self.treat_obligation_params {
|
ty::ConstKind::Param(_) => match self.treat_obligation_params {
|
||||||
TreatParams::ForLookup => false,
|
TreatParams::ForLookup => false,
|
||||||
@ -358,10 +357,7 @@ pub fn consts_may_unify(self, obligation_ct: ty::Const<'_>, impl_ct: ty::Const<'
|
|||||||
ty::ConstKind::Expr(_) | ty::ConstKind::Unevaluated(_) | ty::ConstKind::Error(_) => {
|
ty::ConstKind::Expr(_) | ty::ConstKind::Unevaluated(_) | ty::ConstKind::Error(_) => {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
ty::ConstKind::Value(obl) => match k {
|
ty::ConstKind::Value(obl_val) => obl_val == impl_val,
|
||||||
ty::ConstKind::Value(imp) => obl == imp,
|
|
||||||
_ => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
ty::ConstKind::Infer(_) => true,
|
ty::ConstKind::Infer(_) => true,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user