Jonathan Brouwer
ae776574e6
Rollup merge of #163230 - maxdexh:zero-sized-allocations-are-not-real-and-cannot-hurt-you, r=clarfonthey
...
Document zero-sized allocations properly for `Box` and `Vec`
Fixes rust-lang/rust#162799
2026-10-14 19:29:22 +02:00
June Pyle
07c2c7c0bd
Annotate std types with rustc_assert_variance: phantom variance marker types, cell types, sync lock and guard types, Arc, Rc, Unique, Box, and NonNull
2026-10-12 08:17:45 -07:00
Jacob Pratt
2aad7af967
Rollup merge of #164146 - maxdexh:nuke-unique, r=hanna-kruppe
...
Nuke `Unique` (and `ptr_internals`)
2026-10-11 21:13:41 -04:00
Jacob Pratt
0f547a9061
Rollup merge of #162931 - ywxt:btree_map_drop, r=Amanieu
...
directly deallocates the nodes instead of traversing every element when BTreemap dropping
When BTreeMap is dropping, it currently turns the tree into an iterator and traverses the kvs, updating the LazyLeafRange after each element is dropped. This is unnecessary during destruction. We can instead traverse the tree node by node and drop the kvs directly from each node.
Results on aarch64:
- btree::map
benchmark | baseline | without drop | change | with drop | change | pp diff (with − without)
-- | -- | -- | -- | -- | -- | --
clone_fat_val_100 | 10849.14 | 7433.38 | -31.5% | 7573.66 | -30.2% | +1.3pp
clone_fat_val_100_and_clear | 11021.05 | 7606.91 | -31.0% | 7769.49 | -29.5% | +1.5pp
clone_fat_val_100_and_drain_all | 57652.20 | 55026.07 | -4.6% | 55495.20 | -3.7% | +0.8pp
clone_fat_val_100_and_drain_half | 27258.25 | 23993.80 | -12.0% | 24005.43 | -11.9% | +0.0pp
clone_fat_val_100_and_into_iter | 15149.81 | 12289.52 | -18.9% | 12401.29 | -18.1% | +0.7pp
clone_fat_val_100_and_pop_all | 56717.62 | 54045.12 | -4.7% | 54643.59 | -3.7% | +1.1pp
clone_fat_val_100_and_remove_all | 64333.00 | 61907.57 | -3.8% | 62039.79 | -3.6% | +0.2pp
clone_fat_val_100_and_remove_half | 28440.43 | 25290.79 | -11.1% | 25634.00 | -9.9% | +1.2pp
clone_slim_100 | 1978.26 | 687.38 | -65.3% | 798.38 | -59.6% | +5.6pp
clone_slim_100_and_clear | 1908.35 | 687.58 | -64.0% | 796.25 | -58.3% | +5.7pp
clone_slim_100_and_drain_all | 3983.43 | 4244.24 | +6.5% | 4123.55 | +3.5% | -3.0pp
clone_slim_100_and_drain_half | 4241.43 | 3551.33 | -16.3% | 3624.14 | -14.6% | +1.7pp
clone_slim_100_and_into_iter | 1805.39 | 1753.37 | -2.9% | 1840.42 | +1.9% | +4.8pp
clone_slim_100_and_pop_all | 3243.54 | 3247.17 | +0.1% | 3321.00 | +2.4% | +2.3pp
clone_slim_100_and_remove_all | 5203.97 | 5176.58 | -0.5% | 5282.19 | +1.5% | +2.0pp
clone_slim_100_and_remove_half | 2399.04 | 1818.85 | -24.2% | 1929.16 | -19.6% | +4.6pp
clone_slim_10k | 205051.50 | 74942.50 | -63.5% | 83515.00 | -59.3% | +4.2pp
clone_slim_10k_and_clear | 197575.50 | 74994.75 | -62.0% | 82934.71 | -58.0% | +4.0pp
clone_slim_10k_and_drain_all | 425268.00 | 424679.50 | -0.1% | 432531.75 | +1.7% | +1.8pp
clone_slim_10k_and_drain_half | 408679.00 | 358468.67 | -12.3% | 366904.50 | -10.2% | +2.1pp
clone_slim_10k_and_into_iter | 184573.50 | 180805.00 | -2.0% | 188245.25 | +2.0% | +4.0pp
clone_slim_10k_and_pop_all | 369476.00 | 370334.50 | +0.2% | 378684.50 | +2.5% | +2.3pp
clone_slim_10k_and_remove_all | 582219.44 | 581719.69 | -0.1% | 590480.50 | +1.4% | +1.5pp
clone_slim_10k_and_remove_half | 424686.50 | 373048.00 | -12.2% | 382718.00 | -9.9% | +2.3pp
from_iter_rand_100 | 1832.99 | 1086.70 | -40.7% | 1194.53 | -34.8% | +5.9pp
from_iter_rand_10_000 | 304447.00 | 231011.33 | -24.1% | 234360.00 | -23.0% | +1.1pp
from_iter_seq_100 | 2045.17 | 750.12 | -63.3% | 896.15 | -56.2% | +7.1pp
from_iter_seq_10_000 | 211268.33 | 80514.29 | -61.9% | 85877.83 | -59.4% | +2.5pp
- btree::set
benchmark | baseline | without drop | change | with drop | change | pp diff (with − without)
-- | -- | -- | -- | -- | -- | --
clone_100 | 1913.17 | 605.95 | -68.3% | 745.54 | -61.0% | +7.3pp
clone_100_and_clear | 1813.35 | 608.09 | -66.5% | 743.81 | -59.0% | +7.5pp
clone_100_and_drain_all | 3960.52 | 3965.28 | +0.1% | 4088.26 | +3.2% | +3.1pp
clone_100_and_drain_half | 4045.63 | 3408.90 | -15.7% | 3559.55 | -12.0% | +3.7pp
clone_100_and_into_iter | 1676.32 | 1600.11 | -4.5% | 1721.67 | +2.7% | +7.3pp
clone_100_and_pop_all | 2582.26 | 2562.19 | -0.8% | 2686.39 | +4.0% | +4.8pp
clone_100_and_remove_all | 4574.45 | 4520.84 | -1.2% | 4671.70 | +2.1% | +3.3pp
clone_100_and_remove_half | 2107.02 | 1533.22 | -27.2% | 1673.91 | -20.6% | +6.7pp
clone_10k | 192719.50 | 65933.38 | -65.8% | 75038.88 | -61.1% | +4.7pp
clone_10k_and_clear | 184669.60 | 66101.87 | -64.2% | 75375.25 | -59.2% | +5.0pp
clone_10k_and_drain_all | 418832.00 | 417920.00 | -0.2% | 424436.00 | +1.3% | +1.6pp
clone_10k_and_drain_half | 400446.00 | 348149.50 | -13.1% | 351997.00 | -12.1% | +1.0pp
clone_10k_and_into_iter | 170359.60 | 163481.80 | -4.0% | 165757.25 | -2.7% | +1.3pp
clone_10k_and_pop_all | 306021.67 | 307441.67 | +0.5% | 307585.00 | +0.5% | +0.0pp
clone_10k_and_remove_all | 510750.88 | 511582.56 | +0.2% | 512938.25 | +0.4% | +0.3pp
clone_10k_and_remove_half | 385672.00 | 337072.33 | -12.6% | 341705.50 | -11.4% | +1.2pp
r? @Amanieu
2026-10-11 21:13:39 -04:00
Jacob Pratt
b35d551fd6
Rollup merge of #162810 - ywxt:dedup, r=Amanieu
...
vectorized vec::dedup pre-scan
This PR vectorizes the process of pre-scaning during `Vec::dedup`.
on aarch64:
bench | baseline | final | | ±Δ
-- | -- | -- | -- | --
all_100 | 56 | 60 | 3 | +6.2%
all_1000 | 507 | 508 | 4 | +0.2%
all_10000 | 4,961 | 4,961 | 26 | +0.0%
all_100000 | 48,876 | 49,179 | 204 | +0.6%
none_100 | 49 | 17 | 1 | -65.5%
none_1000 | 495 | 129 | 2 | -74.0%
none_10000 | 4,873 | 1,226 | 7 | -74.8%
none_100000 | 48,673 | 12,549 | 97 | -74.2%
random_100 | 81 | 74 | 1 | -8.7%
random_1000 | 692 | 610 | 3 | -11.8%
random_10000 | 7,887 | 7,187 | 101 | -8.9%
random_100000 | 385,167 | 363,078 | 3,987 | -5.7%
slice_truncate_100 | 92 | 91 | 2 | -0.6%
slice_truncate_1000 | 712 | 710 | 3 | -0.2%
slice_truncate_10000 | 9,151 | 9,130 | 53 | -0.2%
slice_truncate_100000 | 398,559 | 388,269 | 1,127 | -2.6%
string_long_all_100 | 7,585 | 7,638 | 49 | +0.7%
string_long_all_1000 | 335,862 | 326,630 | 7,669 | -2.7%
string_long_all_10000 | 4,351,640 | 4,356,293 | 26,004 | +0.1%
string_long_none_100 | 2,954 | 2,912 | 34 | -1.4%
string_long_none_1000 | 30,945 | 29,910 | 512 | -3.3%
string_long_none_10000 | 310,118 | 304,530 | 2,447 | -1.8%
string_long_random_100 | 5,924 | 5,906 | 33 | -0.3%
string_long_random_1000 | 119,938 | 117,517 | 1,163 | -2.0%
string_long_random_10000 | 1,560,353 | 1,583,948 | 16,559 | +1.5%
string_medium_all_100 | 2,532 | 2,535 | 36 | +0.1%
string_medium_all_1000 | 26,413 | 26,436 | 233 | +0.1%
string_medium_all_10000 | 271,453 | 268,422 | 2,226 | -1.1%
string_medium_none_100 | 400 | 393 | 6 | -1.9%
string_medium_none_1000 | 4,074 | 3,918 | 34 | -3.8%
string_medium_none_10000 | 41,120 | 39,650 | 553 | -3.6%
string_medium_random_100 | 1,155 | 1,168 | 38 | +1.1%
string_medium_random_1000 | 27,462 | 27,281 | 133 | -0.7%
string_medium_random_10000 | 165,098 | 164,762 | 3,789 | -0.2%
string_short_all_100 | 2,353 | 2,372 | 38 | +0.8%
string_short_all_1000 | 23,455 | 23,766 | 233 | +1.3%
string_short_all_10000 | 235,946 | 236,944 | 3,684 | +0.4%
string_short_none_100 | 281 | 268 | 5 | -4.6%
string_short_none_1000 | 2,767 | 2,603 | 21 | -6.0%
string_short_none_10000 | 27,633 | 25,911 | 250 | -6.2%
string_short_random_100 | 1,072 | 1,079 | 15 | +0.6%
string_short_random_1000 | 24,270 | 24,180 | 59 | -0.4%
string_short_random_10000 | 100,799 | 98,519 | 594 | -2.3%
u8_all_1000 | 464 | 463 | 3 | -0.2%
u8_all_10000 | 4,479 | 4,477 | 38 | -0.0%
u8_none_1000 | 469 | 87 | 2 | -81.5%
u8_none_10000 | 4,611 | 811 | 7 | -82.4%
u8_random_1000 | 568 | 567 | 11 | -0.2%
u8_random_10000 | 4,583 | 4,578 | 36 | -0.1%
wide_all_1000 | 1,849 | 1,854 | 20 | +0.3%
wide_all_10000 | 18,499 | 18,446 | 176 | -0.3%
wide_none_1000 | 1,081 | 909 | 1 | -15.9%
wide_none_10000 | 10,395 | 9,289 | 122 | -10.6%
wide_random_1000 | 1,805 | 1,796 | 6 | -0.5%
wide_random_10000 | 17,994 | 17,984 | 82 | -0.1%
2026-10-11 21:13:38 -04:00
bors
0e75b0b0e6
Auto merge of #163521 - ywxt:btree_map_iter, r=Amanieu
...
fast path for BTreeMap::Iter::next
`BTreeMap::Iter` currently obtains the next kv through leaf navigation even when the next kv is in the same node. This PR adds fast paths for `BTreeMap::Iter` and `BTreeMap::Range`: when advancing does not cross a node boundary, the next edge and kv handle are constructed directly from their indexes.
Result on aarch64:
- map::iteration
benchmark | baseline ns/iter | new ns/iter | change
-- | -- | -- | --
map::iteration_20 | 362.74 ± 3.80 | 116.60 ± 1.46 | -67.9%
map::iteration_1000 | 18743.31 ± 166.97 | 7181.88 ± 91.56 | -61.7%
map::iteration_100000 | 2048028.00 ± 38646.50 | 893023.00 ± 6601.05 | -56.4%
map::iteration_rev_20 | 398.15 ± 6.02 | 111.56 ± 1.24 | -72.0%
map::iteration_rev_1000 | 19650.95 ± 120.38 | 6719.33 ± 33.38 | -65.8%
map::iteration_rev_100000 | 2045171.75 ± 88630.03 | 826631.00 ± 7210.95 | -59.6%
map::iteration_mut_20 | 332.97 ± 3.07 | 116.83 ± 9.19 | -64.9%
map::iteration_mut_1000 | 17282.91 ± 142.66 | 7105.18 ± 64.92 | -58.9%
map::iteration_mut_100000 | 1872307.50 ± 116359.10 | 930589.50 ± 11501.75 | -50.3%
map::iteration_mut_rev_20 | 314.35 ± 5.69 | 99.88 ± 4.46 | -68.2%
map::iteration_mut_rev_1000 | 16153.08 ± 77.67 | 6333.19 ± 9.81 | -60.8%
map::iteration_mut_rev_100000 | 1863366.00 ± 90111.10 | 832836.00 ± 13949.30 | -55.3%
- map::range_iteration
Benchmark | Baseline (ns/iter) | New (ns/iter) | Change
-- | -- | -- | --
map::range_iteration_20 | 380.62 ± 4.55 | 99.54 ± 1.49 | -73.8%
map::range_iteration_1000 | 18,545.75 ± 193.17 | 5,870.29 ± 66.97 | -68.3%
map::range_iteration_100000 | 1,886,226.50 ± 7,167.85 | 606,092.00 ± 5,516.90 | -67.9%
map::range_iteration_rev_20 | 354.25 ± 3.59 | 98.63 ± 4.56 | -72.2%
map::range_iteration_rev_1000 | 16,976.08 ± 186.23 | 5,604.28 ± 104.99 | -67.0%
map::range_iteration_rev_100000 | 1,717,588.50 ± 6,813.65 | 579,875.00 ± 6,914.20 | -66.2%
map::range_iteration_mut_20 | 336.01 ± 14.14 | 94.51 ± 2.88 | -71.9%
map::range_iteration_mut_1000 | 15,517.95 ± 218.64 | 5,095.03 ± 44.77 | -67.2%
map::range_iteration_mut_100000 | 1,604,837.00 ± 12,474.30 | 510,776.50 ± 1,607.21 | -68.2%
map::range_iteration_mut_rev_20 | 293.22 ± 4.60 | 86.87 ± 0.85 | -70.4%
map::range_iteration_mut_rev_1000 | 13,705.48 ± 126.54 | 5,035.34 ± 34.81 | -63.3%
map::range_iteration_mut_rev_100000 | 1,393,440.00 ± 5,983.90 | 517,439.50 ± 4,770.85 | -62.9%
- map::first_and_last
Benchmark | Baseline (ns/iter) | New (ns/iter) | Change
-- | -- | -- | --
map::first_and_last_0_nightly | 21.06 ± 0.44 | 21.05 ± 0.22 | -0.0%
map::first_and_last_0_stable | 42.63 ± 1.34 | 42.53 ± 0.94 | -0.2%
map::first_and_last_100_nightly | 47.77 ± 1.22 | 46.62 ± 0.60 | -2.4%
map::first_and_last_100_stable | 302.27 ± 1.00 | 126.24 ± 4.89 | -58.2%
map::first_and_last_10k_nightly | 73.27 ± 1.01 | 73.22 ± 0.92 | -0.1%
map::first_and_last_10k_stable | 368.89 ± 4.71 | 172.73 ± 2.44 | -53.2%
- set
Benchmark | Baseline (ns/iter) | New (ns/iter) | Change
-- | -- | -- | --
set::difference_random_100_vs_100 | 2,932.50 ± 5.08 | 1,377.14 ± 20.87 | -53.0%
set::difference_random_100_vs_10k | 2,864.22 ± 9.71 | 2,294.26 ± 6.83 | -19.9%
set::difference_random_10k_vs_100 | 193,483.00 ± 1,447.92 | 94,580.40 ± 1,345.45 | -51.1%
set::difference_random_10k_vs_10k | 296,728.67 ± 2,560.70 | 145,264.67 ± 1,775.17 | -51.0%
set::difference_staggered_100_vs_100 | 2,896.54 ± 10.72 | 1,477.26 ± 14.43 | -49.0%
set::difference_staggered_100_vs_10k | 3,443.02 ± 72.13 | 2,715.43 ± 25.13 | -21.1%
set::difference_staggered_10k_vs_10k | 293,658.33 ± 897.93 | 152,474.25 ± 2,005.09 | -48.1%
set::intersection_100_neg_vs_100_pos | 14.39 ± 0.04 | 14.12 ± 0.14 | -1.9%
set::intersection_100_neg_vs_10k_pos | 17.77 ± 0.06 | 17.63 ± 0.06 | -0.8%
set::intersection_100_pos_vs_100_neg | 14.44 ± 0.06 | 13.99 ± 0.14 | -3.1%
set::intersection_100_pos_vs_10k_neg | 17.72 ± 0.22 | 17.38 ± 0.03 | -1.9%
set::intersection_10k_neg_vs_100_pos | 17.21 ± 0.07 | 17.16 ± 0.21 | -0.3%
set::intersection_10k_neg_vs_10k_pos | 19.56 ± 0.11 | 19.38 ± 0.18 | -0.9%
set::intersection_10k_pos_vs_100_neg | 17.08 ± 0.07 | 16.94 ± 0.17 | -0.8%
set::intersection_10k_pos_vs_10k_neg | 19.42 ± 0.05 | 19.20 ± 0.22 | -1.1%
set::intersection_random_100_vs_100 | 2,765.31 ± 19.46 | 1,250.69 ± 7.81 | -54.8%
set::intersection_random_100_vs_10k | 3,149.91 ± 11.38 | 2,536.46 ± 43.26 | -19.5%
set::intersection_random_10k_vs_100 | 3,140.24 ± 40.56 | 2,549.25 ± 46.99 | -18.8%
set::intersection_random_10k_vs_10k | 280,063.67 ± 1,732.87 | 135,042.57 ± 1,463.94 | -51.8%
set::intersection_staggered_100_vs_100 | 2,911.66 ± 21.58 | 1,556.65 ± 19.25 | -46.5%
set::intersection_staggered_100_vs_10k | 3,082.33 ± 6.55 | 2,555.09 ± 18.25 | -17.1%
set::intersection_staggered_10k_vs_10k | 294,074.33 ± 2,705.90 | 164,741.10 ± 650.57 | -44.0%
set::is_subset_100_vs_100 | 2,804.09 ± 6.16 | 1,025.71 ± 9.23 | -63.4%
set::is_subset_100_vs_10k | 2,343.67 ± 21.98 | 1,832.94 ± 30.82 | -21.8%
set::is_subset_10k_vs_100 | 2.35 ± 0.01 | 2.46 ± 0.07 | +4.7%
set::is_subset_10k_vs_10k | 274,705.33 ± 381.00 | 102,497.67 ± 1,043.56 | -62.7%
2026-10-11 17:27:38 +00:00
Max Dexheimer
32fd83f5e2
Nuke Unique
2026-10-11 10:56:53 +02:00
Jonathan Brouwer
2d418e9411
Rollup merge of #162849 - maxdexh:nuke-unique-in-box, r=hanna-kruppe
...
Replace `Unique` in `Box` with a `(NonNull, PhantomData)` wrapper
Follow-up to rust-lang/rust#162804
See [zulip](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Can.20we.20nuke.20.60Unique.60.3F/with/624141418 ).
This is only the first step in actually refactoring `Box`, and is essentially just a rename.
The layout of `Box` stays as-is for now, due to rust-lang/rust#162850 .
Needs perf run
2026-10-10 20:38:35 +02:00
Max Dexheimer
5d260fd3da
Replace Unique in Box with a (NonNull, PhantomData) wrapper
2026-10-10 19:15:58 +02:00
bors
34f4a807e2
Auto merge of #164034 - maxdexh:global-alloc-dangling, r=clarfonthey
...
Don't rely on `Global` handing out dangling pointers
This code is incorrect and will leak memory once the global allocator supports zero-sized allocations, since `Box` doesn't deallocate zero-sized layouts
2026-10-10 06:48:47 +00:00
Max Dexheimer
604a21cab2
Document zero sized allocations in Box and Vec
2026-10-09 20:52:25 +02:00
Max Dexheimer
eece26e9a7
Don't rely on Global handing out dangling pointers
2026-10-09 15:20:15 +02:00
ywxt
cc65a07704
fast path for BTreeMap::Iter::next
2026-10-08 11:53:37 +08:00
ywxt
926a9d0873
directly drop the tree instead of traversing every element when BTreeMap dropping
2026-10-08 11:49:44 +08:00
Jonathan Brouwer
9301b02b09
Rollup merge of #157273 - veluca93:optimize-attribte, r=wesleywiser
...
Stabilize `optimize` attribute
This commit stabilizes the `#[optimize]` attribute, which allows for more fine-grained control of optimization levels.
# Stabilization report
## Summary
Tracking issue: rust-lang/rust#54882
Reference PRs: https://github.com/rust-lang/reference/pull/2278
cc @rust-lang/lang @rust-lang/lang-advisors @rust-lang/t-compiler
### What is stabilized
```rust
// Instructs the optimization pipeline to prioritize smaller code size over speed.
#[optimize(size)]
pub fn binary_size_sensitive() {
// ...
}
// Instructs the optimization pipeline to prioritize execution speed over code size.
#[optimize(speed)]
pub fn performance_critical() {
// ...
}
// Disables optimizations entirely for this item.
#[optimize(none)]
pub fn debug_only() {
// ...
}
```
### What isn't stabilized
We might want to allow specifying a per-function optimization level (i.e. `#[optimize(level = 3)]`). To my understanding, backend support for this is not quite there yet (and this - or other - extensions have consequently not been implemented yet).
Applying the attribute on a module level is also not implemented yet.
## Design
### Reference
- Description of the new attribute: https://github.com/rust-lang/reference/pull/2278
### RFC history
- https://rust-lang.github.io/rfcs/2412-optimize-attr.html
### Answers to unresolved question
- Should we also implement optimize(always)? optimize(level=x)?
Not yet.
- Should there be any way to specify what global optimization for speed level is used in conjunction with the optimization for speed option (e.g. -Copt-level=s3 could be equivalent to -Copt-level=3 and #[optimize(size)] on the crate item).
Not yet.
### Post-RFC changes
The `optimize(none)` variant was added. The variants above were discussed here: https://github.com/rust-lang/rust/issues/54882#issuecomment-4208014721
### Key points
- `#[optimize(none)]` implies `#[inline(never)]` to be effective (https://github.com/rust-lang/rust/issues/136329 )
- As with all optimization-controlling flags, the effects on speed and binary size can be hard to predict: https://github.com/rust-lang/rust/issues/54882#issuecomment-2789971186
- Applying the attribute to incompatible items emits an error: https://github.com/rust-lang/rust/pull/128458
### Nightly uses
The standard library itself uses this attribute in a few places
## Implementation
### Major part
- Wiring it up to the llvm codegen backend: c0bb140a37/compiler/rustc_codegen_llvm/src/attributes.rs (L416)
- Catching usage on incompatible items: https://github.com/rust-lang/rust/pull/128458
- Implementing `optimize(none)`: https://github.com/rust-lang/rust/pull/128657 https://github.com/rust-lang/rust/pull/136358 (includes disabling MIR opts)
### Coverage
- Basic tests: c0bb140a37/tests/ui/attributes/optimize.rs
- Testing the effect on compilation: c0bb140a37/tests/codegen-llvm/optimize-attr-1.rs
### Tool changes
Trivial changes to rust-analyzer to support the new attribute as an inert attribute: https://github.com/rust-lang/rust-analyzer/pull/22511
## Type system, opsem
### Breaks the AM?
As far as the AM is concerned, this attribute doesn't exist.
## Acknowledgments
Most of the work was not done by me, I'm just writing the stabilization report :-)
@nagisa did the initial implementation, @clubby789 implemented optimize(none) and fixed the attribute being allowed in too many places.
<!-- TRIAGEBOT_START -->
<!-- TRIAGEBOT_CONCERN-ISSUE_START -->
> [!NOTE]
> # Concerns (0 active)
>
> - ~~[are-we-happy-wiht-capability-and-scope-of-this-attribute](https://github.com/rust-lang/rust/pull/157273#issuecomment-4623050478 )~~ resolved in [this comment](https://github.com/rust-lang/rust/pull/157273#issuecomment-4677336542 )
> - ~~[meaning-of-optimize-size](https://github.com/rust-lang/rust/pull/157273#issuecomment-4623062899 )~~ resolved in [this comment](https://github.com/rust-lang/rust/pull/157273#issuecomment-4677336542 )
> - ~~[explicitly-decide-on-effect-on-nested-functions](https://github.com/rust-lang/rust/pull/157273#issuecomment-4630018199 )~~ resolved in [this comment](https://github.com/rust-lang/rust/pull/157273#issuecomment-4677336542 )
>
> *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/concern.html ) for details.*
<!-- TRIAGEBOT_CONCERN-ISSUE_END -->
<!-- TRIAGEBOT_END -->
2026-10-07 22:52:58 +02:00
Max Dexheimer
e834c0c6aa
Add some comments and docs related to AllocatorNightly
2026-10-05 17:52:27 +02:00
Jonathan Brouwer
d0aacc1bed
Rollup merge of #163752 - clarfonthey:revert-vecdeque-partialeq, r=clarfonthey
...
Revert "implement PartialEq<VecDeque<U>> for Vec<T>, &[T], &mut [T], [T; N], &[T; N] and &mut [T; N]"
This should go through FCP. This is a revert so we can do FCP on the actual PR.
r? joboet
2026-10-04 21:28:27 +02:00
Jonathan Brouwer
1afe4212de
Rollup merge of #163723 - estebank:remove-useless-into, r=chenyukang
...
[tiny] Remove useless `.into()` calls
2026-10-04 14:24:53 +02:00
ltdk
df0599ea90
Revert "implement PartialEq<VecDeque<U>> for Vec<T>, &[T], &mut [T], [T; N], &[T; N] and &mut [T; N]"
...
Revert "fix stability attributes for VecDeque PartialEq impls"
This reverts commit 9942d36bf6 .
Revert "update VecDeque PartialEq stability metadata"
This reverts commit 3d3f2f823f .
Revert "update assert-ne-no-invalid-help-issue-146204.stderr for VecDeque PartialEq output"
This reverts commit 8cdd010c4e .
Revert "resolve too_generic_eval_ice stderr conflict"
This reverts commit b50d79a556 .
Revert "alloc: make VecDeque partial equality symmetric with vec/slice/array"
This reverts commit 835975a12f .
2026-10-04 08:14:24 -04:00
Jacob Pratt
1459305684
Rollup merge of #163503 - jeffs:must-use-strong-count, r=Mark-Simulacrum
...
Mark Rc strong/weak count methods must_use
The corresponding Arc methods are already must_use. At a glance, missing them on Rc looks like an oversight.
2026-10-03 22:30:37 -04:00
Jacob Pratt
2f03ab20b1
Rollup merge of #163445 - yilin0518:fix_untidy, r=Mark-Simulacrum
...
Add safety comments for alloc::str
This PR replace `// ignore-tidy-undocumented-unsafe` with concrete safety comments. Every `// ignore-tidy-undocumented-unsafe` in `alloc::str` is checked. This PR only contains a file for ease of review.
Besides, this PR breaks an `unsafe block` into finer-grained scopes for ease of check.
2026-10-03 22:30:36 -04:00
Esteban Küber
59a24269b1
Remove useless .into() calls
2026-10-03 23:46:39 +00:00
Trevor Gross
e9b0eeb99d
intrinsics: Rename abort to abort_immediate
...
The semantics of `intrinsics::abort()` are closer to what we have
unstably as `abort_immediate()` than to `process::abort()` or
`libc::abort()`. Rename it to make more clear that the intrinsic is more
of an intentional crash with platform-specific behavior than what
`libc::abort()` tries to be (i.e. raising `SIGABRT`).
2026-10-02 18:56:41 +00:00
Jonathan Brouwer
d0fb4c33f4
Rollup merge of #163590 - maxdexh:allocator-nightly-sad, r=clarfonthey
...
Make `AllocatorNightly` less clever
r? nia-e
2026-10-01 17:22:55 +02:00
Jonathan Brouwer
6c02126e50
Rollup merge of #163483 - Mark-Simulacrum:bootstrap-bump, r=oli-obk
...
Bump bootstrap compiler to 1.100.0 beta
https://forge.rust-lang.org/release/process.html#default-branch-bootstrap-update-and-crater-tuesday
2026-10-01 17:22:39 +02:00
Max Dexheimer
3c0c34f3ac
Make AllocatorNightly less clever
2026-10-01 10:56:51 +02:00
Jacob Pratt
0c13396a6b
Rollup merge of #163489 - malezjaa:expose-rc-is_unique, r=clarfonthey
...
expose Rc::is_unique
Tracking issue: https://github.com/rust-lang/rust/issues/138938
This mostly mirrors the `Arc` counterpart.
r? @clarfonthey
2026-10-01 00:39:03 -04:00
Mark Rousskov
daa2432490
Re-bless tests / adjust for new Cargo lints
2026-09-30 21:00:04 +00:00
Mark Rousskov
4c11abbbd2
Step cfg(bootstrap)
2026-09-29 22:18:54 +00:00
Mark Rousskov
550132c363
run replace-version-placeholder
2026-09-29 22:18:53 +00:00
Jeff Schwab
583e737e94
Mark Rc strong/weak count methods must_use
2026-09-29 15:05:09 -04:00
malezjaa
588c189ee0
expose Rc::is_unique
2026-09-29 16:46:45 +02:00
bors
ea6bb45b74
Auto merge of #163479 - JonathanBrouwer:rollup-vXYZxKq, r=JonathanBrouwer
...
Rollup of 3 pull requests
Successful merges:
- rust-lang/rust#163401 (Clarify some things in the docs of `Global`)
- rust-lang/rust#163463 (Add safety comments for alloc::string)
- rust-lang/rust#163474 (Fix ICE when use tree appears in docs)
2026-09-29 10:54:31 +00:00
Jonathan Brouwer
919152dcef
Rollup merge of #163463 - yilin0518:fix_tidy_string, r=jhpratt
...
Add safety comments for alloc::string
This PR serves as a following PR with rust-lang/rust#163445 . This PR replace `// ignore-tidy-undocumented-unsafe` with concrete safety comments. Every `// ignore-tidy-undocumented-unsafe` in `alloc::string` is checked. This PR only contains a file for ease of review.
2026-09-29 12:50:39 +02:00
Jonathan Brouwer
5f93292a12
Rollup merge of #163401 - maxdexh:global-allocator-docs-2, r=clarfonthey
...
Clarify some things in the docs of `Global`
Follow-up to clear up some remaining confusion after rust-lang/rust#163332
cc @Mark-Simulacrum
r? clarfonthey
2026-09-29 12:50:39 +02:00
ywxt
2ad82113f8
vectorized vec::dedup pre-scan
2026-09-29 17:42:22 +08:00
Yilin Chen
2ccceb0616
Add safety comments for alloc::string
2026-09-29 16:34:25 +08:00
Jonathan Brouwer
a8a6a84070
Rollup merge of #163331 - EFanZh:move-arc-and-rc-into-rcs, r=tgross35
...
Move `Arc` and `Rc` into `rcs` mod
See <https://github.com/rust-lang/rust/pull/141348#discussion_r4066665509 >.
2026-09-29 09:59:39 +02:00
Trevor Gross
a8ead4a352
Rollup merge of #163459 - petrak-at-canonical:vec-try-remove, r=hanna-kruppe
...
Stabilize vec_try_remove
Closes rust-lang/rust#146954 , which is has [completed its FCP with disposition to merge](https://github.com/rust-lang/rust/issues/146954#issuecomment-5072327920 ).
Hello, this is my first contribution to Rust! I was programming for fun this weekend and I was surprised that this wasn't stabilized, so I thought I would try to contribute.
Disclosure: I am making this PR in my capacity as a Canonical employee.
No LLMs were harmed in the making of this pull request.
2026-09-28 23:20:45 -05:00
Trevor Gross
4426dcd56d
Rollup merge of #161712 - theemathas:stab-into-ok-err, r=nia-e
...
Stabilize `Result::into_{ok,err}`
Tracking issue: https://github.com/rust-lang/rust/issues/61695
---
As evidence of the demand of this API, here are some instances of people having written functions for this functionality:
* 6cc14c4a44/crates/common-utils/src/misc.rs (L7)
* 788e83fa72/src/server/http.rs (L93)
* ea38c0e3b2/nostr/src/util/mod.rs (L120)
* 3d51315599/ngrok/examples/tls.rs (L92)
* b54c112d7d/openraft/openraft/src/error/into_ok.rs (L10)
* 30956f62e6/firmware/src/main.rs (L54)
---
API being stabilized:
```rust
impl<T, E> Result<T, E> {
pub fn into_ok(self) -> T
where
E: Into<!>
{ .... }
pub fn into_err(self) -> E
where
T: Into<!>,
{ .... }
}
```
---
Implementation history: (I'm including only ones that touches the public API being stabilized, and not documentation or constification)
* https://github.com/rust-lang/rfcs/pull/2799
* https://github.com/rust-lang/rust/pull/66045
* https://github.com/rust-lang/rust/pull/83421
* https://github.com/rust-lang/rust/pull/92444
2026-09-28 23:20:39 -05:00
Petrichor Park
b89cf31026
Stabilize vec_try_remove
2026-09-28 14:51:35 -05:00
Yilin Chen
0012416ca7
Add safety comments for alloc::str
2026-09-28 22:39:19 +08:00
EFanZh
cba32372c7
Re-export alloc::rcs::arc::* in alloc::sync
2026-09-28 16:41:59 +08:00
EFanZh
f74f6ea68c
Rename library/alloc/src/sync.rs to library/alloc/src/rcs/arc.rs temporarily to keep file history
2026-09-28 16:41:59 +08:00
EFanZh
26b5f90dd7
Move alloc::rc into alloc::rcs
2026-09-28 16:41:56 +08:00
Jacob Pratt
3d54fac6d8
Rollup merge of #152972 - iAeternus:fix-vecdeque-partialeq-symmetry, r=clarfonthey
...
implement PartialEq<VecDeque<U>> for Vec<T>, &[T], &mut [T], [T; N], &[T; N] and &mut [T; N]
This PR is a response to rust-lang/rust#152830 . It implement PartialEq<VecDeque<U>> for Vec<T>, &[T], &mut [T], [T; N] and &mut [T; N]. To be symmetrical with the standard library's __impl_slice_eq1, I added the __impl_slice_eq2 macro to generate the implementation. Additionally, I added the reverse equality unit test (test_partial_eq_vecdeque_reverse), modified too_generic_eval_ice.current.stderr, and passed the local tests.
This PR does not involve the comparison between Cow vs Vec and Cow vs &mut [T].
PS:
This is my first time participating in this project. If there are any mistakes, please feel free to correct me.
2026-09-27 21:51:44 -04:00
Max Dexheimer
e0f657c7d0
Clarify some things in the docs of Global
2026-09-27 13:15:44 +02:00
Alice Ryhl
b90cbcbabf
Use StaticAllocator in more places
2026-09-27 06:33:17 +00:00
Jonathan Brouwer
37403cbad6
Rollup merge of #161791 - jakedrew:fix/Making_and_dropping_an_empty_BTreeMap_is_not_free_161375, r=clarfonthey
...
Make dropping an empty BTreeMap free
rust-lang/rust#161375 ([code example](https://godbolt.org/z/v594PEsr7 )) shows that drop of an empty BTree map walks the dying_next path and so is not free. I tracked this down to 7b28036c63 in 1.56.0 using godbolt’s version comparison.
When the Btree map has no root we use the ManuallyDrop to safely drop the allocator early resulting in a free drop and a `ret` instead of the `dying_next` path.
Includes codegen test which correctly catches the prior dying_next case, which I based on `uninit-aggregate-field.rs`.
Fixes rust-lang/rust#161375
2026-09-26 17:17:30 +02:00
Jake Drew
d432494d38
Comment that dying_next is too costly to inline
2026-09-25 21:32:57 +02:00