From 7cdc6ea415b23b5394404aaac1558c582fa83cdb Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 21 Dec 2024 07:21:58 +0100 Subject: [PATCH] remove an unused helper method --- src/helpers.rs | 17 ++++------------- src/shims/native_lib.rs | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/helpers.rs b/src/helpers.rs index bd4a773e23..690cb7a5b3 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -332,19 +332,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { base: &P, name: &str, ) -> InterpResult<'tcx, P> { - if let Some(field) = self.try_project_field_named(base, name)? { - return interp_ok(field); - } - bug!("No field named {} in type {}", name, base.layout().ty); - } - - /// Search if `base` (which must be a struct or union type) contains the `name` field. - fn projectable_has_field>( - &self, - base: &P, - name: &str, - ) -> bool { - self.try_project_field_named(base, name).unwrap().is_some() + interp_ok( + self.try_project_field_named(base, name)? + .unwrap_or_else(|| bug!("no field named {} in type {}", name, base.layout().ty)), + ) } /// Write an int of the appropriate size to `dest`. The target type may be signed or unsigned, diff --git a/src/shims/native_lib.rs b/src/shims/native_lib.rs index 345ca3fbcc..92cca88bc9 100644 --- a/src/shims/native_lib.rs +++ b/src/shims/native_lib.rs @@ -173,7 +173,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Wildcard pointer, whatever it points to must be already exposed. continue; }; - // The first time this happens at a particular location, print a warning. + // The first time this happens, print a warning. thread_local! { static HAVE_WARNED: RefCell = const { RefCell::new(false) }; }