<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/library/alloc/tests, branch 1.77.2</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.77.2</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.77.2'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2024-01-26T13:43:30+00:00</updated>
<entry>
<title>Rollup merge of #119917 - Zalathar:split-off, r=cuviper</title>
<updated>2024-01-26T13:43:30+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>matthias.krueger@famsik.de</email>
</author>
<published>2024-01-26T13:43:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=772e80a650fc22c2b0e419698833960cc558d896'/>
<id>urn:sha1:772e80a650fc22c2b0e419698833960cc558d896</id>
<content type='text'>
Remove special-case handling of `vec.split_off(0)`

#76682 added special handling to `Vec::split_off` for the case where `at == 0`. Instead of copying the vector's contents into a freshly-allocated vector and returning it, the special-case code steals the old vector's allocation, and replaces it with a new (empty) buffer with the same capacity.

That eliminates the need to copy the existing elements, but comes at a surprising cost, as seen in #119913. The returned vector's capacity is no longer determined by the size of its contents (as would be expected for a freshly-allocated vector), and instead uses the full capacity of the old vector.

In cases where the capacity is large but the size is small, that results in a much larger capacity than would be expected from reading the documentation of `split_off`. This is especially bad when `split_off` is called in a loop (to recycle a buffer), and the returned vectors have a wide variety of lengths.

I believe it's better to remove the special-case code, and treat `at == 0` just like any other value:
- The current documentation states that `split_off` returns a “newly allocated vector”, which is not actually true in the current implementation when `at == 0`.
- If the value of `at` could be non-zero at runtime, then the caller has already agreed to the cost of a full memcpy of the taken elements in the general case. Avoiding that copy would be nice if it were close to free, but the different handling of capacity means that it is not.
- If the caller specifically wants to avoid copying in the case where `at == 0`, they can easily implement that behaviour themselves using `mem::replace`.

Fixes #119913.
</content>
</entry>
<entry>
<title>Remove special-case handling of `vec.split_off(0)`</title>
<updated>2024-01-13T06:21:54+00:00</updated>
<author>
<name>Zalathar</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2024-01-13T06:12:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a655558b380bf689f806e45fc896b7e6ba739cb7'/>
<id>urn:sha1:a655558b380bf689f806e45fc896b7e6ba739cb7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>apply fmt</title>
<updated>2024-01-11T12:04:48+00:00</updated>
<author>
<name>klensy</name>
<email>klensy@users.noreply.github.com</email>
</author>
<published>2024-01-11T12:04:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=aa696c5a228a2c9730227eb5a0e99fb9d85eb61d'/>
<id>urn:sha1:aa696c5a228a2c9730227eb5a0e99fb9d85eb61d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Adjust library tests for unused_tuple_struct_fields -&gt; dead_code</title>
<updated>2024-01-02T20:34:37+00:00</updated>
<author>
<name>Jake Goulding</name>
<email>jake.goulding@gmail.com</email>
</author>
<published>2023-12-27T23:03:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5772818dc8f4c5a0fec1f5b35b33e85764dcd4f4'/>
<id>urn:sha1:5772818dc8f4c5a0fec1f5b35b33e85764dcd4f4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Auto merge of #117758 - Urgau:lint_pointer_trait_comparisons, r=davidtwco</title>
<updated>2023-12-11T14:33:16+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2023-12-11T14:33:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8a3765582cb83733f8c344062729df0175409488'/>
<id>urn:sha1:8a3765582cb83733f8c344062729df0175409488</id>
<content type='text'>
Add lint against ambiguous wide pointer comparisons

This PR is the resolution of https://github.com/rust-lang/rust/issues/106447 decided in https://github.com/rust-lang/rust/issues/117717 by T-lang.

## `ambiguous_wide_pointer_comparisons`

*warn-by-default*

The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands.

### Example

```rust
let ab = (A, B);
let a = &amp;ab.0 as *const dyn T;
let b = &amp;ab.1 as *const dyn T;

let _ = a == b;
```

### Explanation

The comparison includes metadata which may not be expected.

-------

This PR also drops `clippy::vtable_address_comparisons` which is superseded by this one.

~~One thing: is the current naming right? `invalid` seems a bit too much.~~

Fixes https://github.com/rust-lang/rust/issues/117717
</content>
</entry>
<entry>
<title>remove redundant imports</title>
<updated>2023-12-10T02:56:22+00:00</updated>
<author>
<name>surechen</name>
<email>chenshuo17@huawei.com</email>
</author>
<published>2023-11-10T02:11:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=40ae34194c586eea3614d3216322053d2e8e7b37'/>
<id>urn:sha1:40ae34194c586eea3614d3216322053d2e8e7b37</id>
<content type='text'>
detects redundant imports that can be eliminated.

for #117772 :

In order to facilitate review and modification, split the checking code and
removing redundant imports code into two PR.
</content>
</entry>
<entry>
<title>Auto merge of #118460 - the8472:fix-vec-realloc, r=saethlin</title>
<updated>2023-12-06T08:45:11+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2023-12-06T08:45:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=15bb3e204ad5fbaf53b2b26e47247f3cbbba63f1'/>
<id>urn:sha1:15bb3e204ad5fbaf53b2b26e47247f3cbbba63f1</id>
<content type='text'>
Fix in-place collect not reallocating when necessary

Regression introduced in https://github.com/rust-lang/rust/pull/110353.
This was [caught by miri](https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Cron.20Job.20Failure.20.28miri-test-libstd.2C.202023-11.29/near/404764617)

r? `@saethlin`
</content>
</entry>
<entry>
<title>Adjust tests for newly added ambiguous_wide_pointer_comparisons lint</title>
<updated>2023-12-06T08:03:48+00:00</updated>
<author>
<name>Urgau</name>
<email>urgau@numericable.fr</email>
</author>
<published>2023-11-09T17:13:52+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5e1bfb538f195eeac02034c0779f42d34b0e869e'/>
<id>urn:sha1:5e1bfb538f195eeac02034c0779f42d34b0e869e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #118123 - RalfJung:internal-lib-features, r=compiler-errors</title>
<updated>2023-12-05T19:52:41+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2023-12-05T19:52:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=19bf7495605962df2b0bfa96382a4f717f63b0c3'/>
<id>urn:sha1:19bf7495605962df2b0bfa96382a4f717f63b0c3</id>
<content type='text'>
Add support for making lib features internal

We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.

This extends that idea to lib features as well. It is an alternative to https://github.com/rust-lang/rust/pull/115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in `_internals` or `_internal` is considered internal.

Then we rename `core_intrinsics` to `core_intrinsics_internal`, which fixes https://github.com/rust-lang/rust/issues/115597.
</content>
</entry>
<entry>
<title>Fix in-place collect not reallocating when necessary</title>
<updated>2023-12-05T19:09:22+00:00</updated>
<author>
<name>The 8472</name>
<email>git@infinite-source.de</email>
</author>
<published>2023-11-29T21:24:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=13a843ebcbe536257a8442bf5c26b227d1c2f7c9'/>
<id>urn:sha1:13a843ebcbe536257a8442bf5c26b227d1c2f7c9</id>
<content type='text'>
</content>
</entry>
</feed>
