@@ -918,11 +918,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
918
918
) ) ;
919
919
}
920
920
921
- if self . is_box_free ( func) {
922
- self . check_box_free_inputs ( mir, term, & sig, args, term_location) ;
923
- } else {
924
- self . check_call_inputs ( mir, term, & sig, args, term_location) ;
925
- }
921
+ self . check_call_inputs ( mir, term, & sig, args, term_location) ;
926
922
}
927
923
TerminatorKind :: Assert {
928
924
ref cond, ref msg, ..
@@ -1026,70 +1022,6 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
1026
1022
}
1027
1023
}
1028
1024
1029
- fn is_box_free ( & self , operand : & Operand < ' tcx > ) -> bool {
1030
- match * operand {
1031
- Operand :: Constant ( ref c) => match c. ty . sty {
1032
- ty:: TyFnDef ( ty_def_id, _) => {
1033
- Some ( ty_def_id) == self . tcx ( ) . lang_items ( ) . box_free_fn ( )
1034
- }
1035
- _ => false ,
1036
- } ,
1037
- _ => false ,
1038
- }
1039
- }
1040
-
1041
- fn check_box_free_inputs (
1042
- & mut self ,
1043
- mir : & Mir < ' tcx > ,
1044
- term : & Terminator < ' tcx > ,
1045
- sig : & ty:: FnSig < ' tcx > ,
1046
- args : & [ Operand < ' tcx > ] ,
1047
- term_location : Location ,
1048
- ) {
1049
- debug ! ( "check_box_free_inputs" ) ;
1050
-
1051
- // box_free takes a Box as a pointer. Allow for that.
1052
-
1053
- if sig. inputs ( ) . len ( ) != 1 {
1054
- span_mirbug ! ( self , term, "box_free should take 1 argument" ) ;
1055
- return ;
1056
- }
1057
-
1058
- let pointee_ty = match sig. inputs ( ) [ 0 ] . sty {
1059
- ty:: TyRawPtr ( mt) => mt. ty ,
1060
- _ => {
1061
- span_mirbug ! ( self , term, "box_free should take a raw ptr" ) ;
1062
- return ;
1063
- }
1064
- } ;
1065
-
1066
- if args. len ( ) != 1 {
1067
- span_mirbug ! ( self , term, "box_free called with wrong # of args" ) ;
1068
- return ;
1069
- }
1070
-
1071
- let ty = args[ 0 ] . ty ( mir, self . tcx ( ) ) ;
1072
- let arg_ty = match ty. sty {
1073
- ty:: TyRawPtr ( mt) => mt. ty ,
1074
- ty:: TyAdt ( def, _) if def. is_box ( ) => ty. boxed_ty ( ) ,
1075
- _ => {
1076
- span_mirbug ! ( self , term, "box_free called with bad arg ty" ) ;
1077
- return ;
1078
- }
1079
- } ;
1080
-
1081
- if let Err ( terr) = self . sub_types ( arg_ty, pointee_ty, term_location. at_self ( ) ) {
1082
- span_mirbug ! (
1083
- self ,
1084
- term,
1085
- "bad box_free arg ({:?} <- {:?}): {:?}" ,
1086
- pointee_ty,
1087
- arg_ty,
1088
- terr
1089
- ) ;
1090
- }
1091
- }
1092
-
1093
1025
fn check_iscleanup ( & mut self , mir : & Mir < ' tcx > , block_data : & BasicBlockData < ' tcx > ) {
1094
1026
let is_cleanup = block_data. is_cleanup ;
1095
1027
self . last_span = block_data. terminator ( ) . source_info . span ;
0 commit comments