Skip to content

Commit 2249d06

Browse files
authored
Merge pull request #1441 from jieyouxu/tmioti-nov-2024
This Month in Our Test Infra (Nov 2024 issue)
2 parents 9793316 + 54a2e6b commit 2249d06

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
layout: post
3+
title: "This Month in Our Test Infra: November 2024"
4+
author: Jieyou Xu
5+
team: the Bootstrap Team <https://www.rust-lang.org/governance/teams/infra#team-bootstrap>
6+
---
7+
8+
# This Month in Our Test Infra: November 2024
9+
10+
<!-- time period: 2024-11-05 through 2024-12-03 -->
11+
12+
This is a quick summary of the changes in the test infrastructure for the
13+
[rust-lang/rust][r-l/r] repository[^scope] for **November 2024**. It also
14+
includes brief descriptions of on-going work.
15+
16+
[^scope]: The test infra here refers to the test harness [compiletest] and
17+
supporting components in our build system [bootstrap]. This test infra is used
18+
mainly by rustc and rustdoc. Other tools like cargo, miri or rustfmt maintain
19+
their own test infra.
20+
21+
As usual, if you encounter bugs or UX issues when using our test infrastructure,
22+
please [file an issue][new-issue]. Bugs and papercuts can't be fixed if we don't
23+
know about them!
24+
25+
**Thanks to everyone who contributed to our test infra!**
26+
27+
## Highlights
28+
29+
### compiletest: Add `proc-macro` auxiliary build directive
30+
31+
[@ehuss](https://github.com/ehuss) added a `//@ proc-macro` directive that
32+
behaves like `//@ aux-build`, but it packages the usual `//@ force-host` and
33+
`//@ no-prefer-dynamic` boilerplate that previously was needed by proc-macro
34+
auxiliaries. If the main test file also uses a sufficiently new edition (i.e.
35+
Edition 2018 onwards), the proc-macro auxiliary is also made available via
36+
extern prelude.
37+
38+
**Before**: test writer need to write `//@ force-host` and `//@
39+
no-prefer-dynamic` for each and every proc-macro auxiliary.
40+
41+
```rs
42+
// tests/ui/foo/my-main-test.rs
43+
//@ aux-build: my-proc-macro.rs
44+
```
45+
46+
```rs
47+
// tests/ui/foo/auxiliary/my-proc-macro.rs
48+
//@ no-prefer-dynamic
49+
//@ force-host
50+
```
51+
52+
**After**: only `//@ proc-macro` directive is needed in main test file.
53+
54+
```rs
55+
// tests/ui/foo/my-main-test.rs
56+
//@ proc-macro: my-proc-macro.rs
57+
```
58+
59+
```rs
60+
// tests/ui/foo/auxiliary/my-proc-macro.rs
61+
```
62+
63+
Thanks Eric!
64+
65+
### rustc: make `rustc` consider itself a stable compiler when `RUSTC_BOOTSTRAP=-1` is set
66+
67+
In [#132993](https://github.com/rust-lang/rust/pull/132993), I modified
68+
`rustc`'s stability checking logic to also now recognize `RUSTC_BOOTSTRAP=-1` to
69+
force any `rustc` to consider itself a stable compiler, regardless of which
70+
channel it is from (e.g. beta or dev or nightly or stable)[^disclaimer]. This is
71+
useful for e.g. diagnostics that differ between nightly and stable, and also
72+
provides a way to make the `rustc` under test behave *as if* it was a stable
73+
compiler.
74+
75+
[^disclaimer]: This is *only* for internal testing usages. Anything else that
76+
relies on this that breaks will be considered PEBKAC.
77+
78+
In tests, the `//@ rustc-env` directive may be used with
79+
`RUSTC_BOOTSTRAP=-1`[^known-bug].
80+
81+
[^known-bug]: The `//@ rustc-env` directive handling has a bug where it's
82+
white-space sensitive between the colon and the value, so avoid whitespace
83+
for now.
84+
85+
```rs
86+
//@ rustc-env:RUSTC_BOOTSTRAP=-1
87+
//@ compile-flags: -Z unstable-options
88+
//@ regex-error-pattern: error: the option `Z` is only accepted on the nightly compiler
89+
// This will fail because the `rustc` under test rejects the `-Z unstable-options` unstable flag.
90+
```
91+
92+
## PR listing
93+
94+
### Improvements
95+
96+
- [compiletest]:
97+
- [Add `{ignore,needs}-{rustc,std}-debug-assertions` directive support #131913](https://github.com/rust-lang/rust/pull/131913).
98+
- [Add `max-llvm-major-version` directive #132310](https://github.com/rust-lang/rust/pull/132310)
99+
- [Add AIX run-make support #132657](https://github.com/rust-lang/rust/pull/132657)
100+
- [Add `exact-llvm-major-version` directive #132995](https://github.com/rust-lang/rust/pull/132995)
101+
- [Add `proc-macro` directive #133540](https://github.com/rust-lang/rust/pull/133540)
102+
- rustc:
103+
- [Make rustc consider itself a stable compiler when `RUSTC_BOOTSTRAP=-1` #132993](https://github.com/rust-lang/rust/pull/132993)
104+
105+
### Cleanups
106+
107+
- [compiletest]:
108+
- [Delete `//@ pretty-expanded` directive #133470](https://github.com/rust-lang/rust/pull/133470)
109+
110+
### Documentation updates
111+
112+
- [rustc-dev-guide]:
113+
- [Update `//@ proc-macro` aux build directive docs #2149](https://github.com/rust-lang/rustc-dev-guide/pull/2149)
114+
- [Remove `pretty-expanded` as it no longer exists #2147](https://github.com/rust-lang/rustc-dev-guide/pull/2147)
115+
- [Add instructions to test error code docs #2145](https://github.com/rust-lang/rustc-dev-guide/pull/2145)
116+
- [Document how to acquire cdb.exe #2137](https://github.com/rust-lang/rustc-dev-guide/pull/2137)
117+
- [Mention `RUSTC_BOOTSTRAP` for misc testing #2136](https://github.com/rust-lang/rustc-dev-guide/pull/2136)
118+
- [Document `exact-llvm-major-version` directive #2135](https://github.com/rust-lang/rustc-dev-guide/pull/2135)
119+
- [Document `max-llvm-major-version` directive #2129](https://github.com/rust-lang/rustc-dev-guide/pull/2129)
120+
- [Rename `{ignore,only}-debug` -> `{ignore,needs}-{rustc,std}-debug-assertions` #2101](https://github.com/rust-lang/rustc-dev-guide/pull/2101)
121+
122+
## On-going efforts
123+
124+
Note: there are certainly many more spontaneous efforts, this is more what I
125+
know is "planned".
126+
127+
- [Proposed a 2025H1 project goal: compiletest directive handling rework #148](https://github.com/rust-lang/rust-project-goals/pull/148)
128+
129+
130+
[r-l/r]: https://github.com/rust-lang/rust
131+
[rustc-dev-guide]: https://github.com/rust-lang/rustc-dev-guide
132+
[compiletest]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest
133+
[bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap
134+
[new-issue]: https://github.com/rust-lang/rust/issues/new

0 commit comments

Comments
 (0)