/// also implement all supertraits of `X`.
ItemObligation(DefId),
+ /// Like `ItemObligation`, but with extra detail on the source of the obligation.
+ BindingObligation(DefId, Span),
+
/// A type like `&'a T` is WF only if `T: 'a`.
ReferenceOutlivesReferent(Ty<'tcx>),
pub struct FulfillmentError<'tcx> {
pub obligation: PredicateObligation<'tcx>,
- pub code: FulfillmentErrorCode<'tcx>
+ pub code: FulfillmentErrorCode<'tcx>,
+ /// Diagnostics only: we opportunistically change the `code.span` when we encounter an
+ /// obligation error caused by a call argument. When this is the case, we also signal that in
+ /// this field to ensure accuracy of suggestions.
+ pub points_at_arg_span: bool,
}
#[derive(Clone)]
}
/// Creates predicate obligations from the generic bounds.
-pub fn predicates_for_generics<'tcx>(cause: ObligationCause<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
- generic_bounds: &ty::InstantiatedPredicates<'tcx>)
- -> PredicateObligations<'tcx>
-{
+pub fn predicates_for_generics<'tcx>(
+ cause: ObligationCause<'tcx>,
+ param_env: ty::ParamEnv<'tcx>,
+ generic_bounds: &ty::InstantiatedPredicates<'tcx>,
+) -> PredicateObligations<'tcx> {
util::predicates_for_generics(cause, 0, param_env, generic_bounds)
}
code: FulfillmentErrorCode<'tcx>)
-> FulfillmentError<'tcx>
{
- FulfillmentError { obligation: obligation, code: code }
+ FulfillmentError { obligation: obligation, code: code, points_at_arg_span: false }
}
}