Skip to content

Commit 3dd26b8

Browse files
committed
Simplify trait selector's evaluation API slightly
1 parent bc16b8e commit 3dd26b8

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

src/librustc/traits/coherence.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ fn overlap<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
154154
recursion_depth: 0,
155155
predicate: p })
156156
.chain(obligations)
157-
.find(|o| !selcx.evaluate_obligation(o));
158-
// FIXME: the call to `selcx.evaluate_obligation` above should be ported
157+
.find(|o| !selcx.predicate_may_hold_fatal(o));
158+
// FIXME: the call to `selcx.predicate_may_hold_fatal` above should be ported
159159
// to the canonical trait query form, `infcx.predicate_may_hold`, once
160160
// the new system supports intercrate mode (which coherence needs).
161161

src/librustc/traits/select.rs

+4-20
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
575575
// we can be sure it does not.
576576

577577
/// Evaluates whether the obligation `obligation` can be satisfied (by any means).
578-
pub fn evaluate_obligation(&mut self,
579-
obligation: &PredicateObligation<'tcx>)
580-
-> bool
578+
pub fn predicate_may_hold_fatal(&mut self,
579+
obligation: &PredicateObligation<'tcx>)
580+
-> bool
581581
{
582-
debug!("evaluate_obligation({:?})",
582+
debug!("predicate_may_hold_fatal({:?})",
583583
obligation);
584584

585585
match self.evaluate_obligation_recursively(obligation) {
@@ -588,22 +588,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
588588
}
589589
}
590590

591-
/// Evaluates whether the obligation `obligation` can be satisfied,
592-
/// and returns `false` if not certain. However, this is not entirely
593-
/// accurate if inference variables are involved.
594-
pub fn evaluate_obligation_conservatively(&mut self,
595-
obligation: &PredicateObligation<'tcx>)
596-
-> bool
597-
{
598-
debug!("evaluate_obligation_conservatively({:?})",
599-
obligation);
600-
601-
match self.evaluate_obligation_recursively(obligation) {
602-
Ok(result) => result == EvaluatedToOk,
603-
Err(OverflowError(o)) => self.infcx().report_overflow_error(&o, true)
604-
}
605-
}
606-
607591
/// Evaluates whether the obligation `obligation` can be satisfied and returns
608592
/// an `EvaluationResult`.
609593
pub fn evaluate_obligation_recursively(&mut self,

0 commit comments

Comments
 (0)