]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_arena/src/lib.rs
Merge commit '7c21f91b15b7604f818565646b686d90f99d1baf' into clippyup
[rust.git] / compiler / rustc_arena / src / lib.rs
index de1d5c07f5028ce387ab5ac0c9ab32c5b170e6e0..62995dfd2e2f0b96f731dee1ff9f06c060f779f5 100644 (file)
@@ -217,6 +217,8 @@ pub fn alloc(&self, object: T) -> &mut T {
 
     #[inline]
     fn can_allocate(&self, additional: usize) -> bool {
+        // FIXME: this should *likely* use `offset_from`, but more
+        // investigation is needed (including running tests in miri).
         let available_bytes = self.end.get().addr() - self.ptr.get().addr();
         let additional_bytes = additional.checked_mul(mem::size_of::<T>()).unwrap();
         available_bytes >= additional_bytes
@@ -263,6 +265,8 @@ fn grow(&self, additional: usize) {
                 // If a type is `!needs_drop`, we don't need to keep track of how many elements
                 // the chunk stores - the field will be ignored anyway.
                 if mem::needs_drop::<T>() {
+                    // FIXME: this should *likely* use `offset_from`, but more
+                    // investigation is needed (including running tests in miri).
                     let used_bytes = self.ptr.get().addr() - last_chunk.start().addr();
                     last_chunk.entries = used_bytes / mem::size_of::<T>();
                 }
@@ -300,6 +304,8 @@ fn clear_last_chunk(&self, last_chunk: &mut ArenaChunk<T>) {
             // Recall that `end` was incremented for each allocated value.
             end - start
         } else {
+            // FIXME: this should *likely* use `offset_from`, but more
+            // investigation is needed (including running tests in miri).
             (end - start) / mem::size_of::<T>()
         };
         // Pass that to the `destroy` method.