Implement `ToTrace` for `ty::Const`
This commit is contained in:
parent
5fc0395053
commit
9a2772aff0
|
@ -27,6 +27,7 @@
|
|||
|
||||
use super::*;
|
||||
|
||||
use crate::ty::Const;
|
||||
use crate::ty::relate::{Relate, TypeRelation};
|
||||
|
||||
pub struct At<'a, 'gcx: 'tcx, 'tcx: 'a> {
|
||||
|
@ -308,6 +309,20 @@ impl<'tcx> ToTrace<'tcx> for ty::Region<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToTrace<'tcx> for &'tcx Const<'tcx> {
|
||||
fn to_trace(cause: &ObligationCause<'tcx>,
|
||||
a_is_expected: bool,
|
||||
a: Self,
|
||||
b: Self)
|
||||
-> TypeTrace<'tcx>
|
||||
{
|
||||
TypeTrace {
|
||||
cause: cause.clone(),
|
||||
values: Consts(ExpectedFound::new(a_is_expected, a, b))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToTrace<'tcx> for ty::TraitRef<'tcx> {
|
||||
fn to_trace(cause: &ObligationCause<'tcx>,
|
||||
a_is_expected: bool,
|
||||
|
|
|
@ -1260,6 +1260,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
match *values {
|
||||
infer::Types(ref exp_found) => self.expected_found_str_ty(exp_found),
|
||||
infer::Regions(ref exp_found) => self.expected_found_str(exp_found),
|
||||
infer::Consts(ref exp_found) => self.expected_found_str(exp_found),
|
||||
infer::TraitRefs(ref exp_found) => self.expected_found_str(exp_found),
|
||||
infer::PolyTraitRefs(ref exp_found) => self.expected_found_str(exp_found),
|
||||
}
|
||||
|
|
|
@ -232,6 +232,7 @@ pub type PlaceholderMap<'tcx> = BTreeMap<ty::BoundRegion, ty::Region<'tcx>>;
|
|||
pub enum ValuePairs<'tcx> {
|
||||
Types(ExpectedFound<Ty<'tcx>>),
|
||||
Regions(ExpectedFound<ty::Region<'tcx>>),
|
||||
Consts(ExpectedFound<&'tcx ty::Const<'tcx>>),
|
||||
TraitRefs(ExpectedFound<ty::TraitRef<'tcx>>),
|
||||
PolyTraitRefs(ExpectedFound<ty::PolyTraitRef<'tcx>>),
|
||||
}
|
||||
|
@ -1730,6 +1731,7 @@ EnumTypeFoldableImpl! {
|
|||
impl<'tcx> TypeFoldable<'tcx> for ValuePairs<'tcx> {
|
||||
(ValuePairs::Types)(a),
|
||||
(ValuePairs::Regions)(a),
|
||||
(ValuePairs::Consts)(a),
|
||||
(ValuePairs::TraitRefs)(a),
|
||||
(ValuePairs::PolyTraitRefs)(a),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue