@@ -113,7 +113,7 @@ pub enum MethodMatchedData {
113
113
/// candidate is one that might match or might not, depending on how
114
114
/// type variables wind up being resolved. This only occurs during inference.
115
115
///
116
- /// For selection to suceed , there must be exactly one non-ambiguous
116
+ /// For selection to succeed , there must be exactly one non-ambiguous
117
117
/// candidate. Usually, it is not possible to have more than one
118
118
/// definitive candidate, due to the coherence rules. However, there is
119
119
/// one case where it could occur: if there is a blanket impl for a
@@ -1149,24 +1149,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1149
1149
candidates : & mut CandidateSet < ' tcx > )
1150
1150
-> Result < ( ) , SelectionError < ' tcx > >
1151
1151
{
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
-
1159
1152
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 ( ( ) )
1170
1158
}
1171
1159
Ok ( ParameterBuiltin ) => { Ok ( ( ) ) }
1172
1160
Ok ( AmbiguousBuiltin ) => { Ok ( candidates. ambiguous = true ) }
@@ -1539,8 +1527,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1539
1527
candidate. repr( self . tcx( ) ) ) ;
1540
1528
1541
1529
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
+
1544
1535
ErrorCandidate => {
1545
1536
Ok ( VtableBuiltin ( VtableBuiltinData { nested : VecPerParamSpace :: empty ( ) } ) )
1546
1537
}
@@ -1590,8 +1581,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1590
1581
1591
1582
match try!( self . builtin_bound ( bound, obligation. self_ty ( ) ) ) {
1592
1583
If ( nested) => Ok ( self . vtable_builtin_data ( obligation, bound, nested) ) ,
1593
- AmbiguousBuiltin |
1594
- ParameterBuiltin => {
1584
+ AmbiguousBuiltin | ParameterBuiltin => {
1595
1585
self . tcx ( ) . sess . span_bug (
1596
1586
obligation. cause . span ,
1597
1587
format ! ( "builtin bound for {} was ambig" ,
0 commit comments