@@ -114,7 +114,7 @@ pub enum MethodMatchedData {
114
114
* candidate is one that might match or might not, depending on how
115
115
* type variables wind up being resolved. This only occurs during inference.
116
116
*
117
- * For selection to suceed , there must be exactly one non-ambiguous
117
+ * For selection to succeed , there must be exactly one non-ambiguous
118
118
* candidate. Usually, it is not possible to have more than one
119
119
* definitive candidate, due to the coherence rules. However, there is
120
120
* one case where it could occur: if there is a blanket impl for a
@@ -1202,24 +1202,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1202
1202
candidates : & mut CandidateSet < ' tcx > )
1203
1203
-> Result < ( ) , SelectionError < ' tcx > >
1204
1204
{
1205
- // FIXME -- To be more like a normal impl, we should just
1206
- // ignore the nested cases here, and instead generate nested
1207
- // obligations in `confirm_candidate`. However, this doesn't
1208
- // work because we require handling the recursive cases to
1209
- // avoid infinite cycles (that is, with recursive types,
1210
- // sometimes `Foo : Copy` only holds if `Foo : Copy`).
1211
-
1212
1205
match self . builtin_bound ( bound, stack. obligation . self_ty ( ) ) {
1213
- Ok ( If ( nested) ) => {
1214
- debug ! ( "builtin_bound: bound={} nested={}" ,
1215
- bound. repr( self . tcx( ) ) ,
1216
- nested. repr( self . tcx( ) ) ) ;
1217
- let data = self . vtable_builtin_data ( stack. obligation , bound, nested) ;
1218
- match self . winnow_selection ( Some ( stack) , VtableBuiltin ( data) ) {
1219
- EvaluatedToOk => { Ok ( candidates. vec . push ( BuiltinCandidate ( bound) ) ) }
1220
- EvaluatedToAmbig => { Ok ( candidates. ambiguous = true ) }
1221
- EvaluatedToErr => { Err ( Unimplemented ) }
1222
- }
1206
+ Ok ( If ( _) ) => {
1207
+ debug ! ( "builtin_bound: bound={}" ,
1208
+ bound. repr( self . tcx( ) ) ) ;
1209
+ candidates. vec . push ( BuiltinCandidate ( bound) ) ;
1210
+ Ok ( ( ) )
1223
1211
}
1224
1212
Ok ( ParameterBuiltin ) => { Ok ( ( ) ) }
1225
1213
Ok ( AmbiguousBuiltin ) => { Ok ( candidates. ambiguous = true ) }
@@ -1575,8 +1563,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1575
1563
candidate. repr( self . tcx( ) ) ) ;
1576
1564
1577
1565
match candidate {
1578
- // FIXME -- see assemble_builtin_bound_candidates()
1579
- BuiltinCandidate ( _) |
1566
+ BuiltinCandidate ( builtin_bound) => {
1567
+ Ok ( VtableBuiltin (
1568
+ try!( self . confirm_builtin_candidate ( obligation, builtin_bound) ) ) )
1569
+ }
1570
+
1580
1571
ErrorCandidate => {
1581
1572
Ok ( VtableBuiltin ( VtableBuiltinData { nested : VecPerParamSpace :: empty ( ) } ) )
1582
1573
}
@@ -1626,8 +1617,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1626
1617
1627
1618
match try!( self . builtin_bound ( bound, obligation. self_ty ( ) ) ) {
1628
1619
If ( nested) => Ok ( self . vtable_builtin_data ( obligation, bound, nested) ) ,
1629
- AmbiguousBuiltin |
1630
- ParameterBuiltin => {
1620
+ AmbiguousBuiltin | ParameterBuiltin => {
1631
1621
self . tcx ( ) . sess . span_bug (
1632
1622
obligation. cause . span ,
1633
1623
format ! ( "builtin bound for {} was ambig" ,
0 commit comments