@@ -304,12 +304,12 @@ pub fn predicates_for_generics<'tcx>(tcx: &ty::ctxt<'tcx>,
304
304
/// `bound` or is not known to meet bound (note that this is
305
305
/// conservative towards *no impl*, which is the opposite of the
306
306
/// `evaluate` methods).
307
- pub fn evaluate_builtin_bound < ' a , ' tcx > ( infcx : & InferCtxt < ' a , ' tcx > ,
308
- typer : & ty:: ClosureTyper < ' tcx > ,
309
- ty : Ty < ' tcx > ,
310
- bound : ty:: BuiltinBound ,
311
- span : Span )
312
- -> SelectionResult < ' tcx , ( ) >
307
+ pub fn type_known_to_meet_builtin_bound < ' a , ' tcx > ( infcx : & InferCtxt < ' a , ' tcx > ,
308
+ typer : & ty:: ClosureTyper < ' tcx > ,
309
+ ty : Ty < ' tcx > ,
310
+ bound : ty:: BuiltinBound ,
311
+ span : Span )
312
+ -> bool
313
313
{
314
314
debug ! ( "type_known_to_meet_builtin_bound(ty={}, bound={:?})" ,
315
315
ty. repr( infcx. tcx) ,
@@ -327,61 +327,18 @@ pub fn evaluate_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
327
327
// Note: we only assume something is `Copy` if we can
328
328
// *definitively* show that it implements `Copy`. Otherwise,
329
329
// assume it is move; linear is always ok.
330
- let result = match fulfill_cx. select_all_or_error ( infcx, typer) {
331
- Ok ( ( ) ) => Ok ( Some ( ( ) ) ) , // Success, we know it implements Copy.
332
- Err ( errors) => {
333
- // If there were any hard errors, propagate an arbitrary
334
- // one of those. If no hard errors at all, report
335
- // ambiguity.
336
- let sel_error =
337
- errors. iter ( )
338
- . filter_map ( |err| {
339
- match err. code {
340
- CodeAmbiguity => None ,
341
- CodeSelectionError ( ref e) => Some ( e. clone ( ) ) ,
342
- CodeProjectionError ( _) => {
343
- infcx. tcx . sess . span_bug (
344
- span,
345
- "projection error while selecting?" )
346
- }
347
- }
348
- } )
349
- . next ( ) ;
350
- match sel_error {
351
- None => { Ok ( None ) }
352
- Some ( e) => { Err ( e) }
353
- }
354
- }
355
- } ;
356
-
357
- debug ! ( "type_known_to_meet_builtin_bound: ty={} bound={:?} result={:?}" ,
358
- ty. repr( infcx. tcx) ,
359
- bound,
360
- result) ;
361
-
362
- result
363
- }
364
-
365
- pub fn type_known_to_meet_builtin_bound < ' a , ' tcx > ( infcx : & InferCtxt < ' a , ' tcx > ,
366
- typer : & ty:: ClosureTyper < ' tcx > ,
367
- ty : Ty < ' tcx > ,
368
- bound : ty:: BuiltinBound ,
369
- span : Span )
370
- -> bool
371
- {
372
- match evaluate_builtin_bound ( infcx, typer, ty, bound, span) {
373
- Ok ( Some ( ( ) ) ) => {
374
- // definitely impl'd
330
+ match fulfill_cx. select_all_or_error ( infcx, typer) {
331
+ Ok ( ( ) ) => {
332
+ debug ! ( "type_known_to_meet_builtin_bound: ty={} bound={:?} success" ,
333
+ ty. repr( infcx. tcx) ,
334
+ bound) ;
375
335
true
376
336
}
377
- Ok ( None ) => {
378
- // ambiguous: if coherence check was successful, shouldn't
379
- // happen, but we might have reported an error and been
380
- // soldering on, so just treat this like not implemented
381
- false
382
- }
383
- Err ( _) => {
384
- // errors: not implemented.
337
+ Err ( e) => {
338
+ debug ! ( "type_known_to_meet_builtin_bound: ty={} bound={:?} errors={}" ,
339
+ ty. repr( infcx. tcx) ,
340
+ bound,
341
+ e. repr( infcx. tcx) ) ;
385
342
false
386
343
}
387
344
}
0 commit comments