File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -184,15 +184,11 @@ pub(crate) fn codegen_const_value<'tcx>(
184184 . offset_i64 ( fx, i64:: try_from ( offset. bytes ( ) ) . unwrap ( ) ) ,
185185 layout,
186186 ) ,
187- ConstValue :: Slice { data, start , end } => {
187+ ConstValue :: Slice { data, meta } => {
188188 let alloc_id = fx. tcx . reserve_and_set_memory_alloc ( data) ;
189- let ptr = pointer_for_allocation ( fx, alloc_id)
190- . offset_i64 ( fx, i64:: try_from ( start) . unwrap ( ) )
191- . get_addr ( fx) ;
192- let len = fx
193- . bcx
194- . ins ( )
195- . iconst ( fx. pointer_type , i64:: try_from ( end. checked_sub ( start) . unwrap ( ) ) . unwrap ( ) ) ;
189+ let ptr = pointer_for_allocation ( fx, alloc_id) . get_addr ( fx) ;
190+ // FIXME: the `try_from` here can actually fail, e.g. for very long ZST slices.
191+ let len = fx. bcx . ins ( ) . iconst ( fx. pointer_type , i64:: try_from ( meta) . unwrap ( ) ) ;
196192 CValue :: by_val_pair ( ptr, len, layout)
197193 }
198194 }
You can’t perform that action at this time.
0 commit comments