Lines Matching full:safety

154 // SAFETY: `Vec` is `Send` if `T` is `Send` because `Vec` owns its elements.
162 // SAFETY: `Vec` is `Sync` if `T` is `Sync` because `Vec` owns its elements.
197 /// # Safety
205 // INVARIANT: By the safety requirements of this method this represents the exact number of in inc_len()
215 /// # Safety
224 // SAFETY: The memory after `self.len()` is guaranteed to contain `count` initialized in dec_len()
301 // SAFETY: in spare_capacity_mut()
307 // SAFETY: The memory between `self.len` and `self.capacity` is guaranteed to be allocated in spare_capacity_mut()
327 // SAFETY: The call to `reserve` was successful, so the capacity is at least one greater in push()
350 // SAFETY: The length is less than the capacity. in push_within_capacity()
360 /// # Safety
366 // SAFETY: By the safety requirements, `spare` is non-empty. in push_within_capacity_unchecked()
369 // SAFETY: We just initialised the first spare entry, so it is safe to increase the length in push_within_capacity_unchecked()
409 // SAFETY: This is in bounds since `index <= len < capacity`. in insert_within_capacity()
413 // SAFETY: Both the src and dst ranges end no later than one element after the length. in insert_within_capacity()
417 // SAFETY: The pointer is in-bounds of the allocation. in insert_within_capacity()
419 // SAFETY: Index `len` contains a valid element due to the above copy and write. in insert_within_capacity()
445 // SAFETY: We just checked that the length is at least one. in pop()
447 // SAFETY: The argument to `dec_len` was 1 so this returns a slice of length 1. in pop()
451 // SAFETY: The guarantees of `dec_len` allow us to take ownership of this value. in pop()
470 // SAFETY: The value at index `i` is valid, because otherwise we would have already in remove()
475 // SAFETY: We checked that `i` is in-bounds. in remove()
480 // SAFETY: `p.add(1).add(self.len - i - 1)` is `i+1+len-i-1 == len` elements after the in remove()
484 // SAFETY: Since the check at the beginning of this call did not fail with `RemoveError`, in remove()
519 /// // SAFETY: We've just reserved memory for another element.
523 /// // SAFETY: We only wrote an additional element at the end of the `KVec`'s buffer and
533 /// # Safety
554 // SAFETY: By the safety requirements of this function, `capacity * size_of::<T>()` is in from_raw_parts()
560 // covered by the safety requirements of this function. in from_raw_parts()
562 // SAFETY: By the safety requirements, `ptr` is either dangling or pointing to a valid in from_raw_parts()
640 // SAFETY: in reserve()
680 // SAFETY: `count` is `self.len() - len` so it is guaranteed to be less than or in truncate()
684 // SAFETY: the contract of `dec_len` guarantees that the elements in `ptr` are in truncate()
705 // SAFETY: This does not underflow the length. in drain_all()
756 // SAFETY: in extend_with()
785 // SAFETY: in extend_from_slice()
836 // SAFETY: `self.as_mut_ptr` is guaranteed to be valid by the type invariant. in drop()
844 // SAFETY: in drop()
859 // SAFETY:
890 // SAFETY: The memory behind `self.as_ptr()` is guaranteed to contain `self.len` in deref()
902 // SAFETY: The memory behind `self.as_ptr()` is guaranteed to contain `self.len` in deref_mut()
1049 /// // SAFETY: There is no concurrent read or write to the same page.
1063 // SAFETY: in page_iter()
1148 // SAFETY: in collect()
1157 // SAFETY: `len` is guaranteed to be smaller than `self.layout.len()` by the type in collect()
1161 // SAFETY: `buf` points to the start of the backing buffer and `len` is guaranteed by in collect()
1183 // SAFETY: If the iterator has been advanced, the advanced elements have been copied to in collect()
1220 // SAFETY: We can't overflow; decreasing `self.len` by one every time we advance `self.ptr` in next()
1226 // SAFETY: `current` is guaranteed to point at a valid element within the buffer. in next()
1258 // SAFETY: `self.ptr` is guaranteed to be valid by the type invariant. in drop()
1261 // SAFETY: in drop()
1334 // SAFETY: By the type invariants, we may take ownership of this value. in next()
1348 // SAFETY: By the type invariants, we own these values so we may destroy them. in drop()