@@ -1095,17 +1095,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
1095
1095
}
1096
1096
1097
1097
fn pick_core ( & self ) -> Option < PickResult < ' tcx > > {
1098
- let pick = self . pick_all_method ( Some ( & mut vec ! [ ] ) ) ;
1099
-
1100
- // In this case unstable picking is done by `pick_method`.
1101
- if !self . tcx . sess . opts . unstable_opts . pick_stable_methods_before_any_unstable {
1102
- return pick;
1103
- }
1104
-
1105
- if pick. is_none ( ) {
1106
- return self . pick_all_method ( None ) ;
1107
- }
1108
- pick
1098
+ // Pick stable methods only first, and consider unstable candidates if not found.
1099
+ self . pick_all_method ( Some ( & mut vec ! [ ] ) ) . or_else ( || self . pick_all_method ( None ) )
1109
1100
}
1110
1101
1111
1102
fn pick_all_method (
@@ -1244,54 +1235,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
1244
1235
} )
1245
1236
}
1246
1237
1247
- fn pick_method_with_unstable ( & self , self_ty : Ty < ' tcx > ) -> Option < PickResult < ' tcx > > {
1248
- debug ! ( "pick_method_with_unstable(self_ty={})" , self . ty_to_string( self_ty) ) ;
1249
-
1250
- let mut possibly_unsatisfied_predicates = Vec :: new ( ) ;
1251
-
1252
- for ( kind, candidates) in
1253
- & [ ( "inherent" , & self . inherent_candidates ) , ( "extension" , & self . extension_candidates ) ]
1254
- {
1255
- debug ! ( "searching {} candidates" , kind) ;
1256
- let res = self . consider_candidates (
1257
- self_ty,
1258
- candidates,
1259
- & mut possibly_unsatisfied_predicates,
1260
- Some ( & mut vec ! [ ] ) ,
1261
- ) ;
1262
- if res. is_some ( ) {
1263
- return res;
1264
- }
1265
- }
1266
-
1267
- for ( kind, candidates) in
1268
- & [ ( "inherent" , & self . inherent_candidates ) , ( "extension" , & self . extension_candidates ) ]
1269
- {
1270
- debug ! ( "searching unstable {kind} candidates" ) ;
1271
- let res = self . consider_candidates (
1272
- self_ty,
1273
- candidates,
1274
- & mut possibly_unsatisfied_predicates,
1275
- None ,
1276
- ) ;
1277
- if res. is_some ( ) {
1278
- return res;
1279
- }
1280
- }
1281
-
1282
- self . unsatisfied_predicates . borrow_mut ( ) . extend ( possibly_unsatisfied_predicates) ;
1283
- None
1284
- }
1285
-
1286
1238
fn pick_method (
1287
1239
& self ,
1288
1240
self_ty : Ty < ' tcx > ,
1289
1241
mut unstable_candidates : Option < & mut Vec < ( Candidate < ' tcx > , Symbol ) > > ,
1290
1242
) -> Option < PickResult < ' tcx > > {
1291
- if !self . tcx . sess . opts . unstable_opts . pick_stable_methods_before_any_unstable {
1292
- return self . pick_method_with_unstable ( self_ty) ;
1293
- }
1294
-
1295
1243
debug ! ( "pick_method(self_ty={})" , self . ty_to_string( self_ty) ) ;
1296
1244
1297
1245
let mut possibly_unsatisfied_predicates = Vec :: new ( ) ;
0 commit comments