about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-12-21 06:46:33 +0000
committerGitHub <noreply@github.com>2024-12-21 06:46:33 +0000
commit58ad698df7f560f240b83382c6452ae1ef4db9ab (patch)
tree48fb0b4298aabe500c0b7caf13a636a60fa3bcfd
parent7b29dafacf72a2de8fbc06686635247a004ee1aa (diff)
parent9c87ec824225d92dde12f713857613fc1c42c29c (diff)
downloadrust-58ad698df7f560f240b83382c6452ae1ef4db9ab.tar.gz
rust-58ad698df7f560f240b83382c6452ae1ef4db9ab.zip
Merge pull request #4103 from RalfJung/remove-unused
remove an unused helper method
-rw-r--r--src/tools/miri/src/helpers.rs17
-rw-r--r--src/tools/miri/src/shims/native_lib.rs2
2 files changed, 5 insertions, 14 deletions
diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs
index bd4a773e23e..690cb7a5b33 100644
--- a/src/tools/miri/src/helpers.rs
+++ b/src/tools/miri/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<P: Projectable<'tcx, Provenance>>(
-        &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/tools/miri/src/shims/native_lib.rs b/src/tools/miri/src/shims/native_lib.rs
index 345ca3fbcc1..92cca88bc96 100644
--- a/src/tools/miri/src/shims/native_lib.rs
+++ b/src/tools/miri/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<bool> = const { RefCell::new(false) };
                 }