Skip to content
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

Explain the internal #[rustc_*] TEST attributes used for debugging and inside tests #2046

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add section about rustc_* TEST attrs to UI test chapter
  • Loading branch information
fmease committed Aug 22, 2024
commit e7396aa3b1b4cafb2695c4ae93a8695da1c45d72
13 changes: 13 additions & 0 deletions src/tests/ui.md
Original file line number Diff line number Diff line change
@@ -530,3 +530,16 @@ run something like the following to generate the alternate stderr file:
```

Currently none of the compare modes are checked in CI for UI tests.

## `rustc_*` TEST attributes

The compiler defines several perma-unstable `#[rustc_*]` attributes gated behind the internal feature
`rustc_attrs` that dump extra compiler-internal information. See the analogous subsection in
[compiler debugging] for more details.

They can be used in tests to more precisely, legibly and easily test internal compiler state in cases
where it would otherwise be very hard to do the same with "user-facing" Rust alone. Indeed, one could
say that this slightly abuses the term "UI" (*user* interfacing) and turns such UI tests from black-box
tests into white-box ones. Use them carefully and sparingly.

[compiler debugging]: ../compiler-debugging.md#rustc_-attributes