Skip to content

Rollup of 7 pull requests #145319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Aug 12, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

lolbinarycat and others added 20 commits August 8, 2025 11:15
…taining interpolated tokens

Co-authored-by: Jana Dönszelmann <[email protected]>
This is a documentation-only deprecation for now.
Over time, we can
- warn and then remove on use of unstable environment variables
- warn on use of stable environment variables (no plan to remove due to
  compatibility)

Longer term, we expect test runners, like `cargo test`, to provide the
necessary mechanisms for environmental or persistent configuration (e.g.
using cargo config which supports `.cargo/config.toml` as well as
environment variables).

This would include:
- `RUST_TEST_THREADS`
- `RUST_TEST_NOCAPTURE`
- `RUST_TEST_SHUFFLE` (unstable)
- `RUST_TEST_SHUFFLE_SEED` (unstable)

The primary outcomes for this change are
- Reducing the scope of what is expected for custom test harnesses to
  implement
- Reduce the mechanisms that test runners, like `cargo test`, are
  expected to track when they are being bypassed to protect against
  negative interactions, e.g.  `RUST_TEST_NOCAPTURE=1` when json output
  is being read.
chore(ci): upgrade checkout to v5
…e kind

Review everything that uses `MacroKind`, and switch anything that could
refer to more than one kind to use `MacroKinds`.

Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros,
using the concrete `MacroRulesMacroExpander` type, and have it track
which kinds it can handle. Eliminate the separate optional `attr_ext`,
now that a `SyntaxExtension` can handle multiple macro kinds.

This also avoids the need to downcast when calling methods on
`MacroRulesMacroExpander`, such as `get_unused_rule`.

Integrate macro kind checking into name resolution's
`sub_namespace_match`, so that we only find a macro if it's the right
type, and eliminate the special-case hack for attributes.
I discovered this via research through the git log, and I want to leave
additional guidance for future macro spelunkers.
This eliminates the case in `failed_to_match_macro` to check for a
function-like invocation of a macro with no function-like rules.

Instead, macro kind mismatches now result in an unresolved macro, and we
detect this case in `unresolved_macro_suggestions`, which now carefully
distinguishes between a kind mismatch and other errors.

This also handles cases of forward-referenced attributes and cyclic
attributes.

Expand test coverage to include all of these cases.
The use of `Not` to describe the `!` in `macro_rules!` reads
confusingly, and also results in search collisions with the diagnostic
structure `MacroRulesNot` elsewhere in the compiler. Rename it to use
the more conventional `Bang` for `!`.
This updates two clippy lints which had exceptions for `MacroKind::Bang`
macros to extend those exceptions to any macro, now that a macro_rules
macro can be any kind of macro.
This makes the minimal fixes necessary for rustdoc to compile and pass
existing tests with the switch to `MacroKinds`. It only works for macros
that don't actually have multiple kinds, and will panic (with a `todo!`)
if it encounters a macro with multiple kinds.

rustdoc needs further fixes to handle macros with multiple kinds, and to
handle attributes and derive macros that aren't proc macros.
…ake, r=lcnr

editorconfig: don't trim trailing whitespace in tests

