Skip to content

[DO NOT MERGE] Test fix for subtree sync - #165409

Closed
jieyouxu wants to merge 66 commits into
rust-lang:mainfrom
jieyouxu:jieyouxu/exp/rustfmt-builtin-syntax
Closed

jieyouxu wants to merge 66 commits into
rust-lang:mainfrom
jieyouxu:jieyouxu/exp/rustfmt-builtin-syntax

Conversation

@jieyouxu

@jieyouxu jieyouxu commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

For #165378 to accomodate #162232 changes.

Only last commit is relevant, this PR has cherry-picked commits from #162232.

matthewhughes934 and others added 30 commits October 21, 2026 19:41
The main thing here is to be more explicit on assertions: e.g. to answer
are we expecting something to be printed to stdout or stderr?

I thought about rewriting the existing macro to handle this case too,
but couldn't find a good approach for that, and decided that the
plain code, while more lines, was more readable.
Firstly, Simplify the directory structure: we only need a single package here,
so drag everything up for that. Secondly, make it more explicit exactly
which config we expect to read by setting up configs with different
options, rather than just ignoring all formatting.

Also add tests for other existing behaviour: searching in `HOME` and
`XDG_CONFIG_HOME` when no config is given nor found.
So we can assert that `rustfmt` exits how we expect.
Allow `llm-assisted` label to be set by users without write access
I.e. do not try to use `{{ ... }}` concise double-block formatting if
there are comments in-between the outer/inner braces.
…omments

Don't lose comments and attributes between `cfg_select!` predicates, outer/inner blocks, arm body and trailing commas
Based on rustfmt issue 7215 it seems that we missed handling different kinds of
string literals. Before trying to address that issue I thought it would be best
if we refactored the match to be exhaustive.
…ontrol-brace-style

Have `cfg_select!` double-brace concise formatting respect `control_brace_style`
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. labels Nov 3, 2026
@jieyouxu

jieyouxu commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

@bors try jobs=test-x86_64-gnu-tools

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 3, 2026
… r=<try>

[DO NOT MERGE] Test fix for subtree sync


try-job: test-x86_64-gnu-tools
This is failing when we combine:

1. Actually checking exit code for `dont_emit_ICE`, and
2. rust-lang#162232 removing `builtin_syntax` `builtin #` (all
   editions) in favor of keyword prefixes `k#` as part of
   `forced_keywords`.

Cause is simple:

1. `dont_emit_ICE` checks exit code.
2. One of the listed tests, `tests/target/issue_6159.rs` was previously
   using `builtin #` syntax which is parsed on all editions, including
   default 2015 edition.
3. rust-lang#162232 switched that test over to use `k#` reserved
   keyword syntax which is only Edition 2021+. Note the UI test actually
   get `//@ rustfmt-edition: 2021`.
4. `dont_emit_ICE` as an integration test does not set `--edition`
   explicitly, so Edition 2015 is used.
5. Now `issue_6159.rs` will not ICE but will fail to parse since it's on
   Edition 2015 not Edition 2021+.

To fix it, just run rustfmt with `--edition=2021` for `issue_6159.rs` in
`dont_emit_ICE` as well.

Relevant links:

- `builtin_syntax`: <rust-lang#110694>
- MCP for switching to Edition 2021+ `k#` reserved keyword prefixes: <rust-lang/compiler-team#945>
- Tracking issue for `forced_keywords`: <rust-lang#153839>
- Impl of `forced_keywords`: rust-lang#161775
- Impl of MCP that also modified rustfmt tests to use `forced_keywords`: <rust-lang#162232>.
@jieyouxu
jieyouxu force-pushed the jieyouxu/exp/rustfmt-builtin-syntax branch from 5676e60 to 6da7b55 Compare November 3, 2026 14:34
@rust-bors

rust-bors Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a2bc622 (a2bc622e7c525fd504f7c2f61ef4aac3b6f0e192)
Base parent: 6a98084 (6a98084e4a21b04504c034dfc640e35e32ab9854)

@fmease

fmease commented Nov 3, 2026

Copy link
Copy Markdown
Member

The relevant commit has now been cherry-picked into #162232.

@jieyouxu jieyouxu closed this Nov 4, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 4, 2026
@jieyouxu
jieyouxu deleted the jieyouxu/exp/rustfmt-builtin-syntax branch November 4, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants