@@ -210,8 +210,6 @@ enum SelectionCandidate<'tcx> {
210
210
BuiltinObjectCandidate ,
211
211
212
212
BuiltinUnsizeCandidate ,
213
-
214
- ErrorCandidate ,
215
213
}
216
214
217
215
struct SelectionCandidateSet < ' tcx > {
@@ -753,8 +751,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
753
751
stack : & TraitObligationStack < ' o , ' tcx > )
754
752
-> SelectionResult < ' tcx , SelectionCandidate < ' tcx > >
755
753
{
756
- if stack. obligation . predicate . 0 . self_ty ( ) . references_error ( ) {
757
- return Ok ( Some ( ErrorCandidate ) ) ;
754
+ if stack. obligation . predicate . references_error ( ) {
755
+ // If we encounter a `TyError`, we generally prefer the
756
+ // most "optimistic" result in response -- that is, the
757
+ // one least likely to report downstream errors. But
758
+ // because this routine is shared by coherence and by
759
+ // trait selection, there isn't an obvious "right" choice
760
+ // here in that respect, so we opt to just return
761
+ // ambiguity and let the upstream clients sort it out.
762
+ return Ok ( None ) ;
758
763
}
759
764
760
765
if !self . is_knowable ( stack) {
@@ -1587,7 +1592,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1587
1592
true
1588
1593
} ,
1589
1594
& ParamCandidate ( ..) => false ,
1590
- & ErrorCandidate => false // propagate errors
1591
1595
} ,
1592
1596
_ => false
1593
1597
}
@@ -1998,10 +2002,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1998
2002
try!( self . confirm_builtin_candidate ( obligation, builtin_bound) ) ) )
1999
2003
}
2000
2004
2001
- ErrorCandidate => {
2002
- Ok ( VtableBuiltin ( VtableBuiltinData { nested : vec ! [ ] } ) )
2003
- }
2004
-
2005
2005
ParamCandidate ( param) => {
2006
2006
let obligations = self . confirm_param_candidate ( obligation, param) ;
2007
2007
Ok ( VtableParam ( obligations) )
0 commit comments