some test snapshot files require trailing whitespace, and previously manually editing those snapshot files (as is required for run-make tests and some platform-specific tests) in an editor with editorconfig support would cause that whitespace to be removed, [causing CI failures like this one](rust-lang#144596 (comment))
…s, r=BoxyUwU

search graph: lazily update parent goals

Based on top of rust-lang#143054. In the search graph only the last entry is actually mutable and all other entries get lazily mutated when popping child goals.

This simplifies a bunch of possible future optimizations:
- We can try evaluating nested goals and entirely ignore discard their evaluation by simply not calling `fn update_parent_goal`
- Because we only lazily update, tracking the "impact" of a nested goal is easy. The necessary information *has to be* integrated in the `StackEntry` of the current goal, as there is otherwise no way to influence its parents. This makes it easier to avoid rerunning cycle heads if they have only been used in candidates which don't impact the final result of a goal.

r? ````@compiler-errors```` ````@BoxyUwU````
…=petrochenkov

Handle macros with multiple kinds, and improve errors

(I recommend reviewing this commit-by-commit.)

Switch to a bitflags `MacroKinds` to support macros with more than one kind

Review everything that uses `MacroKind`, and switch anything that could refer to more than one kind to use `MacroKinds`.

Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros, using the concrete `MacroRulesMacroExpander` type, and have it track which kinds it can handle. Eliminate the separate optional `attr_ext`, now that a `SyntaxExtension` can handle multiple macro kinds.

This also avoids the need to downcast when calling methods on `MacroRulesMacroExpander`, such as `get_unused_rule`.

Integrate macro kind checking into name resolution's `sub_namespace_match`, so that we only find a macro if it's the right type, and eliminate the special-case hack for attributes.

This allows detecting and report macro kind mismatches early, and more precisely, improving various error messages. In particular, this eliminates the case in `failed_to_match_macro` to check for a function-like invocation of a macro with no function-like rules.

Instead, macro kind mismatches now result in an unresolved macro, and we detect this case in `unresolved_macro_suggestions`, which now carefully distinguishes between a kind mismatch and other errors.

This also handles cases of forward-referenced attributes and cyclic attributes.

----

In this PR, I've minimally fixed up `rustdoc` so that it compiles and passes tests. This is just the minimal necessary fixes to handle the switch to `MacroKinds`, and it only works for macros that don't actually have multiple kinds. This will panic (with a `todo!`) if it encounters a macro with multiple kinds.

rustdoc needs further fixes to handle macros with multiple kinds, and to handle attributes and derive macros that aren't proc macros. I'd appreciate some help from a rustdoc expert on that.

----

r? ```@petrochenkov```
…, r=jdonszelmann

Add regression test for former ICE involving malformed meta items containing interpolated tokens

Add regression test for rust-lang#140612 from rust-lang#140601 or rather rust-lang#140859 that only added it to `stable` not `master`.
Supersedes rust-lang#140584.

r? ````@jdonszelmann```` or anyone
Deprecate RUST_TEST_* env variables

Like with rust-lang#139224, this is a documentation-only deprecation for now. Over time, we can
- warn and then remove on use of unstable environment variables
- warn on use of stable environment variables (no plan to remove due to compatibility)

Longer term, we expect test runners, like `cargo test`, to provide the necessary mechanisms for environmental or persistent configuration (e.g. using cargo config which supports `.cargo/config.toml` as well as environment variables).

This would include:
- `RUST_TEST_THREADS`
- `RUST_TEST_NOCAPTURE`
- `RUST_TEST_SHUFFLE` (unstable)
- `RUST_TEST_SHUFFLE_SEED` (unstable)

The primary outcomes for this change are
- Reducing the scope of what is expected for custom test harnesses to implement
- Reduce the mechanisms that test runners, like `cargo test`, are expected to track when they are being bypassed to protect against negative interactions, e.g.  `RUST_TEST_NOCAPTURE=1` when json output is being read.

For testing-devex FCP, see rust-lang/testing-devex-team#10

Fixes rust-lang/testing-devex-team#10

History
-------

At each step, I could not find evidence of design discussions on whether to support CLI, env, or both.  The first env variable seems to come from the fact that it was being forked out of an existing env variable that had a much wider scope.

At best, this seems like a way to offer a more persistent configuration for these flags but environment variables hidden away in libtest is a bit clunky and this seems like the wrong layer to handle this problem.

**Originally:** `RUST_THREADS` was respected by the Rust runtime and libextra/test got this for free

**2013:** rust-lang#7335 suggested splitting `RUST_TEST_TASKS` out of `RUST_THREADS`.  In that issue and the implementation (rust-lang#8823).

**2014:** rust-lang#13374 ask for support to disable capturing of stdout/stderr.  `--nocapture` and `RUST_TEST_NOCAPTURE` were added together.

**2015:** rust-lang#23525 renamed `RUST_TEST_TASKS` to `RUST_TEST_THREADS`

**2016:** rust-lang#25636 asked to configure `RUST_TEST_THREADS` via `--test-threads` which was implemented in rust-lang#35414

**2021:** rust-lang#85440 asked for test randomization which was implemented in rust-lang#89082, adding `--shuffle` / RUST_TEST_SHUFFLE` and `--shuffle-seed SEED` / `RUST_TEST_SHUFFLE_SEED`

Potentially relevant issues
---------------------------

- rust-lang#74845
chore(ci): upgrade checkout to v5

Maintenance update to actions/checkout@v5 to align with the current runner stack (Node 24); nothing else modified.

Release notes: https://github.com/actions/checkout/releases/tag/v5.0.0
Docs: Link to payload_as_str() from payload().
@rustbot rustbot added A-CI Area: Our Github Actions CI A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure 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. labels Aug 12, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Aug 12, 2025

@bors r+ rollup=never p=5

@rustbot rustbot added the rollup A PR which is a rollup label Aug 12, 2025
@bors
Copy link
Collaborator

bors commented Aug 12, 2025

📌 Commit 0d88b94 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors 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 Aug 12, 2025
@bors
Copy link
Collaborator

bors commented Aug 12, 2025

⌛ Testing commit 0d88b94 with merge e0125ac...

bors added a commit that referenced this pull request Aug 12, 2025
Rollup of 7 pull requests

Successful merges:

 - #144642 (editorconfig: don't trim trailing whitespace in tests)
 - #144955 (search graph: lazily update parent goals)
 - #145153 (Handle macros with multiple kinds, and improve errors)
 - #145250 (Add regression test for former ICE involving malformed meta items containing interpolated tokens)
 - #145269 (Deprecate RUST_TEST_* env variables)
 - #145289 (chore(ci): upgrade checkout to v5)
 - #145303 (Docs: Link to payload_as_str() from payload().)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#13 DONE 31.3s

#14 [ 6/23] RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
#14 0.170 Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
#14 0.187 Executing: /tmp/apt-key-gpghome.VC8rORVIyb/gpg.1.sh --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
#14 0.807 gpg: key 74DA7924C5513486: public key "Igor Kozhukhov <[email protected]>" imported
#14 0.811 gpg: Total number processed: 1
#14 0.811 gpg:               imported: 1
#14 DONE 0.9s

---
 94 33.5M   94 31.6M    0     0  30564      0  0:19:12  0:18:05  0:01:07 48105
 94 33.5M   94 31.6M    0     0  30573      0  0:19:12  0:18:06  0:01:06 42362
 94 33.5M   94 31.7M    0     0  30589      0  0:19:11  0:18:07  0:01:04 42139
 94 33.5M   94 31.7M    0     0  30593      0  0:19:11  0:18:08  0:01:03 43392
#27 1088.1 curl: (56) OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0
#27 1088.1 
#27 1088.1 bzip2: Compressed file ends unexpectedly;
#27 1088.1  perhaps it is corrupted?  *Possible* reason follows.
#27 1088.1 bzip2: Inappropriate ioctl for device
#27 1088.1  Input file = (stdin), output file = (stdout)
#27 1088.1 
#27 1088.1 It is possible that the compressed file(s) have become corrupted.
#27 1088.1 You can use the -tvv option to test integrity of such files.
#27 1088.1 
#27 1088.1 You can use the `bzip2recover' program to attempt to recover
#27 1088.1 data from undamaged sections of corrupted files.
#27 1088.1 
#27 1088.1 tar: Unexpected EOF in archive
#27 1088.1 tar: Unexpected EOF in archive
#27 1088.1 tar: Error is not recoverable: exiting now
#27 ERROR: process "/bin/sh -c /tmp/freebsd-toolchain.sh i686" did not complete successfully: exit code: 2
------
 > [19/23] RUN /tmp/freebsd-toolchain.sh i686:
1088.1 
1088.1 It is possible that the compressed file(s) have become corrupted.
1088.1 You can use the -tvv option to test integrity of such files.
1088.1 
1088.1 You can use the `bzip2recover' program to attempt to recover
1088.1 data from undamaged sections of corrupted files.
1088.1 
1088.1 tar: Unexpected EOF in archive
1088.1 tar: Unexpected EOF in archive
1088.1 tar: Error is not recoverable: exiting now
------
---
 14 33.5M   14 5093k    0     0  31588      0  0:18:35  0:02:45  0:15:50 42865
 15 33.5M   15 5179k    0     0  31927      0  0:18:23  0:02:46  0:15:37 49779
 15 33.5M   15 5296k    0     0  32458      0  0:18:05  0:02:47  0:15:18 70273
 15 33.5M   15 5327k    0     0  32614      0  0:18:00  0:02:47  0:15:13 81751
#26 167.3 curl: (56) OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0
#26 167.3 
#26 167.3 bzip2: Compressed file ends unexpectedly;
#26 167.3  perhaps it is corrupted?  *Possible* reason follows.
#26 167.3 bzip2: Inappropriate ioctl for device
#26 167.3  Input file = (stdin), output file = (stdout)
#26 167.3 
#26 167.3 It is possible that the compressed file(s) have become corrupted.
#26 167.3 You can use the -tvv option to test integrity of such files.
#26 167.3 
#26 167.3 You can use the `bzip2recover' program to attempt to recover
#26 167.3 data from undamaged sections of corrupted files.
#26 167.3 
#26 167.3 tar: Unexpected EOF in archive
#26 167.3 tar: Unexpected EOF in archive
#26 167.3 tar: Error is not recoverable: exiting now
#26 ERROR: process "/bin/sh -c /tmp/freebsd-toolchain.sh i686" did not complete successfully: exit code: 2
------
 > [19/23] RUN /tmp/freebsd-toolchain.sh i686:
167.3 
167.3 It is possible that the compressed file(s) have become corrupted.
167.3 You can use the -tvv option to test integrity of such files.
167.3 
167.3 You can use the `bzip2recover' program to attempt to recover
167.3 data from undamaged sections of corrupted files.
167.3 
167.3 tar: Unexpected EOF in archive
167.3 tar: Unexpected EOF in archive
167.3 tar: Error is not recoverable: exiting now
------
---
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
#25 1.676 curl: (7) Failed to connect to ftp.gnu.org port 443 after 1623 ms: Network is unreachable
#25 1.677 
#25 1.677 bzip2: Compressed file ends unexpectedly;
#25 1.677  perhaps it is corrupted?  *Possible* reason follows.
#25 1.677 bzip2: Inappropriate ioctl for device
#25 1.677  Input file = (stdin), output file = (stdout)
#25 1.677 
#25 1.677 It is possible that the compressed file(s) have become corrupted.
#25 1.677 You can use the -tvv option to test integrity of such files.
#25 1.677 
#25 1.677 You can use the `bzip2recover' program to attempt to recover
#25 1.677 data from undamaged sections of corrupted files.
#25 1.677 
#25 1.678 tar: Child returned status 2
#25 1.678 tar: Error is not recoverable: exiting now
#25 ERROR: process "/bin/sh -c /tmp/freebsd-toolchain.sh i686" did not complete successfully: exit code: 2
------
 > [19/23] RUN /tmp/freebsd-toolchain.sh i686:
1.677  Input file = (stdin), output file = (stdout)
1.677 
1.677 It is possible that the compressed file(s) have become corrupted.
1.677 You can use the -tvv option to test integrity of such files.
1.677 
1.677 You can use the `bzip2recover' program to attempt to recover
1.677 data from undamaged sections of corrupted files.
1.677 
1.678 tar: Child returned status 2
1.678 tar: Error is not recoverable: exiting now
------

---
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
#24 1.233 curl: (7) Failed to connect to ftp.gnu.org port 443 after 1180 ms: Network is unreachable
#24 1.234 
#24 1.234 bzip2: Compressed file ends unexpectedly;
#24 1.234  perhaps it is corrupted?  *Possible* reason follows.
#24 1.234 bzip2: Inappropriate ioctl for device
#24 1.234  Input file = (stdin), output file = (stdout)
#24 1.234 
#24 1.234 It is possible that the compressed file(s) have become corrupted.
#24 1.234 You can use the -tvv option to test integrity of such files.
#24 1.234 
#24 1.234 You can use the `bzip2recover' program to attempt to recover
#24 1.234 data from undamaged sections of corrupted files.
#24 1.234 
#24 1.235 tar: Child returned status 2
#24 1.235 tar: Error is not recoverable: exiting now
#24 ERROR: process "/bin/sh -c /tmp/freebsd-toolchain.sh i686" did not complete successfully: exit code: 2
------
 > [19/23] RUN /tmp/freebsd-toolchain.sh i686:
1.234  Input file = (stdin), output file = (stdout)
1.234 
1.234 It is possible that the compressed file(s) have become corrupted.
1.234 You can use the -tvv option to test integrity of such files.
1.234 
1.234 You can use the `bzip2recover' program to attempt to recover
1.234 data from undamaged sections of corrupted files.
1.234 
1.235 tar: Child returned status 2
1.235 tar: Error is not recoverable: exiting now
------

---
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
#24 1.385 curl: (7) Failed to connect to ftp.gnu.org port 443 after 1318 ms: Network is unreachable
#24 1.386 
#24 1.386 bzip2: Compressed file ends unexpectedly;
#24 1.386  perhaps it is corrupted?  *Possible* reason follows.
#24 1.386 bzip2: Inappropriate ioctl for device
#24 1.386  Input file = (stdin), output file = (stdout)
#24 1.386 
#24 1.386 It is possible that the compressed file(s) have become corrupted.
#24 1.386 You can use the -tvv option to test integrity of such files.
#24 1.386 
#24 1.386 You can use the `bzip2recover' program to attempt to recover
#24 1.386 data from undamaged sections of corrupted files.
#24 1.386 
#24 1.387 tar: Child returned status 2
#24 1.387 tar: Error is not recoverable: exiting now
#24 ERROR: process "/bin/sh -c /tmp/freebsd-toolchain.sh i686" did not complete successfully: exit code: 2
------
 > [19/23] RUN /tmp/freebsd-toolchain.sh i686:
1.386  Input file = (stdin), output file = (stdout)
1.386 
1.386 It is possible that the compressed file(s) have become corrupted.
1.386 You can use the -tvv option to test integrity of such files.
1.386 
1.386 You can use the `bzip2recover' program to attempt to recover
1.386 data from undamaged sections of corrupted files.
1.386 
1.387 tar: Child returned status 2
1.387 tar: Error is not recoverable: exiting now
------

@bors
Copy link
Collaborator

bors commented Aug 12, 2025

💔 Test failed - checks-actions

@bors bors 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 Aug 12, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Aug 12, 2025

presumably that is spurious

@bors retry

@bors bors 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 Aug 12, 2025
@bors
Copy link
Collaborator

bors commented Aug 13, 2025

⌛ Testing commit 0d88b94 with merge 87f770e...

bors added a commit that referenced this pull request Aug 13, 2025
Rollup of 7 pull requests

Successful merges:

 - #144642 (editorconfig: don't trim trailing whitespace in tests)
 - #144955 (search graph: lazily update parent goals)
 - #145153 (Handle macros with multiple kinds, and improve errors)
 - #145250 (Add regression test for former ICE involving malformed meta items containing interpolated tokens)
 - #145269 (Deprecate RUST_TEST_* env variables)
 - #145289 (chore(ci): upgrade checkout to v5)
 - #145303 (Docs: Link to payload_as_str() from payload().)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Aug 13, 2025

💔 Test failed - checks-actions

@bors bors 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 Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CI Area: Our Github Actions CI A-meta Area: Issues & PRs about the rust-lang/rust repository itself rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.