Skip to content

Fix handling of no_std targets in doc::Std step #143615

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Jul 7, 2025

The previous logic was wrong for no_std targets, it just didn't do anything. The logic was added there because by default, the Std step would otherwise have a list of all std crates to check, but these would fail for no_std targets. What has to happen instead is to select the default set of packages to check/doc/build, which currently happens in the std_cargo function, but the self.crates list was overriding that.

In general, using crates: Vec<String> in the Std steps is quite fishy, because it's difficult to distinguish between all crates (either they are all enumerated or crates is empty) and the default (e.g. x <kind> [library]) vs a subset (e.g. x <kind> core). I wanted to improve that using an enum that would distinguish these situations, avoid passing -p for all of the crates explicitly, and unify the selection of packages to compile/check/... in std_cargo, based on this enum.

However, I found out from some other bootstrap comments that when you pass -p explicitly for all crates, cargo behaves differently (apparently for check it will also check targets/examples etc. with -p, but not without it). Furthermore, the doc step has a special case where it does not document the sysroot package. So as usually, unifying this logic would get into some edge cases... So instead I opted for a seemingly simpler solution, where I try to prefilter only two allowed crates (core and alloc) for no_std targets in the std_crates_for_run_make function.

It's not perfect, but I think it's better than the status quo (words to live by when working on bootstrap...).

Fixes this Zulip topic.

r? @jieyouxu

@rustbot rustbot added 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 Jul 7, 2025
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member

jieyouxu commented Jul 8, 2025

I think some tests need reblessing tho.

@Kobzol
Copy link
Member Author

Kobzol commented Jul 8, 2025

Yeah, I'll actually need to reimplement the tests, the way I did host normalization was not working outside x64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants