File tree 3 files changed +16
-14
lines changed
3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -1056,16 +1056,16 @@ impl<'a, 'tcx> FnType<'tcx> {
1056
1056
_ => { }
1057
1057
}
1058
1058
if let layout:: Abi :: Scalar ( ref scalar) = self . ret . layout . abi {
1059
- if let Some ( range) = scalar . range_metadata ( bx . cx ) {
1060
- // If the value is a boolean, the range is 0..2 and that ultimately
1061
- // become 0..0 when the type becomes i1, which would be rejected
1062
- // by the LLVM verifier.
1063
- match scalar. value {
1064
- layout :: Int ( .. ) if ! scalar. is_bool ( ) => {
1059
+ // If the value is a boolean, the range is 0..2 and that ultimately
1060
+ // become 0..0 when the type becomes i1, which would be rejected
1061
+ // by the LLVM verifier.
1062
+ match scalar . value {
1063
+ layout :: Int ( .. ) if ! scalar. is_bool ( ) => {
1064
+ if let Some ( range ) = scalar. range_metadata ( bx . cx ) {
1065
1065
bx. range_metadata ( callsite, range) ;
1066
1066
}
1067
- _ => { }
1068
1067
}
1068
+ _ => { }
1069
1069
}
1070
1070
}
1071
1071
for arg in & self . args {
Original file line number Diff line number Diff line change 25
25
#![ allow( unused_attributes) ]
26
26
#![ feature( libc) ]
27
27
#![ feature( quote) ]
28
+ #![ feature( range_contains) ]
28
29
#![ feature( rustc_diagnostic_macros) ]
29
30
#![ feature( slice_sort_by_cached_key) ]
30
31
#![ feature( optin_builtin_traits) ]
Original file line number Diff line number Diff line change @@ -91,16 +91,17 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
91
91
}
92
92
93
93
let scalar_load_metadata = |load, scalar : & layout:: Scalar | {
94
- if let Some ( range ) = scalar. range_metadata ( bx . cx ) {
95
- match scalar . value {
96
- layout :: Int ( .. ) => {
94
+ match scalar. value {
95
+ layout :: Int ( .. ) => {
96
+ if let Some ( range ) = scalar . range_metadata ( bx . cx ) {
97
97
bx. range_metadata ( load, range) ;
98
98
}
99
- layout:: Pointer if 0 < range. start && range. start < range. end => {
100
- bx. nonnull_metadata ( load) ;
101
- }
102
- _ => { }
103
99
}
100
+ layout:: Pointer
101
+ if ( 1 ..scalar. valid_range . end ) . contains ( & scalar. valid_range . start ) => {
102
+ bx. nonnull_metadata ( load) ;
103
+ }
104
+ _ => { }
104
105
}
105
106
} ;
106
107
You can’t perform that action at this time.
0 commit comments