Skip to content

compiletest: make some internals pub for use as a library#154997

Open
akintewe wants to merge 1 commit intorust-lang:mainfrom
akintewe:compiletest-make-public
Open

compiletest: make some internals pub for use as a library#154997
akintewe wants to merge 1 commit intorust-lang:mainfrom
akintewe:compiletest-make-public

Conversation

@akintewe
Copy link
Copy Markdown

@akintewe akintewe commented Apr 8, 2026

Make Config, TestPaths, CollectedTest, CollectedTestDesc, ShouldFail, FileDirectives, parse_config and collect_and_make_tests public so that external tools can depend on compiletest as a library and use its test collection infrastructure directly, without re-implementing parts of bootstrap and compiletest.

r? jackh726

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 8, 2026

compiletest directives have been modified. Please add or update docs for the
new or modified directive in src/doc/rustc-dev-guide/.

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 8, 2026
@akintewe akintewe force-pushed the compiletest-make-public branch from 15fdf1d to b750a8b Compare April 8, 2026 16:55
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 8, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@akintewe akintewe force-pushed the compiletest-make-public branch from 534e6af to b750a8b Compare April 8, 2026 17:08
@rust-log-analyzer

This comment has been minimized.

Comment thread src/tools/compiletest/src/lib.rs Outdated
@rust-log-analyzer

This comment has been minimized.

@akintewe akintewe force-pushed the compiletest-make-public branch from b750a8b to 590c610 Compare April 8, 2026 17:27
@akintewe akintewe requested a review from jackh726 April 8, 2026 17:28
@rust-log-analyzer

This comment has been minimized.

Make Config, TestPaths, CollectedTest, CollectedTestDesc, ShouldFail,
FileDirectives, parse_config and collect_and_make_tests public so that
external tools can depend on compiletest as a library and use its test
collection infrastructure directly.

r? jackh726
@akintewe akintewe force-pushed the compiletest-make-public branch from 590c610 to 1d43611 Compare April 9, 2026 20:25
akintewe added a commit to akintewe/rust that referenced this pull request Apr 10, 2026
Forward all args to parse_config instead of building a stub config.
Extract rustc_path and sysroot from CLI args directly so we don't
need to access private Config fields. Also add coverage-tool to the
workspace Cargo.toml.

Note: requires rust-lang#154997 to merge before Config and
related types are publicly accessible from compiletest.
@Zalathar
Copy link
Copy Markdown
Member

In the past, stuff like this has been detrimental to compiletest maintenance, so I'm very reluctant to expose anything beyond the absolute bare minimum needed by other in-tree tools.

If you need these details for out-of-tree tools, I'd prefer that the changes be kept in a downstream fork instead, so that they don't burden compiletest itself.

@akintewe
Copy link
Copy Markdown
Author

In the past, stuff like this has been detrimental to compiletest maintenance, so I'm very reluctant to expose anything beyond the absolute bare minimum needed by other in-tree tools.

If you need these details for out-of-tree tools, I'd prefer that the changes be kept in a downstream fork instead, so that they don't burden compiletest itself.

Thanks for the feedback @Zalathar. The intended use is an in tree tool (src/tools/coverage-tool) that depends on compiletest as a library to collect tests without re implementing bootstrap's test collection logic so the changes would live in tree alongside compiletest, not in a downstream fork.

That said, I completely understand the concern about maintenance burden. @jackh726 given this feedback, would it make more sense to keep the coverage tool self contained and duplicate the minimal bits it needs from compiletest instead?

@Zalathar
Copy link
Copy Markdown
Member

The name coverage-tool also seems liable to be confusing.

I'm not very familiar with your current work, but if the tool is intended to help measure coverage of the compiler itself, it might be wise to communicate that more clearly in the tool's name (e.g. compiler-coverage-tool), to help distinguish it from existing tools and tests related to the implementation of coverage instrumentation.

@akintewe
Copy link
Copy Markdown
Author

The name coverage-tool also seems liable to be confusing.

I'm not very familiar with your current work, but if the tool is intended to help measure coverage of the compiler itself, it might be wise to communicate that more clearly in the tool's name (e.g. compiler-coverage-tool), to help distinguish it from existing tools and tests related to the implementation of coverage instrumentation.

Thank you for the suggestion, compiler-coverage-tool is much clearer. I'll rename it.
And i understand on the maintenance concern. I'll wait to hear from @jackh726 on whether it makes more sense to keep compiletest changes minimal and have the tool duplicate what it needs instead.

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-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants