Skip to content

Commit

Permalink
Rename Size to Offset in minimize where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
essickmango committed Nov 1, 2023
1 parent 9231ec6 commit 6d18b41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tooling/minimize/src/chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::*;
/// Calculates the Chunks for a union type.
/// This works roughly as described here:
/// https://github.com/rust-lang/unsafe-code-guidelines/issues/354#issuecomment-1297545313
pub fn calc_chunks(fields: Fields, size: Size) -> List<(Size, Size)> {
pub fn calc_chunks(fields: Fields, size: Size) -> List<(Offset, Size)> {
let s = size.bytes().try_to_usize().unwrap();
let mut markers = vec![false; s];
for (offset, ty) in fields {
Expand All @@ -24,7 +24,7 @@ pub fn calc_chunks(fields: Fields, size: Size) -> List<(Size, Size)> {
current_chunk_start = Some(i);
}
(false, Some(s)) => {
let start = Size::from_bytes(*s).unwrap();
let start = Offset::from_bytes(*s).unwrap();
let length = Size::from_bytes(i - *s).unwrap();
chunks.push((start, length));
current_chunk_start = None;
Expand Down
2 changes: 1 addition & 1 deletion tooling/minimize/src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn translate_const_uneval<'cx, 'tcx>(
.eval_to_allocation_raw(rs::ParamEnv::empty().and(cid))
.unwrap();
let name = translate_alloc_id(alloc.alloc_id, fcx);
let offset = Size::ZERO;
let offset = Offset::ZERO;

let rel = Relocation { name, offset };
relocation_to_value_expr(rel, ty, fcx)
Expand Down

0 comments on commit 6d18b41

Please sign in to comment.