Skip to content

Commit

Permalink
Add section about rustc_* TEST attrs to UI test chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
fmease committed Aug 22, 2024
1 parent fa362ad commit e7396aa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/tests/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e7396aa

Please sign in to comment.