Skip to content

Rollup of 7 pull requests#156559

Merged
rust-bors[bot] merged 66 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-WZRJhi0
May 14, 2026
Merged

Rollup of 7 pull requests#156559
rust-bors[bot] merged 66 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-WZRJhi0

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

ada4a and others added 30 commits April 5, 2026 13:20
The program will suggest using the `then_some` method.

changelog: add [`some_filter`]
It currently only depends on two things:
- `rustc_ast::AttrId`: this is just a re-export of `rustc_span::AttrId`,
  so we can import the original instead.
- `rustc_ast::AttributeExt`: needed only for the `name` and `id`
  methods. We can instead pass in the `name` and `id` directly.
Previously when adding a suggestion for using `Cow::into_owned()`
instead of `ToOwned::to_owned()`, the compiler would just convert the
methods `Span` into a `String` and do checks on that `String`. This PR
adds an extra guard to that suggestion by checking if the method is
`sym::to_owned_method`.
Add extra symbol check for `.to_owned()`

Follow up of rust-lang#154646

Previously when adding a suggestion for using `Cow::into_owned()` instead of `ToOwned::to_owned()`, the compiler would just convert the methods `Span` into a `String` and do checks on that `String`. This PR adds an extra guard to that suggestion by checking if the method is `sym::to_owned_method`.

r? @davidtwco since you added the review to the previous PR
*[View all
comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/15793)*

This is needed for `SpanlessEq` to work correctly inside a macro
expansion. The context selected for some of the lints may be wrong, but
most of them don't handle macros correctly in the first place so this
won't really be a regression. Without this change `SpanlessEq` would
essentially assume the root context which isn't always correct.

changelog: none
Make retags an implicit part of typed copies



