about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-02-21 13:25:28 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2021-02-21 13:25:28 +0100
commit393878b15bbdf553e678dac3a7dd288bd6af879e (patch)
tree905b24628b7f1b67dab0d769c60efebfb2fad294
parent85bd00fd85bd2e00b97ca45f58d7686e44f554e8 (diff)
downloadrust-393878b15bbdf553e678dac3a7dd288bd6af879e.tar.gz
rust-393878b15bbdf553e678dac3a7dd288bd6af879e.zip
remove redundant return value Ok(()) of clear_relocations()
-rw-r--r--compiler/rustc_middle/src/mir/interpret/allocation.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs
index 5ebe38b2d7e..449b3a82dcb 100644
--- a/compiler/rustc_middle/src/mir/interpret/allocation.rs
+++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs
@@ -266,7 +266,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
         let range = self.check_bounds(ptr.offset, size);
 
         self.mark_init(ptr, size, true);
-        self.clear_relocations(cx, ptr, size)?;
+        self.clear_relocations(cx, ptr, size);
 
         AllocationExtra::memory_written(self, ptr, size)?;
 
@@ -484,18 +484,13 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
     /// uninitialized. This is a somewhat odd "spooky action at a distance",
     /// but it allows strictly more code to run than if we would just error
     /// immediately in that case.
-    fn clear_relocations(
-        &mut self,
-        cx: &impl HasDataLayout,
-        ptr: Pointer<Tag>,
-        size: Size,
-    ) -> InterpResult<'tcx> {
+    fn clear_relocations(&mut self, cx: &impl HasDataLayout, ptr: Pointer<Tag>, size: Size) {
         // Find the start and end of the given range and its outermost relocations.
         let (first, last) = {
             // Find all relocations overlapping the given range.
             let relocations = self.get_relocations(cx, ptr, size);
             if relocations.is_empty() {
-                return Ok(());
+                return;
             }
 
             (
@@ -517,8 +512,6 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
 
         // Forget all the relocations.
         self.relocations.remove_range(first..last);
-
-        Ok(())
     }
 
     /// Errors if there are relocations overlapping with the edges of the