@@ -210,8 +210,6 @@ enum SelectionCandidate<'tcx> {
210210 BuiltinObjectCandidate ,
211211
212212 BuiltinUnsizeCandidate ,
213-
214- ErrorCandidate ,
215213}
216214
217215struct SelectionCandidateSet < ' tcx > {
@@ -753,8 +751,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
753751 stack : & TraitObligationStack < ' o , ' tcx > )
754752 -> SelectionResult < ' tcx , SelectionCandidate < ' tcx > >
755753 {
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 ) ;
758763 }
759764
760765 if !self . is_knowable ( stack) {
@@ -1587,7 +1592,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15871592 true
15881593 } ,
15891594 & ParamCandidate ( ..) => false ,
1590- & ErrorCandidate => false // propagate errors
15911595 } ,
15921596 _ => false
15931597 }
@@ -1998,10 +2002,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19982002 try!( self . confirm_builtin_candidate ( obligation, builtin_bound) ) ) )
19992003 }
20002004
2001- ErrorCandidate => {
2002- Ok ( VtableBuiltin ( VtableBuiltinData { nested : vec ! [ ] } ) )
2003- }
2004-
20052005 ParamCandidate ( param) => {
20062006 let obligations = self . confirm_param_candidate ( obligation, param) ;
20072007 Ok ( VtableParam ( obligations) )
0 commit comments