@@ -1095,17 +1095,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10951095 }
10961096
10971097 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 ) )
11091100 }
11101101
11111102 fn pick_all_method (
@@ -1244,54 +1235,11 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
12441235 } )
12451236 }
12461237
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-
12861238 fn pick_method (
12871239 & self ,
12881240 self_ty : Ty < ' tcx > ,
12891241 mut unstable_candidates : Option < & mut Vec < ( Candidate < ' tcx > , Symbol ) > > ,
12901242 ) -> 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-
12951243 debug ! ( "pick_method(self_ty={})" , self . ty_to_string( self_ty) ) ;
12961244
12971245 let mut possibly_unsatisfied_predicates = Vec :: new ( ) ;
0 commit comments