Skip to content

compiletest: Isolate public APIs and minimize public surface area#147506

Merged
bors merged 3 commits intorust-lang:masterfrom
Zalathar:isolate
Oct 9, 2025
Merged

compiletest: Isolate public APIs and minimize public surface area#147506
bors merged 3 commits intorust-lang:masterfrom
Zalathar:isolate

Conversation

@Zalathar
Copy link
Copy Markdown
Member

@Zalathar Zalathar commented Oct 9, 2025

As part of my ongoing efforts to improve directive parsing, I would like to be able to make internal changes without worrying about whether they're going to break the rustdoc-gui-test tool. That tool currently uses compiletest as a dependency to help with directive parsing.

This PR therefore isolates all of compiletest's public APIs into two dedicated modules, one used by rustdoc-gui-test, and one used by the compiletest binary in compiletest/src/bin/main.rs.

All other modules (and crate-root items) are then made non-pub to achieve the API isolation. Doing so reveals some unused items, which have been removed.

(To reduce the amount of immediate textual churn, this PR does not comprehensively replace pub with pub(crate) throughout the whole crate; that could be done in a follow-up PR.)


Ideally, rustdoc-gui-test would not depend on compiletest at all, but properly fixing that is out of scope for this PR.

r? jieyouxu

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

4 participants