Repository navigation
Rollup of 10 pull requests - #166588
Rollup of 10 pull requests#166588
Conversation
When no field of a `Reborrow` type is reborrowed, borrowck borrows the whole source value instead. That fallback assumed the target type has exactly one lifetime and hit a `bug!` otherwise, even though `Reborrow` impls on types with several lifetimes are accepted. Borrow the source under each of the target's lifetimes instead. The one lifetime case is unchanged, and the source stays borrowed for as long as any of the target's lifetimes is live.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V7Zq35jCLdvPJALTSkLPEC
And stop accepting empty directive names & empty values (after the `:`).
…vision conditions
* Reject revision names that aren't a sequence of alphanumeric chars, `-` and `_`. * Reject conditional `revision` directives (e.g., `//@[r] revisions: q`).
The existing arm was trying to match with a diagnostic named "String", which doesn't exist and was dead code that never actually matched any case. Replace and fix the match condition by matching the definition id with the `String` `LangItem` instead as `String` exists as a LangItem and not a diagnostic item. Update tests that were affecting by this change.
Share retain implementation between Vec and VecDeque It treats Vec and VecDeque as two seperate regions, allowing them to share the same retain implementation. When processing the buffer, `retain_raw` splits the logical ring buffer into up to two contiguous regions. Each region is processed independently: elements rejected by f are dropped, while retained elements are moved to fill holes. Compared to the regional code, due to wrapping, there are some regressions on the small buffers for `Vec`. Type | Group | Small (4–32 elems) | Medium (64–512 elems) | Large (1k–100k elems) -- | -- | -- | -- | -- Vec | keep even | +1% to 0% | 0% to -1% | +1% to -1% Vec | keep all | 0% | 0% to -4% | 0% Vec | iter + collect reference | 0% to -1% | 0% | 0% VecDeque | keep all / contiguous | +19% to -30% | -43% to -48% | -49% to -50% VecDeque | keep all / wrapped | +6% to -23% | -34% to -49% | -49% to -51% VecDeque | keep even / contiguous | -5% to -26% | -28% to -31% | about -30% VecDeque | keep even / wrapped | +12% to -15% | -30% to -32% | -33% to -36% VecDeque | keep second half / contiguous | +4% to -43% | -52% to -56% | -54% to -56% VecDeque | keep second half / wrapped | +9% to -35% | -49% to -57% | -58% to -59% VecDeque | random 50% / contiguous | +23% to -14% | -23% to -29% | -27% to -73% VecDeque | random 50% / wrapped | +6% to -1% | -15% to -30% | -26% to -70% <details> <summary>Detailed Vec benchmark results</summary> ### Vec (`vec::bench_retain_*`), ns/iter: before → after (change) #### Keep even values | | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1000 | 10000 | 100000 | |---|---|---|---|---|---|---|---|---|---|---|---| | u8 | 6.9 → 6.9 (-0%) | 9.1 → 9.1 (+0%) | 14.9 → 14.9 (-0%) | 25.9 → 25.9 (+0%) | 53.8 → 53.8 (+0%) | 98.7 → 98.7 (+0%) | 187.7 → 187.7 (+0%) | 367.8 → 367.8 (-0%) | 718.2 → 718.1 (-0%) | 7.2k → 7.2k (+0%) | 71.8k → 71.8k (-0%) | | u16 | 6.2 → 6.2 (+0%) | 9.4 → 9.5 (+1%) | 14.6 → 14.6 (+0%) | 27.1 → 27.1 (+0%) | 54.5 → 54.5 (+0%) | 99.5 → 99.5 (+0%) | 190.5 → 190.5 (+0%) | 373.4 → 373.5 (+0%) | 737.8 → 737.8 (+0%) | 7.4k → 7.4k (+0%) | 74.3k → 74.4k (+0%) | | u32 | 6.6 → 6.5 (-0%) | 8.4 → 8.4 (+0%) | 15.0 → 15.0 (-0%) | 27.1 → 27.1 (-0%) | 54.5 → 54.5 (-0%) | 102.1 → 102.1 (+0%) | 195.8 → 195.8 (-0%) | 397.0 → 392.2 (-1%) | 780.6 → 788.1 (+1%) | 7.8k → 7.9k (+0%) | 79.1k → 78.3k (-1%) | | u64 | 5.5 → 5.5 (+0%) | 9.4 → 9.4 (+0%) | 15.8 → 15.8 (+0%) | 28.3 → 28.3 (+0%) | 57.9 → 58.0 (+0%) | 109.5 → 109.5 (+0%) | 228.3 → 228.4 (+0%) | 461.2 → 457.7 (-1%) | 904.1 → 904.2 (+0%) | 9.1k → 9.1k (-0%) | 91.6k → 91.5k (-0%) | #### Keep all (`whole`) | | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1000 | 10000 | 100000 | |---|---|---|---|---|---|---|---|---|---|---|---| | u8 | 3.0 → 3.0 (+0%) | 5.1 → 5.1 (+0%) | 9.4 → 9.4 (+0%) | 18.6 → 18.6 (+0%) | 37.0 → 37.0 (+0%) | 74.4 → 74.4 (+0%) | 152.8 → 152.8 (-0%) | 359.9 → 359.9 (-0%) | 697.1 → 697.1 (-0%) | 6.9k → 6.9k (-0%) | 68.8k → 68.7k (-0%) | | u16 | 3.2 → 3.2 (+0%) | 5.4 → 5.4 (+0%) | 9.9 → 9.9 (+0%) | 19.4 → 19.4 (+0%) | 38.8 → 38.8 (+0%) | 77.3 → 77.6 (+0%) | 155.2 → 154.6 (-0%) | 313.3 → 313.3 (+0%) | 604.5 → 605.5 (+0%) | 6.0k → 6.0k (+0%) | 60.2k → 60.2k (+0%) | | u32 | 3.0 → 3.0 (+0%) | 5.1 → 5.1 (+0%) | 9.4 → 9.4 (+0%) | 18.6 → 18.6 (+0%) | 37.0 → 37.0 (+0%) | 74.4 → 74.5 (+0%) | 157.7 → 152.8 (-3%) | 359.9 → 359.9 (-0%) | 697.2 → 697.1 (-0%) | 6.9k → 6.9k (-0%) | 69.0k → 69.0k (-0%) | | u64 | 3.0 → 3.0 (+0%) | 5.1 → 5.1 (+0%) | 9.4 → 9.4 (+0%) | 18.6 → 18.6 (+0%) | 37.0 → 36.9 (-0%) | 74.4 → 74.4 (-0%) | 164.2 → 157.7 (-4%) | 359.9 → 359.9 (-0%) | 698.5 → 697.8 (-0%) | 6.9k → 6.9k (-0%) | 68.9k → 68.8k (-0%) | #### Reference: `into_iter().filter().collect()` | | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1000 | 10000 | 100000 | |---|---|---|---|---|---|---|---|---|---|---|---| | u32 | 6.7 → 6.7 (+0%) | 10.9 → 10.9 (+0%) | 17.3 → 17.4 (+0%) | 30.1 → 29.9 (-1%) | 57.6 → 57.6 (+0%) </details> <details> <summary>Detailed VecDeque benchmark results</summary> ### VecDeque (`vec_deque::bench_retain_*`, u32), ns/iter: before → after (change) | Group | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1000 | 10000 | 100000 | |---|---|---|---|---|---|---|---|---|---|---|---| | keep all, contiguous | 8.4 → 10.0 (+19%) | 11.0 → 11.0 (-0%) | 17.8 → 14.8 (-17%) | 30.2 → 21.1 (-30%) | 56.7 → 32.3 (-43%) | 110.7 → 60.5 (-45%) | 215.2 → 113.6 (-47%) | 425.8 → 222.6 (-48%) | 823.6 → 420.1 (-49%) | 8.2k → 4.1k (-50%) | 81.1k → 40.6k (-50%) | | keep all, wrapped | 11.2 → 11.8 (+6%) | 14.6 → 12.9 (-11%) | 20.6 → 17.4 (-15%) | 33.4 → 25.8 (-23%) | 58.6 → 38.4 (-34%) | 112.8 → 65.1 (-42%) | 221.7 → 115.8 (-48%) | 436.2 → 222.1 (-49%) | 837.8 → 430.1 (-49%) | 8.3k → 4.1k (-51%) | 81.6k → 40.7k (-50%) | | keep even, contiguous | 10.1 → 9.6 (-5%) | 14.2 → 12.1 (-15%) | 22.5 → 17.9 (-20%) | 39.7 → 29.3 (-26%) | 80.6 → 58.0 (-28%) | 148.0 → 103.5 (-30%) | 283.6 → 197.7 (-30%) | 558.1 → 387.8 (-31%) | 1.1k → 762.5 (-30%) | 10.7k → 7.5k (-30%) | 106.6k → 75.0k (-30%) | | keep even, wrapped | 13.4 → 14.2 (+6%) | 17.6 → 19.8 (+12%) | 26.6 → 25.9 (-3%) | 45.6 → 38.6 (-15%) | 88.7 → 62.5 (-30%) | 163.2 → 114.9 (-30%) | 316.9 → 221.1 (-30%) | 618.5 → 423.1 (-32%) | 1.2k → 801.9 (-33%) | 11.9k → 7.6k (-36%) | 118.2k → 75.2k (-36%) | | keep second half, contiguous | 10.4 → 10.8 (+4%) | 14.4 → 12.7 (-12%) | 23.2 → 17.9 (-23%) | 41.9 → 23.8 (-43%) | 91.8 → 40.8 (-56%) | 158.3 → 76.6 (-52%) | 306.6 → 141.7 (-54%) | 610.3 → 285.6 (-53%) | 1.2k → 537.6 (-54%) | 11.6k → 5.1k (-56%) | 115.2k → 50.6k (-56%) | | keep second half, wrapped | 13.5 → 14.6 (+9%) | 17.6 → 17.1 (-3%) | 26.8 → 22.7 (-15%) | 48.1 → 31.4 (-35%) | 94.5 → 48.3 (-49%) | 172.1 → 79.2 (-54%) | 337.8 → 145.8 (-57%) | 671.6 → 289.3 (-57%) | 1.3k → 538.8 (-58%) | 12.5k → 5.1k (-59%) | 119.9k → 50.6k (-58%) | | keep random 50%, contiguous | 8.1 → 10.0 (+23%) | 12.7 → 12.0 (-5%) | 20.4 → 18.6 (-9%) | 36.4 → 31.4 (-14%) | 72.1 → 55.6 (-23%) | 142.7 → 103.2 (-28%) | 282.5 → 199.2 (-29%) | 554.9 → 399.3 (-28%) | 1.1k → 776.9 (-27%) | 29.1k → 7.9k (-73%) | 485.5k → 353.4k (-27%) | | keep random 50%, wrapped | 11.1 → 11.8 (+6%) | 15.8 → 15.7 (-1%) | 23.4 → 24.5 (+5%) | 40.9 → 40.4 (-1%) | 78.7 → 66.6 (-15%) | 155.2 → 115.6 (-25%) | 311.4 → 218.2 (-30%) | 603.4 → 421.3 (-30%) | 1.1k → 789.8 (-31%) | 26.1k → 7.8k (-70%) | 480.3k → 353.1k (-26%) | </details>
…dence, r=folkertdev fix inconsistent precedence of -Ctarget-feature wrt -Zllvm-target-feature Currently, -Zllvm-target-feature takes precedence for populating `internal_target_features`, but -Ctarget-feature takes precedence for what we actually tell LLVM. That's pretty bad, so this PR makes them consistent. I first wanted -Zllvm-target-feature to take precedence everywhere, as that was the intent in rust-lang#160457. However, I don't see a good way to implement that: internal_target_features are computed by instantiating an actual LLVM data structure *without* -Ctarget-feature, querying which Rust target features that supports, and then applying -Ctarget-feature and its implications "manually". This is done to prevent backend implications from affecting `cfg(target_feature)`. But this means we can't really apply -Zllvm-target-feature after having done that as that would take us back down to the LLVM level. So instead, the precedence order is that all LLVM-level stuff comes first, and then -Ctarget-feature comes all the way at the end. Cc @folkertdev (reviewer of rust-lang#160457), @nnethercote (recently did some refactoring of the backend init logic that is being further adjusted here) Tracking issue: rust-lang#157753
…ap-metadata, r=folkertdev tests: cover proc-macro metadata path remapping Fixes rust-lang#120825 adding a run-make regression test for proc-macro source-path remapping, rust-lang#120825 should be closed after this is merged. fix is already done in rust-lang#121959. the test compiles the same procedural macro in two different directories, remaps both source paths to /rustc/repro, and compares their `.rustc` metadata sections byte-for-byte. also checks that the physical source directory does not appear in the metadata. r? compiler
…e_no_reborrowed_field, r=Dnreikronos borrowck: Fix Reborrow ICE on types with several lifetimes Fixes rust-lang#165653 The ICE comes from borrowck. When a Reborrow type has no field that actually gets reborrowed (no `&mut` and no other Reborrow type inside), borrowck borrows the whole value instead, and that code just assumed the type has one lifetime. Reborrow types can have more than one lifetime now, so something like the struct with `&'a &'b str` from the issue blew up right there. The fix is in that fallback. When nothing gets reborrowed, borrowck now borrows the whole value once for each lifetime of the target type instead of panicking. With one lifetime it does exactly what it did before. With more it keeps the value borrowed while any of them is still alive, so two live reborrows of a two lifetime marker still get the usual "borrowed as mutable more than once" error, and using them one after the other is fine, same as with one lifetime. The program from the issue now gets the same error its one lifetime version already gets, since it's reborrowing through a shared ref. I ran a bunch of programs against a recent nightly. Nothing that compiles there stops compiling, the crashes are gone (generic fields, associated type fields, fields that are only Copy in some functions, CoerceShared targets with more lifetimes than the source all hit the same spot), and the ones that error now get the same error as their one lifetime version. Two things I didn't touch are the `&'static mut` field ICE (rust-lang#164933) and a CoerceShared panic when the source and target PhantomData fields don't match, that one also happens with one lifetime so it's a different bug. Honestly I think borrowing under every lifetime is the safe choice but maybe not the smartest one, a smarter version could work out which lifetime really matters for each field. If someone who knows the Reborrow design better has an opinion on that I'm happy to change it.
Rollup of 10 pull requests try-job: dist-various-1 try-job: dist-various-2 try-job: test-various try-job: test-x86_64-gnu-aux try-job: test-x86_64-msvc-1 try-job: test-aarch64-apple-1 try-job: test-aarch64-apple-2 try-job: test-x86_64-mingw-1 try-job: test-i686-msvc try-job: test-armhf-gnu try-job: test-x86_64-gnu-llvm-22-3 try-job: test-aarch64-msvc-2
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…uwer Rollup of 10 pull requests Successful merges: - #164252 (Share retain implementation between Vec and VecDeque) - #166008 (fix inconsistent precedence of -Ctarget-feature wrt -Zllvm-target-feature) - #166156 (tests: cover proc-macro metadata path remapping) - #166171 (borrowck: Fix Reborrow ICE on types with several lifetimes) - #166506 (traits: Fix dead match arm for String type suggestions.) - #164542 (Add regression test for #151312) - #165651 (compiletest: Further clean up directive parsing) - #166196 (autodiff: don't ICE on invalid macro arguments) - #166556 (remove `Box::into_boxed_slice`) - #166562 (docs: add backticks around `!` in primitive docs )
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
💔 Test for c9c3a4f failed: CI. Failed job:
|
|
@bors retry |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing e068f42 (parent) -> b3d5b3f (this PR) Test differencesShow 1229 test diffsStage 0
Stage 1
Stage 2
(and 179 additional test diffs) Additionally, 950 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard b3d5b3ffa10b2a162f2a2b001378d46e32ec3980 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
📌 Perf builds for each rolled up PR:
parent commit: e068f42013 In the case of a perf regression, run the following command with the SHAs of each PR you suspect might be the cause: |
|
Finished benchmarking commit (b3d5b3f): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.7%, secondary 1.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.4%, secondary 1.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 461.814s -> 471.839s (2.17%) |
Successful merges:
cannot relate bound region#151312)Box::into_boxed_slice#166556 (removeBox::into_boxed_slice)!in primitive docs #166562 (docs: add backticks around!in primitive docs )r? @ghost
Create a similar rollup