Ever since Stacked Borrows was first implemented in Miri, that was done with `Retag` statements: given a place (usually a local variable), those statements find all references stored inside the place and refresh their tags to ensure the aliasing requirements are upheld. However, this is a somewhat unsatisfying approach for multiple reasons:
- It leaves open the [question](rust-lang/unsafe-code-guidelines#371) of where to even put `Retag` statements. Over time, the AddRetag pass settled on one possible answer to this, but it wasn't very canonical.
- For assignments of the form `*ptr = expr`, if the assignment involves copying a reference, we probably want to do a retag -- but if we do a `Retag(*ptr)` as the next instruction, it can be non-trivial to argue that this even retags the right value, so we refrained from doing retags in that case. This has [come up](llvm/llvm-project#160913 (comment)) as a potential issue for Rust making better use of LLVM "captures" annotations. (That said, there might be [other ways](rust-lang/unsafe-code-guidelines#593 (comment)) to obtain this desired optimization.)
- Normal compilation avoids generating retags, but we still generate LLVM IR with `noalias`. What does that even mean? How do MIR optimization passes interact with retags? These are questions we have to figure out to make better use of aliasing information, but currently we can't even really ask such questions.

I think we should resolve all that by making retags part of what happens during a typed copy (a concept and interpreter infrastructure that did not exist yet when retags were initially introduced). Under this proposal, when executing a MIR assignment statement, what conceptually happens is as follows:
- We evaluate the LHS to a place.
- We evaluate the RHS to a value. This does a typed load from memory if needed, raising UB if memory does not contain a valid representation of the assignment's type.
- We walk that value, identify all references inside of it, and retag them. If this happens as part of passing a function argument, this is a protecting retag.
- We store (a representation of) the value into the place.

However, this semantics doesn't fully work: there's a mandatory MIR pass that turns expressions like `&mut ***ptr` into intermediate deref's. Those must *not* do any retags. So far this happened because the AddRetag pass did not add retags for assignments to deref temporaries, but that information is not recorded in cross-crate MIR. Therefore I instead added a field to `Rvalue::Use` to indicate whether this value should be retagged or not. A non-retagging copy seems like a sufficiently canonical primitive that we should be able to express it. Dealing with the fallout from that is a large chunk of the overall diff. (I also considered adding this field to `StatementKind::Assign` instead, but decided against that as we only actually need it for `Rvalue::Use`. I am not sure if this was the right call...)

This neatly answers the question of when retags should occur, and handles cases like `*ptr = expr`. It avoids traversing values twice in Miri. It makes codegen's use of `noalias` sound wrt the actual MIR that it is working on. It also gives us a target semantics to evaluate MIR opts against. However, I did not carefully check all MIR opts -- in particular, GVN needs a thorough look under the new semantics; it currently can turn alias-correct code into alias-incorrect code. (But this PR doesn't make things any worse for normal compilation where the retag indicator is anyway ignored.)

Another side-effect of this PR is that `-Zmiri-disable-validation` now also disables alias checking. It'd be nicer to keep them orthogonal but I find this an acceptable price to pay.

- [rustc benchmark results](rust-lang#154341 (comment))
- [miri benchmark results](rust-lang#154341 (comment))
Remove unused spans from AttributeKind

Recently I noticed some spans in diagnostic attributes were never used. I went through and checked the other variants too.
…nishearth

Clippy subtree update

r? Manishearth
…RalfJung,ShoyuVanilla

Rip out rustc_layout_scalar_valid_range_* attribute support

And either removes tests for it or replaces the uses with pattern types.

primarily fixes rust-lang#135996

fixes rust-lang#147761
fixes rust-lang#133652
…ust-lang#16952)

fixes rust-lang/rust-clippy#16950

lint should now also trigger over async fns.

changelog: [`needless_return_with_question_mark`]: fix false negative in
async fn bodies.
*[View all
comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/15745)*

Add a check for some followed by filter.

The program will suggest using the `then_some` method.

changelog: [`filter_some`]:
https://rust-lang.github.io/rust-clippy/master/index.html#filter_some
This proposes replacing calls to `.truncate(0)` for types in the
standard library by `.clear()`, as the specialized version might be more
efficient.
Update `askama` version to `0.16.0`

New features and bugfixes. Full changelog is [here](https://github.com/askama-rs/askama/releases/tag/v0.16.0).

r? @Urgau
This PR prepares the clippy testsuite to work with the new Cargo
`build-dir` layout tracked in
rust-lang/cargo#16807.

Context: In rust-lang#155439 we attempt to
enable the new Cargo `build-dir` layout in rust-lang/rust and I am
working through all of the build failures caused by changing where the
files are.

Also note that the `ui_test` crate was bumped to include the
corresponding fix in oli-obk/ui_test#368

With the changes in this PR the following test passes on my system.
```sh
CARGO_UNSTABLE_BUILD_DIR_NEW_LAYOUT=true ./x test --stage 2 src/tools/clippy
```

changelog: none
fix: peeling of block.

test: supply corner case tests of implicit_return.

fix: pass body.value rather than block.expr.

fix: special checking for implicit_return.

fix: suggestion.

refactor: flatten the code structure.

refactor: remove lint submission in helper.

refactor: call is_lint_allowed when necessary.
…rn` (rust-lang#16949)

*[View all
comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/16949)*

changelog: fix [`non_canonical_clone_impl`] incompatibility with
[`implicit_return`]

Fixes rust-lang/rust-clippy#16945

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_CONCERN-ISSUE_START -->

> [!NOTE]
> # Concerns (0 active)
>
> - ~~[Using `return *self` is not the canonical implementation of
`Clone`](rust-lang/rust-clippy#16949 (comment)
resolved in [this
comment](rust-lang/rust-clippy#16949 (review))
>
> *Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/concern.html) for details.*

<!-- TRIAGEBOT_CONCERN-ISSUE_END -->
<!-- TRIAGEBOT_END -->
This proposes replacing calls to `.truncate(0)` for types in the
standard library by `.clear()`, as the specialized version might be more
efficient.

changelog: [`manual_clear`]: new lint

Closes rust-lang/rust-clippy#16615
@rustbot rustbot added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels May 13, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 13, 2026

📌 Commit be6fdee has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 13, 2026
@rust-bors rust-bors Bot mentioned this pull request May 13, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request May 13, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #156552 (Clippy subtree update)
 - #156344 (Do not index past end of buffer when checking heuristic in error index syntax highlighter)
 - #156500 (Privacy: move macros handling to early stage)
 - #156260 (test: suppress deprecation warning)
 - #156413 (rustdoc: Correctness & perf improvements to link-to-definition)
 - #156539 (Add `ChildExt::kill_process_group`)
 - #156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test expr_store::scope::tests::test_resolve_local_name_shadow ... ok
test expr_store::tests::body::array_element_cfg ... ok
test expr_store::tests::body::async_fn_weird_param_patterns ... ok
test expr_store::tests::body::block::inner_item_smoke ... ok
error: test failed, to rerun pass `-p hir-def --lib`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/hir_def-f381e8bd2208ec8b '--skip=tests::smoke_test_real_sysroot_cargo' --skip=check_code_formatting -Z unstable-options --format json` (signal: 11, SIGSEGV: invalid memory reference)
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Build completed unsuccessfully in 1:06:41
  local time: Wed May 13 23:49:14 UTC 2026
  network time: Wed, 13 May 2026 23:49:14 GMT
##[error]Process completed with exit code 1.

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 13, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 13, 2026

💔 Test for c0fe90e failed: CI. Failed job:

@jieyouxu
Copy link
Copy Markdown
Member

Test failure looks like #156460
@bors retry

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 14, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 14, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 14, 2026

☀️ Test successful - CI
Approved by: JonathanBrouwer
Duration: 3h 20m 57s
Pushing c85af1c to main...

@rust-bors rust-bors Bot merged commit c85af1c into rust-lang:main May 14, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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 ff9a9ea (parent) -> c85af1c (this PR)

Test differences

Show 38 test diffs

Stage 1

  • [rustdoc-html] tests/rustdoc-html/jump-to-def/assoc-items-extra.rs: [missing] -> pass (J0)
  • [rustdoc-html] tests/rustdoc-html/jump-to-def/assoc-types.rs: pass -> [missing] (J0)
  • [rustdoc-html] tests/rustdoc-html/jump-to-def/no-body-items.rs: pass -> [missing] (J0)
  • [ui] tests/rustdoc-ui/generate-link-to-definition/anon-consts.rs: [missing] -> pass (J0)
  • [ui] tests/rustdoc-ui/generate-link-to-definition/items-nested-in-bodies.rs: [missing] -> pass (J0)
  • [ui] tests/ui/explain/explanation-code-rendering-edge-case-regression.rs: [missing] -> pass (J0)

Stage 2

  • [rustdoc-html] tests/rustdoc-html/jump-to-def/assoc-items-extra.rs: [missing] -> pass (J1)
  • [rustdoc-html] tests/rustdoc-html/jump-to-def/assoc-types.rs: pass -> [missing] (J1)
  • [rustdoc-html] tests/rustdoc-html/jump-to-def/no-body-items.rs: pass -> [missing] (J1)
  • [ui] tests/rustdoc-ui/generate-link-to-definition/anon-consts.rs: [missing] -> pass (J1)
  • [ui] tests/rustdoc-ui/generate-link-to-definition/items-nested-in-bodies.rs: [missing] -> pass (J1)
  • [ui] tests/ui/explain/explanation-code-rendering-edge-case-regression.rs: [missing] -> pass (J2)

Additionally, 26 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard c85af1c5ed4187d9900d08a2ddee8b672b13fc27 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-rust-for-linux: 35m 42s -> 55m (+54.0%)
  2. dist-various-1: 1h 37m -> 1h (-38.2%)
  3. x86_64-msvc-2: 2h 2m -> 2h 37m (+28.8%)
  4. pr-check-1: 26m 38s -> 33m 8s (+24.4%)
  5. dist-x86_64-apple: 2h 24m -> 1h 49m (-23.7%)
  6. dist-x86_64-llvm-mingw: 2h 25m -> 1h 50m (-23.6%)
  7. dist-x86_64-freebsd: 1h 14m -> 1h 31m (+22.5%)
  8. dist-powerpc64-linux-musl: 1h 37m -> 1h 16m (-21.2%)
  9. aarch64-gnu-llvm-21-2: 47m -> 53m 55s (+14.7%)
  10. optional-x86_64-gnu-parallel-frontend: 2h 25m -> 2h 45m (+13.7%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#155023 Introduce move expressions (move($expr)) ❌ conflicts merging 'ebc91206e3' into previous master ❌
#155433 Rip out rustc_layout_scalar_valid_range_* attribute support ❌ conflicts merging '3e0e895568' into previous master ❌
#156065 Remove unused spans from AttributeKind ❌ conflicts merging '00cb5cb330' into previous master ❌
#156074 Add extra symbol check for .to_owned() ❌ conflicts merging '0c4849ec07' into previous master ❌
#156127 Update askama version to 0.16.0 ❌ conflicts merging '21487c13a2' into previous master ❌
#156260 test: suppress deprecation warning 47a4cc2138b07b4c366dd35de20a0d76ac1910f9 (link)
#156344 Do not index past end of buffer when checking heuristic in … d9a02e51e27f97ebf57fd4f426f95b24061a9456 (link)
#156413 rustdoc: Correctness & perf improvements to link-to-definit… 30df1af431293309f75d850b5c85e895613c3cb1 (link)
#156500 Privacy: move macros handling to early stage 6e4cc7a0b7725f3743e640af6b57138b4a8ea7a7 (link)
#156539 Add ChildExt::kill_process_group ceadb6a730d435d0c5915bedf74281119e360bf0 (link)
#156540 use deref_patterns in rustdoc instead of box_patterns a093e2a2f89ffe553d5e99c6eb80f69f7db1004a (link)
#156552 Clippy subtree update a0ab42f45ac7663229fd172871084891b93f038b (link)

previous master: ff9a9ea07b

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (c85af1c): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.1% [0.1%, 0.1%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.2%, -0.0%] 5
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -4.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.3% [-9.3%, -0.6%] 3
All ❌✅ (primary) - - 0

Cycles

Results (secondary -1.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.4% [4.4%, 4.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.7% [-5.2%, -2.8%] 3
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 511.173s -> 515.921s (0.93%)
Artifact size: 398.06 MiB -> 400.07 MiB (0.50%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-json Area: Rustdoc JSON backend merged-by-bors This PR was explicitly merged by bors. O-unix Operating system: Unix-like rollup A PR which is a rollup T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.