@@ -230,8 +230,6 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
230
230
}
231
231
}
232
232
233
- self . check_item_predicates ( ) ;
234
-
235
233
for ( idx, local) in body. local_decls . iter_enumerated ( ) {
236
234
// Handle the return place below.
237
235
if idx == RETURN_PLACE || local. internal {
@@ -358,83 +356,11 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
358
356
359
357
match * ty. kind ( ) {
360
358
ty:: Ref ( _, _, hir:: Mutability :: Mut ) => self . check_op ( ops:: ty:: MutRef ( kind) ) ,
361
- ty:: Opaque ( ..) => self . check_op ( ops:: ty:: ImplTrait ) ,
362
- ty:: FnPtr ( ..) => self . check_op ( ops:: ty:: FnPtr ( kind) ) ,
363
-
364
- ty:: Dynamic ( preds, _) => {
365
- for pred in preds. iter ( ) {
366
- match pred. skip_binder ( ) {
367
- ty:: ExistentialPredicate :: AutoTrait ( _)
368
- | ty:: ExistentialPredicate :: Projection ( _) => {
369
- self . check_op ( ops:: ty:: DynTrait ( kind) )
370
- }
371
- ty:: ExistentialPredicate :: Trait ( trait_ref) => {
372
- if Some ( trait_ref. def_id ) != self . tcx . lang_items ( ) . sized_trait ( ) {
373
- self . check_op ( ops:: ty:: DynTrait ( kind) )
374
- }
375
- }
376
- }
377
- }
378
- }
379
359
_ => { }
380
360
}
381
361
}
382
362
}
383
363
384
- fn check_item_predicates ( & mut self ) {
385
- let ConstCx { tcx, .. } = * self . ccx ;
386
-
387
- let mut current = self . def_id ( ) . to_def_id ( ) ;
388
- loop {
389
- let predicates = tcx. predicates_of ( current) ;
390
- for ( predicate, _) in predicates. predicates {
391
- match predicate. kind ( ) . skip_binder ( ) {
392
- ty:: PredicateKind :: RegionOutlives ( _)
393
- | ty:: PredicateKind :: TypeOutlives ( _)
394
- | ty:: PredicateKind :: WellFormed ( _)
395
- | ty:: PredicateKind :: Projection ( _)
396
- | ty:: PredicateKind :: ConstEvaluatable ( ..)
397
- | ty:: PredicateKind :: ConstEquate ( ..)
398
- | ty:: PredicateKind :: TypeWellFormedFromEnv ( ..) => continue ,
399
- ty:: PredicateKind :: ObjectSafe ( _) => {
400
- bug ! ( "object safe predicate on function: {:#?}" , predicate)
401
- }
402
- ty:: PredicateKind :: ClosureKind ( ..) => {
403
- bug ! ( "closure kind predicate on function: {:#?}" , predicate)
404
- }
405
- ty:: PredicateKind :: Subtype ( _) | ty:: PredicateKind :: Coerce ( _) => {
406
- bug ! ( "subtype/coerce predicate on function: {:#?}" , predicate)
407
- }
408
- ty:: PredicateKind :: Trait ( pred) => {
409
- if Some ( pred. def_id ( ) ) == tcx. lang_items ( ) . sized_trait ( ) {
410
- continue ;
411
- }
412
- match pred. self_ty ( ) . kind ( ) {
413
- ty:: Param ( p) => {
414
- let generics = tcx. generics_of ( current) ;
415
- let def = generics. type_param ( p, tcx) ;
416
- let span = tcx. def_span ( def. def_id ) ;
417
-
418
- // These are part of the function signature, so treat them like
419
- // arguments when determining importance.
420
- let kind = LocalKind :: Arg ;
421
-
422
- self . check_op_spanned ( ops:: ty:: TraitBound ( kind) , span) ;
423
- }
424
- // other kinds of bounds are either tautologies
425
- // or cause errors in other passes
426
- _ => continue ,
427
- }
428
- }
429
- }
430
- }
431
- match predicates. parent {
432
- Some ( parent) => current = parent,
433
- None => break ,
434
- }
435
- }
436
- }
437
-
438
364
fn check_mut_borrow ( & mut self , local : Local , kind : hir:: BorrowKind ) {
439
365
match self . const_kind ( ) {
440
366
// In a const fn all borrows are transient or point to the places given via
@@ -613,7 +539,9 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
613
539
) ,
614
540
_,
615
541
_,
616
- ) => self . check_op ( ops:: FnPtrCast ) ,
542
+ ) => {
543
+ // Nothing to do here. Function pointer casts are allowed now.
544
+ }
617
545
618
546
Rvalue :: Cast ( CastKind :: Pointer ( PointerCast :: Unsize ) , _, _) => {
619
547
// Nothing to check here (`check_local_or_return_ty` ensures no trait objects occur
0 commit comments