Skip to content

Add a regression test for trailing attributes in doctests - #162386

Open
JonathanBrouwer wants to merge 1 commit into
rust-lang:mainfrom
JonathanBrouwer:doctest-attribute
Open

Add a regression test for trailing attributes in doctests#162386
JonathanBrouwer wants to merge 1 commit into
rust-lang:mainfrom
JonathanBrouwer:doctest-attribute

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Adds a regression test for #162131 and #162129

It seems likely this breakage is going to be accepted, so let's add a test in nightly so we can at least track this behavior in the feature

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 6, 2026
@rustbot

rustbot commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

r? @lolbinarycat

rustbot has assigned @lolbinarycat.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: rustdoc
  • rustdoc expanded to 8 candidates
  • Random selection from GuillaumeGomez, lolbinarycat, notriddle

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@mejrs

mejrs commented Sep 7, 2026

Copy link
Copy Markdown
Member

#162352 #162352 have some more variants of this, can you add these as well?

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-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)
To only update this specific test, also pass `--test-args expect-item-after-attribute.rs`

error: 1 errors occurred comparing output.
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustdoc" "/checkout/tests/rustdoc-ui/expect-item-after-attribute.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-o" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/rustdoc-ui/expect-item-after-attribute" "-Znext-solver=coherence" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Cdebuginfo=0" "--test" "--test-args=--test-threads=1"
--- stdout -------------------------------

running 5 tests
test /checkout/tests/rustdoc-ui/expect-item-after-attribute.rs - (line 12) ... FAILED
test /checkout/tests/rustdoc-ui/expect-item-after-attribute.rs - (line 16) ... FAILED
---
---- /checkout/tests/rustdoc-ui/expect-item-after-attribute.rs - (line 19) stdout ----
error: expected item, found keyword `let`
##[error]  --> /checkout/tests/rustdoc-ui/expect-item-after-attribute.rs:20:1
   |
LL | let x = 0; //! assert!(true);
   | ^^^
   | |
   | `let` cannot be used for global variables
   | help: consider using `static` or `const` instead of `let`
   |

@JonathanBrouwer

JonathanBrouwer commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

I will fight CI & include the testcases mejrs linked
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

5 participants