Fix handling of no_std targets in doc::Std
step
#143615
Open
+142
−68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thestd_cargo
function, but theself.crates
list was overriding that.In general, using
crates: Vec<String>
in theStd
steps is quite fishy, because it's difficult to distinguish between all crates (either they are all enumerated orcrates
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/... instd_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 thesysroot
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 thestd_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