Repository navigation
Merge subtree update for toolchain nightly-2026-11-21 - #787
Open
github-actions[bot] wants to merge 10000 commits into
Open
github-actions[bot] wants to merge 10000 commits into
github-actions[bot] wants to merge 10000 commits into
Conversation
* add TrySendError::into_inner * drop inline
…cdylib test: - Add `sys::thread_local::guard::aix` using `__pt_atexit_np` to run main thread TLS destructors on process exit on AIX. - Update `dynamic-loading-cdylib` to use member archive syntax (`RTLD_MEMBER`) for `dlopen` on AIX. - Replace the mode array in `dynamic-loading-cdylib` with a `COMMAND_ARGS` constant that selects `load_only` for musl and AIX because `dlclose` does not invoke TLS destructors on those platforms.
miri subtree update Subtree update of `miri` to rust-lang/miri@22464d9. Created using https://github.com/rust-lang/josh-sync. r? @ghost
…2, r=folkertdev portable-simd subtree update Subtree update of `portable-simd` to rust-lang/portable-simd@185237d. Created using https://github.com/rust-lang/josh-sync. r? @ghost
…ark-Simulacrum Implement `Vec::retain_unstable` ACP This implements the `Vec::retain_unstable` method accepted as an ACP in [here](rust-lang/libs-team#275). Here's the [tracking issue](rust-lang#164152) as well. The first approach for `Vec::retain_unstable` is taken from what was discussed in this Zulip thread (namely @cuviper was the one who came up with this algorithm): [#t-libs/api-changes > ✔ swap_retain for Vec @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/327149-t-libs.2Fapi-changes/topic/.E2.9C.94.20swap_retain.20for.20Vec/near/394530721)? The first approach did the following: 1) Scan forward for something we want to remove (predicate returns false). 2) Scan backward for something we want to keep (predicate returns true). * In the reverse search process, we drop elements that the predicate evaluated as false. * In the event that no elements in the reverse search evaluated to true by the predicate, then the vector is simply truncated to remove the current and remaining elements. 3) Overwrite the forward element with the backward element. 4) Rinse and repeat from 1) until there are no elements we can iterate through. I then changed the implementation of `Vec::retain_unstable` to use a different approach. This one was also discussed in the same Zulip, where I took this approach from @quaternic who proposed the idea here: [#t-libs/api-changes > ✔ swap_retain for Vec @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/327149-t-libs.2Fapi-changes/topic/.E2.9C.94.20swap_retain.20for.20Vec/near/394428700). This approach (basically the 6th approach I tried) essentially does the following: 1) Search backward until you find an element you want to remove (implicitly that means all elements after the one you want to remove are elements you want to keep) 2) Swap this element with an element that was kept in the back (or if there are no remaining elements, simply truncate the vec) 3) Repeat from 1) until there's no element to iterate through. It uses significantly less unsafe code, doesn't have the shenanigans of using a guard struct/drop handler, and it optimizes itself really well (performing relatively the same or better than the first approach). `Vec::pop` and `mem::replace` seems to do a really good job here to do the work of `Vec::swap_remove`; they both seem to have similar performance, but I do notice they each perform worse than each other in certain cases (unsure why). In any case, I opted to use `Vec::pop` and `mem::replace`. **Regarding AI Usage:** No, I have not used an LLM to write this code and algorithm. Prior to opening the PR, I took the last 3 days (probably ~20 hours), with the last two days spending time overnight to do this all by hand (as I write this now, it's 7 AM, and I've been working on this since 1 AM due to realizing what caused the double drop/repeated "unaligned tcache chunk detected" errors were coming from and just cleaning up everything). I took time to read through the ACP and Zulip thread, understood how `Vec::retain_mut` worked underneath the hood: https://github.com/rust-lang/rust/blob/7211ea594cbf137ef6118b1752b959dea7cb9088/library/alloc/src/vec/mod.rs#L2502-L2610 and traded some of my sanity to debug and fix double drop/panic errors (be it from the predicate end or the drop of the element); you may notice that the earlier implementation for this follows a similar structure to the `Vec::retain_mut` implementation. The tests and benchmarks are templated off the ones made for `Vec::retain` (if you look earlier/later in the file, you'll see them). I did add few more test cases to cover for the case on what happens if the predicate returned false on all elements (or vice versa true on all elements). I have, however, used Claude Sonnet 5.5 to create markdown formatted table of the data I collected. All the raw data collection and benchmarking code were manually collected via `./x bench library/alloc --test-args=bench_retain` and pasted into txt files. I made sure to verify that the markdown-formatted tables parsed the data correctly from the txt files I pasted them in. I hope this is an acceptable usage of AI here. To further note, I am only showing the first `Vec::retain_unstable` implementation/6th + 7th approach (the pure reverse search iteration, one with `Vec::pop` + `mem::replace` and other with `Vec::swap_remove`); all the other approaches in between performed pretty badly or didn't exceed the performance of approach 1. The following is benchmarking data on `Vec::retain` and `Vec::retain_unstable` (the latter of which only shows the two main approaches that were used in commit history): | Benchmark | Vec::retain | Vec::retain_unstable Approach 1 | Vec::retain_unstable Approach 6 | Vec::retain_unstable Approach 7 | |---|---|---|---|---| | bench_retain_100000 | 37476.58 ± 8850.81 | 36563.43 ± 619.68 | 36798.82 ± 239.89 | 56966.76 ± 392.28 | | bench_retain_none_100000 | 1.24 ± 0.01 | 1.24 ± 0.01 | 1.24 ± 0.00 | 1.24 ± 0.00 | | bench_retain_quarter_false_100000 | 34050.51 ± 117.18 | 42963.59 ± 2798.66 | 27929.89 ± 183.32 | 27748.10 ± 3916.34 | | bench_retain_100000_alternating_with_alignment | 32711.64 ± 518.39 | 33780.88 ± 358.60 | 33282.16 ± 202.27 | 30596.01 ± 400.60 | | bench_retain_100000_quarter_false_with_alignment | 48943.07 ± 583.16 | 49239.34 ± 5107.02 | 49642.47 ± 389.36 | 48160.21 ± 1277.09 | | bench_retain_whole_100000 | 15616.17 ± 82.73 | 15662.04 ± 135.53 | 15558.17 ± 53.02 | 15575.18 ± 148.82 | | bench_retain_whole_u8_000004 | 1.67 ± 0.02 | 1.86 ± 0.01 | 1.65 ± 0.00 | 1.66 ± 0.01 | | bench_retain_whole_u8_000008 | 2.29 ± 0.03 | 2.28 ± 0.01 | 2.07 ± 0.01 | 2.28 ± 0.03 | | bench_retain_whole_u8_000016 | 3.54 ± 0.07 | 3.52 ± 0.01 | 3.18 ± 0.09 | 3.31 ± 0.11 | | bench_retain_whole_u8_000032 | 6.07 ± 1.28 | 6.00 ± 0.09 | 5.75 ± 0.14 | 5.92 ± 0.11 | | bench_retain_whole_u8_000064 | 10.99 ± 0.10 | 10.97 ± 0.11 | 10.75 ± 0.11 | 10.86 ± 0.21 | | bench_retain_whole_u8_000128 | 20.94 ± 1.52 | 21.12 ± 0.23 | 20.69 ± 0.05 | 20.89 ± 0.04 | | bench_retain_whole_u8_000256 | 41.42 ± 0.81 | 40.95 ± 0.04 | 44.47 ± 0.10 | 44.68 ± 0.87 | | bench_retain_whole_u8_000512 | 84.63 ± 0.52 | 84.38 ± 0.10 | 84.17 ± 0.06 | 84.39 ± 0.51 | | bench_retain_whole_u8_001000 | 163.09 ± 4.57 | 160.71 ± 0.26 | 159.89 ± 0.22 | 160.09 ± 1.70 | | bench_retain_whole_u8_010000 | 1563.25 ± 170.51 | 1556.72 ± 2.64 | 1555.94 ± 3.38 | 1556.07 ± 2.92 | | bench_retain_whole_u8_100000 | 15584.98 ± 3022.73 | 15519.22 ± 37.93 | 15519.27 ± 34.22 | 15520.80 ± 48.78 | | bench_retain_whole_u16_000004 | 1.67 ± 0.01 | 1.66 ± 0.01 | 1.45 ± 0.01 | 1.66 ± 0.01 | | bench_retain_whole_u16_000008 | 2.29 ± 0.04 | 2.09 ± 0.01 | 1.87 ± 0.01 | 2.27 ± 0.00 | | bench_retain_whole_u16_000016 | 3.54 ± 0.05 | 3.33 ± 0.14 | 3.19 ± 0.21 | 3.43 ± 0.08 | | bench_retain_whole_u16_000032 | 6.04 ± 0.05 | 5.89 ± 0.09 | 5.73 ± 0.21 | 5.91 ± 0.07 | | bench_retain_whole_u16_000064 | 11.02 ± 0.10 | 10.86 ± 0.67 | 10.76 ± 0.22 | 10.92 ± 0.14 | | bench_retain_whole_u16_000128 | 21.00 ± 0.08 | 20.88 ± 0.39 | 20.69 ± 0.35 | 20.86 ± 0.21 | | bench_retain_whole_u16_000256 | 40.97 ± 0.38 | 40.72 ± 0.32 | 44.74 ± 0.62 | 44.70 ± 3.02 | | bench_retain_whole_u16_000512 | 87.09 ± 15.45 | 84.59 ± 0.18 | 83.96 ± 0.09 | 84.40 ± 7.96 | | bench_retain_whole_u16_001000 | 164.42 ± 3.27 | 160.71 ± 0.54 | 159.66 ± 0.17 | 160.08 ± 0.41 | | bench_retain_whole_u16_010000 | 1594.39 ± 146.76 | 1556.66 ± 2.00 | 1555.61 ± 4.25 | 1556.03 ± 5.08 | | bench_retain_whole_u16_100000 | 15848.05 ± 3849.79 | 15517.92 ± 19.14 | 15522.59 ± 26.40 | 15524.23 ± 15.75 | | bench_retain_whole_u32_000004 | 1.88 ± 0.10 | 1.66 ± 0.01 | 1.45 ± 0.29 | 1.66 ± 0.01 | | bench_retain_whole_u32_000008 | 2.29 ± 0.06 | 2.08 ± 0.01 | 1.88 ± 0.03 | 2.27 ± 0.01 | | bench_retain_whole_u32_000016 | 3.55 ± 0.05 | 3.42 ± 0.08 | 3.20 ± 0.17 | 3.43 ± 0.21 | | bench_retain_whole_u32_000032 | 6.05 ± 0.08 | 5.93 ± 0.09 | 5.71 ± 0.25 | 5.93 ± 0.14 | | bench_retain_whole_u32_000064 | 11.04 ± 0.14 | 10.95 ± 0.18 | 10.75 ± 0.30 | 10.93 ± 0.18 | | bench_retain_whole_u32_000128 | 21.20 ± 0.30 | 20.86 ± 0.21 | 20.68 ± 0.24 | 20.88 ± 0.09 | | bench_retain_whole_u32_000256 | 41.20 ± 0.49 | 45.23 ± 5.01 | 44.92 ± 0.57 | 44.96 ± 0.28 | | bench_retain_whole_u32_000512 | 85.30 ± 1.42 | 84.58 ± 0.12 | 83.97 ± 0.16 | 84.59 ± 0.15 | | bench_retain_whole_u32_001000 | 161.23 ± 2.12 | 160.74 ± 0.52 | 159.68 ± 0.31 | 160.31 ± 0.43 | | bench_retain_whole_u32_010000 | 1570.97 ± 15.19 | 1566.32 ± 5.97 | 1559.63 ± 4.83 | 1560.98 ± 3.39 | | bench_retain_whole_u32_100000 | 15646.12 ± 150.06 | 15626.45 ± 58.76 | 15532.71 ± 37.13 | 15567.46 ± 84.21 | | bench_retain_whole_u64_000004 | 1.66 ± 0.02 | 1.66 ± 0.00 | 1.45 ± 0.00 | 1.86 ± 0.00 | | bench_retain_whole_u64_000008 | 2.30 ± 0.06 | 2.24 ± 0.20 | 1.87 ± 0.01 | 2.27 ± 0.00 | | bench_retain_whole_u64_000016 | 3.54 ± 0.04 | 3.53 ± 0.19 | 3.16 ± 0.06 | 3.40 ± 0.06 | | bench_retain_whole_u64_000032 | 6.05 ± 0.10 | 6.03 ± 0.22 | 5.71 ± 0.09 | 5.88 ± 0.15 | | bench_retain_whole_u64_000064 | 11.04 ± 0.10 | 11.00 ± 0.21 | 10.74 ± 0.14 | 10.89 ± 0.18 | | bench_retain_whole_u64_000128 | 20.99 ± 0.13 | 20.90 ± 0.45 | 20.68 ± 0.13 | 20.90 ± 0.07 | | bench_retain_whole_u64_000256 | 41.02 ± 0.45 | 40.77 ± 0.66 | 44.67 ± 0.12 | 45.70 ± 5.03 | | bench_retain_whole_u64_000512 | 85.22 ± 0.85 | 85.29 ± 1.03 | 84.38 ± 0.08 | 84.59 ± 0.33 | | bench_retain_whole_u64_001000 | 161.32 ± 1.46 | 160.48 ± 1.51 | 160.09 ± 2.16 | 160.27 ± 0.19 | | bench_retain_whole_u64_010000 | 1583.79 ± 23.06 | 1558.87 ± 16.21 | 1560.58 ± 3.89 | 1560.95 ± 3.16 | | bench_retain_whole_u64_100000 | 15924.35 ± 276.94 | 15710.06 ± 383.21 | 15707.73 ± 88.41 | 15646.32 ± 1949.35 | | bench_retain_u8_000004 | 6.70 ± 0.22 | 6.27 ± 0.06 | 6.84 ± 0.04 | 6.65 ± 0.22 | | bench_retain_u8_000008 | 7.29 ± 0.05 | 6.97 ± 0.11 | 8.96 ± 1.12 | 8.22 ± 0.13 | | bench_retain_u8_000016 | 9.98 ± 0.06 | 9.29 ± 2.05 | 13.86 ± 0.09 | 12.02 ± 0.54 | | bench_retain_u8_000032 | 15.54 ± 0.22 | 16.57 ± 1.01 | 22.92 ± 2.46 | 18.31 ± 0.81 | | bench_retain_u8_000064 | 26.20 ± 0.72 | 27.53 ± 4.85 | 41.98 ± 1.49 | 33.25 ± 3.08 | | bench_retain_u8_000128 | 49.54 ± 1.24 | 50.94 ± 2.90 | 76.62 ± 0.97 | 59.92 ± 8.54 | | bench_retain_u8_000256 | 91.23 ± 0.71 | 92.18 ± 4.19 | 146.77 ± 1.15 | 116.72 ± 3.17 | | bench_retain_u8_000512 | 174.23 ± 1.87 | 181.76 ± 2.15 | 286.72 ± 2.87 | 229.30 ± 9.38 | | bench_retain_u8_001000 | 332.92 ± 1.09 | 334.72 ± 4.55 | 553.55 ± 4.15 | 442.96 ± 7.01 | | bench_retain_u8_010000 | 3251.47 ± 75.14 | 3260.39 ± 28.63 | 5478.62 ± 42.90 | 4414.76 ± 25.27 | | bench_retain_u8_100000 | 32657.05 ± 2751.67 | 32454.35 ± 115.06 | 54724.37 ± 112.44 | 43629.83 ± 169.57 | | bench_retain_u16_000004 | 6.10 ± 0.03 | 5.79 ± 0.15 | 6.72 ± 0.04 | 6.70 ± 0.18 | | bench_retain_u16_000008 | 7.36 ± 0.06 | 6.96 ± 0.03 | 8.42 ± 0.04 | 8.35 ± 0.30 | | bench_retain_u16_000016 | 9.27 ± 0.60 | 9.90 ± 0.25 | 12.37 ± 0.31 | 11.70 ± 0.53 | | bench_retain_u16_000032 | 13.16 ± 1.47 | 15.05 ± 1.80 | 19.48 ± 0.86 | 16.50 ± 2.08 | | bench_retain_u16_000064 | 20.20 ± 2.33 | 26.86 ± 3.79 | 36.86 ± 2.86 | 27.13 ± 6.02 | | bench_retain_u16_000128 | 38.05 ± 4.88 | 50.21 ± 1.83 | 65.07 ± 2.02 | 51.31 ± 9.55 | | bench_retain_u16_000256 | 66.12 ± 15.22 | 91.89 ± 3.33 | 121.84 ± 2.32 | 94.34 ± 11.84 | | bench_retain_u16_000512 | 123.60 ± 0.66 | 175.47 ± 2.48 | 236.31 ± 11.70 | 181.07 ± 29.55 | | bench_retain_u16_001000 | 241.17 ± 34.55 | 341.28 ± 3.05 | 453.58 ± 0.83 | 346.32 ± 4.42 | | bench_retain_u16_010000 | 2376.12 ± 350.65 | 3369.49 ± 38.55 | 4453.28 ± 34.60 | 3385.89 ± 76.81 | | bench_retain_u16_100000 | 23800.32 ± 1808.66 | 33784.22 ± 150.95 | 44440.85 ± 59.13 | 33771.11 ± 155.56 | | bench_retain_u32_000004 | 6.67 ± 0.34 | 5.86 ± 0.03 | 6.63 ± 0.23 | 7.04 ± 0.02 | | bench_retain_u32_000008 | 7.38 ± 0.16 | 6.55 ± 0.03 | 7.48 ± 0.35 | 8.74 ± 0.06 | | bench_retain_u32_000016 | 10.14 ± 1.22 | 9.06 ± 0.05 | 10.60 ± 0.67 | 13.70 ± 3.53 | | bench_retain_u32_000032 | 16.34 ± 1.35 | 15.13 ± 0.91 | 15.62 ± 2.41 | 22.55 ± 0.17 | | bench_retain_u32_000064 | 27.31 ± 0.43 | 26.00 ± 0.41 | 26.94 ± 4.25 | 42.43 ± 0.12 | | bench_retain_u32_000128 | 51.99 ± 0.39 | 52.05 ± 4.56 | 51.69 ± 12.33 | 77.16 ± 0.45 | | bench_retain_u32_000256 | 96.51 ± 2.01 | 94.58 ± 0.67 | 97.03 ± 17.27 | 147.31 ± 0.71 | | bench_retain_u32_000512 | 188.00 ± 1.40 | 188.41 ± 2.63 | 189.28 ± 0.98 | 292.59 ± 2.53 | | bench_retain_u32_001000 | 369.73 ± 6.73 | 366.19 ± 3.19 | 366.53 ± 3.08 | 572.00 ± 4.90 | | bench_retain_u32_010000 | 3670.92 ± 52.18 | 3637.99 ± 10.76 | 3642.67 ± 234.14 | 5695.97 ± 22.42 | | bench_retain_u32_100000 | 36795.72 ± 626.05 | 36411.14 ± 247.22 | 36417.13 ± 112.45 | 56958.37 ± 308.11 | | bench_retain_u64_000004 | 6.41 ± 0.20 | 5.71 ± 0.08 | 6.24 ± 0.22 | 6.47 ± 0.04 | | bench_retain_u64_000008 | 7.91 ± 0.55 | 6.70 ± 0.13 | 8.49 ± 1.02 | 10.13 ± 0.08 | | bench_retain_u64_000016 | 10.69 ± 0.22 | 9.63 ± 0.09 | 10.85 ± 2.67 | 13.08 ± 1.25 | | bench_retain_u64_000032 | 17.20 ± 0.51 | 16.05 ± 0.14 | 17.76 ± 1.65 | 18.26 ± 3.04 | | bench_retain_u64_000064 | 28.55 ± 0.73 | 27.87 ± 0.17 | 30.98 ± 0.90 | 30.85 ± 6.37 | | bench_retain_u64_000128 | 55.61 ± 7.67 | 54.88 ± 0.23 | 61.73 ± 9.24 | 63.07 ± 4.98 | | bench_retain_u64_000256 | 107.25 ± 2.72 | 108.75 ± 1.52 | 114.94 ± 1.65 | 114.59 ± 20.70 | | bench_retain_u64_000512 | 215.64 ± 12.76 | 214.78 ± 1.37 | 224.26 ± 1.21 | 223.68 ± 65.43 | | bench_retain_u64_001000 | 417.88 ± 8.98 | 416.98 ± 2.12 | 427.78 ± 9.27 | 427.92 ± 92.07 | | bench_retain_u64_010000 | 4173.49 ± 59.43 | 4164.23 ± 21.13 | 4171.13 ± 2053.29 | 4159.72 ± 528.47 | | bench_retain_u64_100000 | 45586.61 ± 5794.73 | 41787.79 ± 701.76 | 41832.71 ± 196.84 | 41790.43 ± 373.08 | The raw data can be found in this [repository](https://github.com/asder8215/vec-retain-unstable/tree/main/retain_unstable%20benchmarks) I made. I was working with the current benchmarking cases that `Vec::retain` had and trying to see if I could optimize `Vec::retain_unstable` to at least be on par with `Vec::retain` for certain cases and then excel better than it in additional cases like filtering 25% of the data (though this was in a contiguous block) or with filtering elements aligned to 64 bytes (filling up a cache line). There are likely more cases I could've benchmarked like how it does when we're filtering 5%, 10%, 15%, 20% of the vector, whether those filtered elements came in contiguous portions or more randomly spread apart, how it does with bigger sized elements (128 bytes, 256 bytes, etc.), etc.. If you want me to add benchmark cases for those, I could do that. Let me know if there's anything else I could improve in this PR.
…, r=Mark-Simulacrum add TrySendError::into_inner Tracking issue: rust-lang#165102
…econds, r=Mark-Simulacrum Implement `Duration::display_seconds` This implements rust-lang#165108 according to ACP rust-lang#351. (LLM are used only for spell and grammar checks.)
…Mark-Simulacrum DropGuard: remove leading newlines from examples Since the starting lines are hidden, the blank lines afterwards render as leading newlines; remove them.
…hnTitor std: Use getexecpath() for current_exe() on OpenBSD OpenBSD added getexecpath(3) to libc, which returns an already-canonicalized executable path directly. Replace the sysctl(KERN_PROC_ARGV)-based implementation. This was the last user of div_exact in std, so drop the exact_div feature gate.
…tebank Add a lint helper attribute namespace (and also port over three rustc lint attributes, as proof of concept) This PR implements parsing for the `lint` tool namespace (`#[lint::attribute]`) but doesn't add it as a builtin tool, so `#![register_tool(lint)]` is also required to use it. It raises an error on an unknown attribute within that namespace. The primary motivations for creating this namespace are: - creating a place for attributes like `trivial_field_reads` (rust-lang#160666) and `c_buffer_length` (rust-lang#162565) to live, as these IMO do not belong in the diagnostic namespace. - make it easier to unstably land lints and lint helper attributes, as these currently suffer from the "any new built-in attribute is a breaking change" problem. - implementing (part of) rust-lang#160808 ### What is a "lint helper" Attributes that change how or if a lint is emitted. Think of many of the internal attributes like `#[rustc_as_ptr]` , `#[rustc_pass_by_value]` etc. Other examples are `#[deprecated]` and `#[must_not_suspend]`. Even `clippy` has such a thing: `#[clippy::format_args]`. ### On breaking changes This doesn't add `lint` as a built-in tool (like `diagnostic`, `rustfmt`, `clippy` etc are) so this pr is not a breaking change. The breaking changes are opt-in by using `#![register_tool(lint)]` in the crate root which is unstable at this time. The way this PR is implemented means that, even if users could use `#![register_tool(lint)]` stably, they cannot stably use the namespace because an unknown attribute is an error and all valid attributes in it, at this time, are also feature gated. So there is no commitment to stability until we choose to stabilize an attribute in it. ### Going forward We can require using `#![register_tool(lint)]` indefinitely. It's possible to not require this this by adding `lint` as a builtin tool, but this (assuming rust-lang#162597) breaks ```rust #[lint::as_ptr] struct Foo; mod lint { pub use derive as as_ptr; } ``` However as [nobody on github does this](https://github.com/search?type=code&q=%22%23%5Blint%3A%3A%22+language%3ARust) it's probably only theoretically breaking. It's non-breaking to add it across an edition. r? @estebank cc @WaffleLapkin @petrochenkov
…rd, r=petrochenkov Add `let_underscore_drop_guard` lint. This lint is similar to the existing [`let_underscore_lock`](https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#let-underscore-lock) lint, but applies to `DropGuard` instead of `MutexGuard` and similar types. It is deny-by-default, like `let_underscore_lock`. (Note that the related `let_underscore_drop` lint is allow-by-default.) Relevant discussion: [#t-libs > Linting `let _ = DropGuard::new(....);`](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Linting.20.60let.20_.20.3D.20DropGuard.3A.3Anew.28.2E.2E.2E.2E.29.3B.60/with/631977543) Note that `DropGuard` is a newly stabilized type, currently in 1.100 beta, and will be on the 1.100 stable release on November 12. Tracking issue for `DropGuard`: rust-lang#144426
Replace `builtin #` with `k#` Part of rust-lang#153839. Also renames internal feature `builtin_syntax` to `internal_syntax` (without tombstoning) and keeps/reuses tracking issue rust-lang#110680 (whose contents are going to get updated post merge). ~~Blocked on rust-lang#161775 getting picked up by stage0 rustfmt~~ (happened in PR rust-lang#163483). <sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub>
make the safety documentation consistent in Ptr module This PR only contains doc changes. Similar to PR rust-lang#164213 , "make the safety documentation consistent in task::LocalWaker", the reason for this is that I found the current documentation has different representations. So I refactored this documentation in the `ptr` module and kept only the most commonly used pattern.
…lloc, r=JohnTitor clarify when `Vec::into_boxed_slice()` is in-place It is useful to know that `Vec::into_boxed_slice` (and the inverse `From<Vec<T>> for Box<[T]>`) do not reallocate when the vector length matches its capacity. The conversion of `Vec<T>` to a boxed array `Box<[T; N]>` already documents this behavior: https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.try_from-1 But `into_boxed_slice` (and in turn, `shrink_to_fit`) did not. I do think this is technically a new guarantee so I'll nominate it for T-libs I guess? r? libs libs meeting notes: https://github.com/rust-lang/libs-team/blob/6f87f9c054001c8e44d0de81b68b5f6f6a9e8d02/minutes/2026-10-13.md#164258-clarify-when-vecinto_boxed_slice-is-in-place
…ic-loading-cdylib, r=workingjubilee AIX: Implement TLS destructor guard in std and update dynamic-loading-cdylib test Fix dynamic loading on AIX so it can be properly tested. - Add `sys::thread_local::guard::aix` using `__pt_atexit_np` to run main thread TLS destructors on process exit on AIX. - Update `dynamic-loading-cdylib` to use member archive syntax (`RTLD_MEMBER`) for `dlopen` on AIX. - Replace the mode array in `dynamic-loading-cdylib` with a `TEST_MODE` constant that selects `load_only` for musl and AIX because `dlclose` does not invoke TLS destructors on those platforms.
…Arc, Rc) * alloc: Add test coverage for try_clone_from_ref_in * alloc: test cloning zero-sized values from references * alloc: format zero-sized clone test * alloctests: remove obsolete const_btree_len feature * alloctests: fix feature attribute formatting
Method to get a ordering key on `Discriminant`
Based on reviewer feedback.
…, r=ChrisDenton windows seek_write: document interaction with append mode [MS docs](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-ntwritefile) say that the offset is ignored for files opened with FILE_APPEND_DATA. Our `append(true)` [maps to](https://github.com/rust-lang/rust/blob/0df97849e3a1abbaff8969ec3b9cd9334ab68790/library/std/src/sys/fs/windows.rs#L294-L295) `c::FILE_GENERIC_WRITE & !c::FILE_WRITE_DATA` for `CreateFileW`... which then presumably translates into `FILE_APPEND_DATA` for `NtCreateFile`? r? @ChrisDenton
…ohnTitor Add `cd` alias to `std::env::set_current_dir` Addresses rust-lang#130058, let me know if there are any suggestions to add. Adds the `cd` alias to the [`std::env::set_current_dir`](https://doc.rust-lang.org/stable/std/env/fn.set_current_dir.html) function, which can make finding it easier.
…les, r=tgross35 Add examples to Allocator methods Part of [rust-lang#163232](rust-lang#163232) Added examples to all six methods of the `Allocator` trait, namely `allocate`, `allocate_zeroed`, `deallocate`, `grow`, `grow_zeroed` and `shrink` using `System`. Follows [rust-lang#165287](rust-lang#165287) Checked with Miri. r? libs
…clarfonthey Remove `#[allow(missing_docs)]` where possible Related to rust-lang#166067. r? @clarfonthey
But still ignore EBADF in (e)println.
This used to be handled indirectly in std::stdio
Missed as part of 78c5cdd ("std: Combine `is_mips64_feature_detected` into `is_mips_feature_detected`").
`abort` is getting used a bit more in places where unwinding via `panic!` isn't desired. Some of these places involve shared const and runtime code, so mark `abort` unstably `const` to make this a bit easier. This uses `core::process::crash` as the const implementation, which will be const stable in the near future.
…=ShoyuVanilla
Compressed `ParamEnv`s for common marker traits
r? project-trait-system-refactor
This implements "compressed" `ParamEnv`s. It uses the fact that a lot of paramenvs contain many similar bounds on each generic. For example:
```rust
fn foo<A: Clone, B: Clone>(a: A, b: B) {}
```
Contains the bounds `A: Clone, A: Sized, A: MetaSized, B: Clone, B: Sized, B: MetaSized`.
The fact that metasized is in there is already enough of a problem that it is in fact not in there, and we have many hacks to avoid it in many cases which I hope to remove soon.
The new representation of this would be two bitsets:
```
A: <bitset containing Clone | Sized | MetaSized>, B: <bitset containing Clone | Sized | MetaSized>
```
The bitsets can contain the following traits:
- Sized
- MetaSized
- PointeeSized (which may be unused right now? May remove this one again in the future since it kinda represents the absence of any bounds)
- Clone
- Copy
- Debug
- Drop
- Unpin
- Eq
- Send
- Sync
Note that in the future this optimization becomes more important given that we're in the process of experimenting with more implicit trait bounds. In the future, `A: Clone` may expand to `A: Clone, A: Sized, A: MetaSized, A: Forget, A: Move, A: Destruct, A: Leak`, and with this PR those will all become just `A: <bitset containing Sized | MetaSized | Forget | Move | Destruct | Leak>`
On its own this optimization isn't necessarily worth a lot, because by storing these common predicates in a bitset, we actually stop interning them upfront. On access (and they're commonly accessed) we have to re-intern them which is terrible. The real speedup comes from knowing better *in advance* what bounds we're looking for. Using the new paramenv iterators, caller bounds iterators can say that they're looking for a predicate referencing a specific trait and for a specific self type. If we know that, we and the trait isn't any of the compressed traits, or the self type isn't the one of a specific compressed bitset, we can skip the entire set in one step. This optimization needs to offset the cost of re-interning for this optimization to be worth anything.
Note: this PR may be slightly perf-negative on rustdoc. It looks positive in the latest perf runs but that's because it's based on rust-lang#165774 which improves rustdoc perf a lot. It improves some benchmark by up to 16% and this PR regresses it back by about 1%. See also rust-lang#165460 (comment), rust-lang#165774
> [!NOTE]
> <table>
> <tr><td>
>
> 
>
> </td><td>
>
> [I've not used an LLM for any part of this PR, or any other PR I make. This includes any related work like research.](https://0rwx.com/)
>
> </td></tr>
> </table>
Remove ebadf handling from stdio But still ignore ebadf in `println!` and `eprintln!` macros. We preserve the Windows behaviour of ignoring NUL handles. Fixes rust-lang#47271 (see rust-lang#47271 (comment))
…r=oli-obk reflection: doc attributes from adts, fields, and variants Adds intrinsics and methods to get the raw doc comment strings from adts, fields, and variants. As noted in the tracking issue rust-lang#146922, before stabilizing the interface we should consider whether these methods get the raw strings. r? @oli-obk
Move ub_checks() inside the const_eval_select branch. This looks like it shouldn't change anything, but it is a small (but measurable) speedup for CTFE that goes through this macro. Presumably by avoiding the MIR for the early-out `&&` entirely, it can go a little faster.
simd-test: Fix cfg syntax in the test macro Missed as part of 78c5cdd ("std: Combine `is_mips64_feature_detected` into `is_mips_feature_detected`").
…y,RalfJung std: Unstably constify `std::process::abort` `abort` is getting used a bit more in places where unwinding via `panic!` isn't desired. Some of these places involve shared const and runtime code, so mark `abort` unstably `const` to make this a bit easier. This uses `core::process::crash` as the const implementation, which will be const stable in the near future. Tracking issue: rust-lang#166193.
…nTitor std: two small improvements to UNIX stack overflow logic See the individual commits... The second commit should have a big impact on the binary size of programs compiled with `panic = "immediate-abort"`, as it enables the removal of the `BTreeMap` code used to store thread info.
Since model-checking/kani#4230, `should_panic` only accepts failures of class `panic`, and a failed contract condition isn't one. The eight `should_fail_*` harnesses called `transmute_unchecked_wrapper` under `stub_verified` and relied on its precondition failure counting as the expected panic, so they failed on Kani 87c8701. Each harness now asserts that the precondition, `can_dereference(&src as *const T as *const U)`, is false for every input in its set. That holds for all such inputs, not just one.
Member
|
Two CI failures here, both from the move to nightly-2026-11-21:
|
feliperodri
reviewed
Nov 22, 2026
Comment on lines
+3941
to
+3944
| // The `should_fail_*` harnesses show that `transmute_unchecked_wrapper`'s precondition | ||
| // rejects every input whose bytes aren't a valid value of the output type. They assert that | ||
| // the precondition is false rather than calling the wrapper under `should_panic`: Kani | ||
| // doesn't count a failed contract condition as a panic. |
Member
There was a problem hiding this comment.
@AlexLB99 do the changes in this commit look alright to you? I changed the behavior of should_panic in model-checking/kani#4230
There was a problem hiding this comment.
Hi @feliperodri, overall this looks good to me! I just left a comment about the i8 -> bool case, which is actually checking u8 -> bool (due to a mistake in the original harnesses). But the overall translations away from should_panic here are correct
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automated PR to merge library subtree updates from 2026-11-19 (rust-lang/rust@65ce861) to 2026-11-21 (rust-lang/rust@c7d5ba5), inclusive. This is a clean merge, no conflicts were detected. Do not remove or edit the following annotations:
git-subtree-dir: library
git-subtree-split: 856fd8d