Skip to content

Commit 508df22

Browse files
committed
Group libc helper functions
1 parent 2cbf4af commit 508df22

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/helpers.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
308308
self.eval_libc(name)?.to_i32()
309309
}
310310

311+
/// Helper function to get the `TyLayout` of a `libc` type
312+
fn libc_ty_layout(&mut self, name: &str) -> InterpResult<'tcx, TyLayout<'tcx>> {
313+
let this = self.eval_context_mut();
314+
let tcx = &{ this.tcx.tcx };
315+
let ty = this.resolve_path(&["libc", name])?.ty(*tcx);
316+
this.layout_of(ty)
317+
}
318+
311319
// Writes several `ImmTy`s contiguosly into memory. This is useful when you have to pack
312-
// different values into an struct.
320+
// different values into a struct.
313321
fn write_immediates(
314322
&mut self,
315323
ptr: &Pointer<Tag>,
@@ -335,11 +343,4 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
335343

336344
Ok(())
337345
}
338-
339-
fn libc_ty_layout(&mut self, name: &str) -> InterpResult<'tcx, TyLayout<'tcx>> {
340-
let this = self.eval_context_mut();
341-
let tcx = &{ this.tcx.tcx };
342-
let ty = this.resolve_path(&["libc", name])?.ty(*tcx);
343-
this.layout_of(ty)
344-
}
345346
}

0 commit comments

Comments
 (0)