Skip to content

Commit 6e21222

Browse files
RalfJungoli-obk
andauthored
assert rather than panic
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
1 parent e989ec5 commit 6e21222

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ pub(super) fn op_to_const<'tcx>(
169169
let (alloc_id, offset) = a.to_pointer(ecx).expect(msg).into_parts();
170170
let alloc_id = alloc_id.expect(msg);
171171
let data = ecx.tcx.global_alloc(alloc_id).unwrap_memory();
172-
if offset.bytes() != 0 {
173-
panic!("{}", msg);
174-
}
172+
assert!(offset == Size::ZERO, "{}", msg);
175173
let meta = b.to_target_usize(ecx).expect(msg);
176174
ConstValue::Slice { data, meta }
177175
}

0 commit comments

Comments
 (0)