@@ -113,7 +113,7 @@ pub enum MethodMatchedData {
113113/// candidate is one that might match or might not, depending on how
114114/// type variables wind up being resolved. This only occurs during inference.
115115///
116- /// For selection to suceed , there must be exactly one non-ambiguous
116+ /// For selection to succeed , there must be exactly one non-ambiguous
117117/// candidate. Usually, it is not possible to have more than one
118118/// definitive candidate, due to the coherence rules. However, there is
119119/// one case where it could occur: if there is a blanket impl for a
@@ -1149,24 +1149,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11491149 candidates : & mut CandidateSet < ' tcx > )
11501150 -> Result < ( ) , SelectionError < ' tcx > >
11511151 {
1152- // FIXME -- To be more like a normal impl, we should just
1153- // ignore the nested cases here, and instead generate nested
1154- // obligations in `confirm_candidate`. However, this doesn't
1155- // work because we require handling the recursive cases to
1156- // avoid infinite cycles (that is, with recursive types,
1157- // sometimes `Foo : Copy` only holds if `Foo : Copy`).
1158-
11591152 match self . builtin_bound ( bound, stack. obligation . self_ty ( ) ) {
1160- Ok ( If ( nested) ) => {
1161- debug ! ( "builtin_bound: bound={} nested={}" ,
1162- bound. repr( self . tcx( ) ) ,
1163- nested. repr( self . tcx( ) ) ) ;
1164- let data = self . vtable_builtin_data ( stack. obligation , bound, nested) ;
1165- match self . winnow_selection ( Some ( stack) , VtableBuiltin ( data) ) {
1166- EvaluatedToOk => { Ok ( candidates. vec . push ( BuiltinCandidate ( bound) ) ) }
1167- EvaluatedToAmbig => { Ok ( candidates. ambiguous = true ) }
1168- EvaluatedToErr => { Err ( Unimplemented ) }
1169- }
1153+ Ok ( If ( _) ) => {
1154+ debug ! ( "builtin_bound: bound={}" ,
1155+ bound. repr( self . tcx( ) ) ) ;
1156+ candidates. vec . push ( BuiltinCandidate ( bound) ) ;
1157+ Ok ( ( ) )
11701158 }
11711159 Ok ( ParameterBuiltin ) => { Ok ( ( ) ) }
11721160 Ok ( AmbiguousBuiltin ) => { Ok ( candidates. ambiguous = true ) }
@@ -1539,8 +1527,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15391527 candidate. repr( self . tcx( ) ) ) ;
15401528
15411529 match candidate {
1542- // FIXME -- see assemble_builtin_bound_candidates()
1543- BuiltinCandidate ( _) |
1530+ BuiltinCandidate ( builtin_bound) => {
1531+ Ok ( VtableBuiltin (
1532+ try!( self . confirm_builtin_candidate ( obligation, builtin_bound) ) ) )
1533+ }
1534+
15441535 ErrorCandidate => {
15451536 Ok ( VtableBuiltin ( VtableBuiltinData { nested : VecPerParamSpace :: empty ( ) } ) )
15461537 }
@@ -1590,8 +1581,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15901581
15911582 match try!( self . builtin_bound ( bound, obligation. self_ty ( ) ) ) {
15921583 If ( nested) => Ok ( self . vtable_builtin_data ( obligation, bound, nested) ) ,
1593- AmbiguousBuiltin |
1594- ParameterBuiltin => {
1584+ AmbiguousBuiltin | ParameterBuiltin => {
15951585 self . tcx ( ) . sess . span_bug (
15961586 obligation. cause . span ,
15971587 format ! ( "builtin bound for {} was ambig" ,
0 commit comments