<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/library/alloc/src/raw_vec, branch perf-tmp</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=perf-tmp</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=perf-tmp'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-09-25T18:52:03+00:00</updated>
<entry>
<title>Remove most `#[track_caller]` from allocating Vec methods</title>
<updated>2025-09-25T18:52:03+00:00</updated>
<author>
<name>Noratrieb</name>
<email>48135649+Noratrieb@users.noreply.github.com</email>
</author>
<published>2025-09-25T18:36:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9316d4508c42d5e6d91480aec34f66462801ee5d'/>
<id>urn:sha1:9316d4508c42d5e6d91480aec34f66462801ee5d</id>
<content type='text'>
They cause significant binary size overhead while contributing little
value.

Also removes them from the wrapping String methods that do not panic.
</content>
</entry>
<entry>
<title>Rollup merge of #145067 - btj:patch-3, r=tgross35</title>
<updated>2025-09-25T10:31:51+00:00</updated>
<author>
<name>Stuart Cook</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-09-25T10:31:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=2acd80cfa928c1371d2c60149b3febe66c9e6637'/>
<id>urn:sha1:2acd80cfa928c1371d2c60149b3febe66c9e6637</id>
<content type='text'>
RawVecInner: add missing `unsafe` to unsafe fns

Some (module-private) functions in `library/alloc/src/raw_vec/mod.rs` are unsafe (i.e. may cause UB when called from safe code) but are not marked `unsafe`. Specifically:
- `RawVecInner::grow_exact` causes UB if called with `len` and `additional` arguments such that `len + additional` is less than the current capacity. Indeed, in that case it calls [Allocator::grow](https://doc.rust-lang.org/std/alloc/trait.Allocator.html#method.grow) with a `new_layout` that is smaller than `old_layout`, which violates a safety precondition.
- The RawVecInner methods for resizing the buffer cause UB if called with an `elem_layout` different from the one used to initially allocate the buffer, because in that case `Allocator::grow` or `Allocator::shrink` are called with an `old_layout` that does not *fit* the allocated block, which violates a safety precondition.
- `RawVecInner::current_memory` might cause UB if called with an `elem_layout` different from the one used to initially allocate the buffer, because the `unchecked_mul` might overflow.
- Furthermore, these methods cause UB if called with an `elem_layout` where the size is not a multiple of the alignment. This is because `Layout::repeat` is used (in `layout_array`) to compute the allocation's layout when allocating, which includes padding to ensure alignment of array elements, but simple multiplication is used (in `current_memory`) to compute the old allocation's layout when resizing or deallocating, which would cause the layout used to resize or deallocate to not *fit* the allocated block, which violates a safety precondition.

I discovered these issues while performing formal verification of `library/alloc/src/raw_vec/mod.rs` per [Challenge 19](https://model-checking.github.io/verify-rust-std/challenges/0019-rawvec.html) of the [AWS Rust Standard Library Verification Contest](https://aws.amazon.com/blogs/opensource/verify-the-safety-of-the-rust-standard-library/).
</content>
</entry>
<entry>
<title>Change the cfg to a dash</title>
<updated>2025-09-21T17:12:20+00:00</updated>
<author>
<name>Ben Kimock</name>
<email>kimockb@gmail.com</email>
</author>
<published>2025-09-18T14:48:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=df58fd8cf7710f7516c541769a141f0235978dab'/>
<id>urn:sha1:df58fd8cf7710f7516c541769a141f0235978dab</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Add panic=immediate-abort</title>
<updated>2025-09-21T17:12:18+00:00</updated>
<author>
<name>Ben Kimock</name>
<email>kimockb@gmail.com</email>
</author>
<published>2025-09-07T16:31:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=888679013d1f424adef06267f3630069b4cabd40'/>
<id>urn:sha1:888679013d1f424adef06267f3630069b4cabd40</id>
<content type='text'>
</content>
</entry>
<entry>
<title>RawVecInner: add missing `unsafe` to unsafe fns</title>
<updated>2025-09-05T08:21:21+00:00</updated>
<author>
<name>Bart Jacobs</name>
<email>bart.jacobs@cs.kuleuven.be</email>
</author>
<published>2025-08-07T19:27:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=96f385b20aa252629570cadeca16a9e159e6810c'/>
<id>urn:sha1:96f385b20aa252629570cadeca16a9e159e6810c</id>
<content type='text'>
- RawVecInner::grow_exact causes UB if called with len and additional
  arguments such that len + additional is less than the current
  capacity.  Indeed, in that case it calls Allocator::grow with a
  new_layout that is smaller than old_layout, which violates a safety
  precondition.

- All RawVecInner methods for resizing the buffer cause UB
  if called with an elem_layout different from the one used to initially
  allocate the buffer, because in that case Allocator::grow/shrink is called with
  an old_layout that does not fit the allocated block, which violates a
  safety precondition.

- RawVecInner::current_memory might cause UB if called with an elem_layout
  different from the one used to initially allocate the buffer, because
  the unchecked_mul might overflow.

- Furthermore, these methods cause UB if called with an elem_layout
  where the size is not a multiple of the alignment. This is because
  Layout::repeat is used (in layout_array) to compute the allocation's
  layout when allocating, which includes padding to ensure alignment of
  array elements, but simple multiplication is used (in current_memory) to
  compute the old allocation's layout when resizing or deallocating, which
  would cause the layout used to resize or deallocate to not fit the
  allocated block, which violates a safety precondition.
</content>
</entry>
<entry>
<title>Rollup merge of #145750 - btj:drop-alloc-guard, r=tgross35</title>
<updated>2025-09-04T00:01:53+00:00</updated>
<author>
<name>Stuart Cook</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-09-04T00:01:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d71a9b6bcf9aae816291c560432b728f7d7f3494'/>
<id>urn:sha1:d71a9b6bcf9aae816291c560432b728f7d7f3494</id>
<content type='text'>
raw_vec.rs: Remove superfluous fn alloc_guard

`alloc_guard` checks that its argument is at most `isize::MAX`, but it is called only with layout sizes, which are already guaranteed to be at most `isize::MAX`.
</content>
</entry>
<entry>
<title>raw_vec.rs: Remove superfluous fn alloc_guard</title>
<updated>2025-09-03T05:34:32+00:00</updated>
<author>
<name>Bart Jacobs</name>
<email>bart.jacobs@cs.kuleuven.be</email>
</author>
<published>2025-08-22T13:28:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d9dc20c7529d93ba4e1f91c9e44fb882c07aa1c0'/>
<id>urn:sha1:d9dc20c7529d93ba4e1f91c9e44fb882c07aa1c0</id>
<content type='text'>
It checks that its argument is at most isize::MAX, but it is called
only with layout sizes, which are already guaranteed to be at most
isize::MAX.
</content>
</entry>
<entry>
<title>Fix typo in comment</title>
<updated>2025-08-26T20:58:44+00:00</updated>
<author>
<name>Tobias Stoeckmann</name>
<email>tobias@stoeckmann.org</email>
</author>
<published>2025-08-26T20:44:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=45296bb633bc7fdd0c692a8be3035393ec3c9314'/>
<id>urn:sha1:45296bb633bc7fdd0c692a8be3035393ec3c9314</id>
<content type='text'>
Turn "any heap allocators" into "any heap allocator".
</content>
</entry>
<entry>
<title>Rename `tests/codegen` into `tests/codegen-llvm`</title>
<updated>2025-07-22T12:28:48+00:00</updated>
<author>
<name>Guillaume Gomez</name>
<email>guillaume1.gomez@gmail.com</email>
</author>
<published>2025-07-21T12:34:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a27f3e3fd1e4d16160f8885b6b06665b5319f56c'/>
<id>urn:sha1:a27f3e3fd1e4d16160f8885b6b06665b5319f56c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Simplify `Vec::as_non_null` implementation and make it `const`</title>
<updated>2025-05-05T19:56:33+00:00</updated>
<author>
<name>Vilim Lendvaj</name>
<email>vilim.lendvaj@sk.t-com.hr</email>
</author>
<published>2025-05-05T19:38:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=53459ffa8c0b9060f111b4730d1fe58a110470d9'/>
<id>urn:sha1:53459ffa8c0b9060f111b4730d1fe58a110470d9</id>
<content type='text'>
</content>
</entry>
</feed>
