-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
Currently, when any changes are made to a submodule in the Rust repository, rustbot adds a warning comment but it's up to the reviewer to check all the changes.
One of the things that should always be true of a submodule commit (at merge time in the Rust repo) is that it should already be merged in an upstream branch. This can be checked in an automated fashion during CI by checking the commit against a set of allowed remote branches.
If this is not checked, something that might happen is that an author simultaneously makes an upstream and Rust PR with one commit. Later, the author (force) pushes another commit to the same upstream PR but forgets to update the Rust submodule. The original commit will at some point be garbage-collected by GitHub and merging the Rust PR would be bad because the complete source code would not be accessible in git in the future. This happened in #75009.
This check should not be done for try builds, so that development can continue unimpeded.
@rustbot modify labels: +C-enhancement +T-infra
Activity
RalfJung commentedon Aug 7, 2020
FWIW, we have used this technique of merging not-yet-upstream-merged submodule updates into rustc master in the past in Miri. That was quite helpful when disentangling a mess of mutual dependencies. We were careful to make sure the Miri branch gets merged into Miri master later without any force-pushing. But we haven't done that in a while so I think these days we could live without being able to do that.
Cc @rust-lang/miri
jethrogb commentedon Aug 14, 2020
It doesn't necessarily need to be merged, the submodule commit just needs to be in the set of allowed remote branches for the upstream project. Potentially each project could designate their own set.
jethrogb commentedon Feb 18, 2021
Close call: #82102
nagisa commentedon Feb 18, 2021
What I think happened in the referenced PR was this:
I fetched the llvm-project with
git fetch origin
and wanting to make changes on top of therustc/11.0-2021-01-05
I rangit checkout rustc/11.0-2021-01-05
, made my changes, committed them, and submitted the PR.Later when the PR was already merged, I took care to
git fetch origin
andgit checkout -f rustc/11.0-2021-01-05
(note the missingorigin/
in front ofrustc/
) which made git to check out the branch that I had implicitly created locally in the previous step, rather than therustc/11.0-2021-01-05
as it appears in theorigin
remote.There're definitely a fair amount of potential footguns here.
Fix stdarch submodule pointing to commit outside tree
Rollup merge of rust-lang#93035 - Amanieu:stdarch_fix, r=Mark-Simulacrum