File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -932,15 +932,13 @@ impl<'ctx> Module<'ctx> {
932
932
let c_string = to_c_str ( key) ;
933
933
let count = self . get_global_metadata_size ( key) as usize ;
934
934
935
- let mut raw_vec : Vec < LLVMValueRef > = Vec :: with_capacity ( count) ;
936
- let ptr = raw_vec . as_mut_ptr ( ) ;
935
+ let mut vec : Vec < LLVMValueRef > = Vec :: with_capacity ( count) ;
936
+ let ptr = vec . as_mut_ptr ( ) ;
937
937
938
- forget ( raw_vec) ;
939
-
940
- let vec = unsafe {
938
+ unsafe {
941
939
LLVMGetNamedMetadataOperands ( self . module . get ( ) , c_string. as_ptr ( ) , ptr) ;
942
940
943
- Vec :: from_raw_parts ( ptr , count, count )
941
+ vec . set_len ( count) ;
944
942
} ;
945
943
946
944
vec. iter ( ) . map ( |val| MetadataValue :: new ( * val) ) . collect ( )
Original file line number Diff line number Diff line change @@ -110,15 +110,13 @@ impl<'ctx> MetadataValue<'ctx> {
110
110
}
111
111
112
112
let count = self . get_node_size ( ) as usize ;
113
- let mut raw_vec : Vec < LLVMValueRef > = Vec :: with_capacity ( count) ;
114
- let ptr = raw_vec . as_mut_ptr ( ) ;
113
+ let mut vec : Vec < LLVMValueRef > = Vec :: with_capacity ( count) ;
114
+ let ptr = vec . as_mut_ptr ( ) ;
115
115
116
- forget ( raw_vec) ;
117
-
118
- let vec = unsafe {
116
+ unsafe {
119
117
LLVMGetMDNodeOperands ( self . as_value_ref ( ) , ptr) ;
120
118
121
- Vec :: from_raw_parts ( ptr , count , count)
119
+ vec . set_len ( count)
122
120
} ;
123
121
124
122
vec. iter ( )
You can’t perform that action at this time.
0 commit comments