bootstrap: Refactor and rename a bunch of path handling#151930
bootstrap: Refactor and rename a bunch of path handling#151930jyn514 wants to merge 9 commits intorust-lang:mainfrom
Conversation
|
and FWIW I'm happy to split out changes, most of these I did with LSP assistance so they won't take me long to redo. |
This comment has been minimized.
This comment has been minimized.
|
I think some of these renames are straightforwardly good, and some will require a bit more explanation/haggling. I'll try to find an uncontroversial subset that we can land easily, and then we can concentrate on what's left. |
|
E.g. a thing I'm concerned about is that some of these new names are “aspirational” but not actually accurate to how things currently work, so they'd end up being misleading. |
|
So far these are the parts I think are fairly straightforward:
|
| const IS_HOST: bool = true; | ||
|
|
||
| fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { | ||
| run.paths(&["src/librustdoc", "src/tools/rustdoc"]) |
There was a problem hiding this comment.
I remember being reluctant to change this in the past, because I wasn't entirely sure what special behaviour it enables, and whether that behaviour is important.
I would certainly like to get rid of paths, but I would like to either be cautious about it, or acknowledge that we're going to YOLO this change and that rustdoc folks will have to tell us if they notice problems.
There was a problem hiding this comment.
Also, IIRC this case is the primary reason why PathSet::Set holds a BTreeSet<TaskPath> instead of just a singular path (selector?).
So if we do get rid of it, I would ideally want to get rid of the BTreeSet at the same time.
(An empty BTreeSet is also used to represent PathSet::empty, but we can probably use a separate enum variant for that case, and in the long run that variant will hopefully disappear if we split off user-visible steps from dependency nodes.)
There was a problem hiding this comment.
Let me talk about paths() a bit.
The original intent @Mark-Simulacrum had when he introduced PathSet, to my knowledge, was that multiple paths could be aliases for the same step. That's what rustdoc is doing here; both paths here run exactly the same Step, regardless of whether one or both are present.
That never really caught on. To my knowledge, this is the only usage of paths() there's ever been.
Later, in #95503, I repurposed PathSet to mean "each crate in this set should be passed to Step::make_run in RunConfig". That was not the previous meaning.
Rustdoc never looks at run.paths in make_run, so it's safe to just treat it as an alias, like elsewhere in bootstrap.
There was a problem hiding this comment.
I think I'd be willing to take a separate PR that does try to YOLO get rid of paths, because if we can get away with it then that's a nice win.
There was a problem hiding this comment.
(There might be some subtle differences in handling of things like --skip, but we should probably consider that sort of edge-case thing a lost cause until selector/step handling is in good enough shape that we can just have a sensible and understandable implementation.)
There was a problem hiding this comment.
Yeah, I think that reasoning is accurate. It was added in f104b12 (back in 2018!).
As that commit notes:
However, this meant that some Step specifications needed to be updated, since for example
rustdoccan be built by./x.py build src/librustdocor./x.py build src/tools/rustdoc. APathSetabstraction is added that handles this: now, each Step can not only listpath(...)but alsopaths(&[a, b, ...])which will make it so that we don't invoke it with each of the individual paths, instead invoking it with the first path in the list (though this shouldn't be depended on).
It seems fine to me to remove support for aliases.
This comment has been minimized.
This comment has been minimized.
|
@rustbot author |
There was a problem hiding this comment.
Renaming some of these things sounds like a good idea, but I'm not sure if all those changes are worth the churn, especially if we plan to actually rewrite how path handling works, during which I assume we will make large changes to it, which might cause additional renames.
But apart from the CargoCommand and Alias change the new names look reasonable to me.
0e813c4 to
6393246
Compare
6393246 to
727a9e9
Compare
|
ok, I have removed the |
This comment has been minimized.
This comment has been minimized.
727a9e9 to
6c3852a
Compare
bootstrap: Remove `ShouldRun::paths` Split out from rust-lang#151930. I've copied my comment in rust-lang#151930 (comment) into the commit description. r? @Zalathar cc @Mark-Simulacrum @Kobzol --- Some history about `paths()`. The original intent @Mark-Simulacrum had when he introduced PathSet in rust-lang@f104b12, to my knowledge, was that multiple paths could be aliases for the same step. That's what rustdoc is doing; both paths for rustdoc run exactly the same Step, regardless of whether one or both are present. That never really caught on. To my knowledge, rustdoc is the only usage of paths() there's ever been. Later, in rust-lang#95503, I repurposed PathSet to mean "each crate in this set should be passed to Step::make_run in RunConfig". That was not the previous meaning. Rustdoc never looks at run.paths in make_run, so it's safe to just treat it as an alias, like elsewhere in bootstrap. Same for all the other tool steps.
bootstrap: Remove `ShouldRun::paths` Split out from rust-lang#151930. I've copied my comment in rust-lang#151930 (comment) into the commit description. r? @Zalathar cc @Mark-Simulacrum @Kobzol --- Some history about `paths()`. The original intent @Mark-Simulacrum had when he introduced PathSet in rust-lang@f104b12, to my knowledge, was that multiple paths could be aliases for the same step. That's what rustdoc is doing; both paths for rustdoc run exactly the same Step, regardless of whether one or both are present. That never really caught on. To my knowledge, rustdoc is the only usage of paths() there's ever been. Later, in rust-lang#95503, I repurposed PathSet to mean "each crate in this set should be passed to Step::make_run in RunConfig". That was not the previous meaning. Rustdoc never looks at run.paths in make_run, so it's safe to just treat it as an alias, like elsewhere in bootstrap. Same for all the other tool steps.
bootstrap: Remove `ShouldRun::paths` Split out from rust-lang#151930. I've copied my comment in rust-lang#151930 (comment) into the commit description. r? @Zalathar cc @Mark-Simulacrum @Kobzol --- Some history about `paths()`. The original intent @Mark-Simulacrum had when he introduced PathSet in rust-lang@f104b12, to my knowledge, was that multiple paths could be aliases for the same step. That's what rustdoc is doing; both paths for rustdoc run exactly the same Step, regardless of whether one or both are present. That never really caught on. To my knowledge, rustdoc is the only usage of paths() there's ever been. Later, in rust-lang#95503, I repurposed PathSet to mean "each crate in this set should be passed to Step::make_run in RunConfig". That was not the previous meaning. Rustdoc never looks at run.paths in make_run, so it's safe to just treat it as an alias, like elsewhere in bootstrap. Same for all the other tool steps.
Rollup merge of #152196 - jyn514:remove-paths, r=Zalathar bootstrap: Remove `ShouldRun::paths` Split out from #151930. I've copied my comment in #151930 (comment) into the commit description. r? @Zalathar cc @Mark-Simulacrum @Kobzol --- Some history about `paths()`. The original intent @Mark-Simulacrum had when he introduced PathSet in f104b12, to my knowledge, was that multiple paths could be aliases for the same step. That's what rustdoc is doing; both paths for rustdoc run exactly the same Step, regardless of whether one or both are present. That never really caught on. To my knowledge, rustdoc is the only usage of paths() there's ever been. Later, in #95503, I repurposed PathSet to mean "each crate in this set should be passed to Step::make_run in RunConfig". That was not the previous meaning. Rustdoc never looks at run.paths in make_run, so it's safe to just treat it as an alias, like elsewhere in bootstrap. Same for all the other tool steps.
|
☔ The latest upstream changes (presumably #152230) made this pull request unmergeable. Please resolve the merge conflicts. |
This PR looks really scary BUT I promise that there's not actually many changes. Almost all of them are renames and the rest are just moving code around.
See https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Path.20filters.20in.20bootstrap/with/571240765 for background on why I'm making these changes, and https://hackmd.io/9J4UKJPBQOSwHr5WXQac0Q?edit for a sketch of what I think the long-term plan should be for path handling.
I highly highly recommend reviewing this commit by commit with
--ignore-all-space --color-moved=dimmed-zebra --color-moved-ws=ignore-space-change.