File tree Expand file tree Collapse file tree 1 file changed +14
-17
lines changed
src/librustc_mir/hair/pattern Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -1092,27 +1092,24 @@ pub fn compare_const_vals<'a, 'tcx>(
1092
1092
(
1093
1093
Some ( Value :: ScalarPair (
1094
1094
Scalar :: Ptr ( ptr_a) ,
1095
- Scalar :: Bits {
1096
- bits : size_a,
1097
- defined : defined_a,
1098
- } ,
1095
+ len_a,
1099
1096
) ) ,
1100
1097
Some ( Value :: ScalarPair (
1101
1098
Scalar :: Ptr ( ptr_b) ,
1102
- Scalar :: Bits {
1103
- bits : size_b,
1104
- defined : defined_b,
1105
- } ,
1099
+ len_b,
1106
1100
) )
1107
- ) if size_a == size_b &&
1108
- ptr_a. offset . bytes ( ) == 0 && ptr_b. offset . bytes ( ) == 0 &&
1109
- tcx. data_layout . pointer_size . bits ( ) <= defined_a. into ( ) &&
1110
- tcx. data_layout . pointer_size . bits ( ) <= defined_b. into ( ) => {
1111
- let map = tcx. alloc_map . lock ( ) ;
1112
- let alloc_a = map. unwrap_memory ( ptr_a. alloc_id ) ;
1113
- let alloc_b = map. unwrap_memory ( ptr_b. alloc_id ) ;
1114
- if alloc_a. bytes . len ( ) as u64 == size_a as u64 {
1115
- return from_bool ( alloc_a == alloc_b) ;
1101
+ ) if ptr_a. offset . bytes ( ) == 0 && ptr_b. offset . bytes ( ) == 0 => {
1102
+ if let Ok ( len_a) = len_a. to_bits ( tcx. data_layout . pointer_size ) {
1103
+ if let Ok ( len_b) = len_b. to_bits ( tcx. data_layout . pointer_size ) {
1104
+ if len_a == len_b {
1105
+ let map = tcx. alloc_map . lock ( ) ;
1106
+ let alloc_a = map. unwrap_memory ( ptr_a. alloc_id ) ;
1107
+ let alloc_b = map. unwrap_memory ( ptr_b. alloc_id ) ;
1108
+ if alloc_a. bytes . len ( ) as u128 == len_a {
1109
+ return from_bool ( alloc_a == alloc_b) ;
1110
+ }
1111
+ }
1112
+ }
1116
1113
}
1117
1114
}
1118
1115
_ => ( ) ,
You can’t perform that action at this time.
0 commit comments