Skip to content

Fix bootstrap submodule path prefix matching#158960

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
kn1g78:fix-bootstrap-submodule-prefix
Jul 10, 2026
Merged

Fix bootstrap submodule path prefix matching#158960
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
kn1g78:fix-bootstrap-submodule-prefix

Conversation

@kn1g78

@kn1g78 kn1g78 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes bootstrap submodule detection to use path-component matching instead of raw string prefix matching.
This prevents paths like src/tools/cargo-vendor from being treated as inside the src/tools/cargo submodule.
Adds a regression test for sibling paths that only share a string prefix with a submodule path.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 8, 2026
@Kobzol

Kobzol commented Jul 8, 2026

Copy link
Copy Markdown
Member

What is src/tools/cargo-vendor?

@kn1g78

kn1g78 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

What is src/tools/cargo-vendor?

It is not an actual directory/tool in the Rust repo. I used src/tools/cargo-vendor as a synthetic negative test case: it shares the string prefix src/tools/cargo, but it is a sibling-like path rather than a child path, so submodule_path_of_paths must not classify it as being inside the src/tools/cargo submodule.

@kn1g78 kn1g78 marked this pull request as ready for review July 9, 2026 09:35
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 9, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 9, 2026
@rustbot

rustbot commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a while to understand what is the actual fix, it's this line:

let path = Path::new(path);

Not sure if we ever really ran into this in practice, but seems like a reasonable fix. Thank you!

@bors r+ rollup

View changes since this review

@rust-bors

rust-bors Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit f55de23 has been approved by Kobzol

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 9, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 9, 2026
…fix, r=Kobzol

Fix bootstrap submodule path prefix matching

Fixes bootstrap submodule detection to use path-component matching instead of raw string prefix matching.
This prevents paths like src/tools/cargo-vendor from being treated as inside the src/tools/cargo submodule.
Adds a regression test for sibling paths that only share a string prefix with a submodule path.
rust-bors Bot pushed a commit that referenced this pull request Jul 10, 2026
Rollup of 24 pull requests

Successful merges:

 - #150946 (intrinsics: Add a fallback for non-const libm float functions)
 - #158541 (Move `std::io::Write` to `core::io`)
 - #156027 (Consider captured regions for opaque type region liveness.)
 - #156370 (Reject linked dylib EII default overrides)
 - #156508 (Infer all anonymous lifetimes in assoc consts as `'static`)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158645 (Fix splat ICEs and ban it in closures)
 - #158859 (Improve `-Zls` diagnostic message on `.rs` files)
 - #158988 (Redo `TokenStreamIter`)
 - #158347 (Improve generic parameters handling for #[diagnostic::on_const])
 - #158384 (Allow BackwardIncompatibleDropHint in polonius legacy)
 - #158722 (delegation: do not always inherit `ConstArgHasType` predicates)
 - #158739 (view-types: HIR lowering)
 - #158877 (borrowck: Keep returned `path` from `best_blame_constraint()` consistent)
 - #158883 (tests: fix enum-match.rs to handle LLVM 23)
 - #158886 (Add documentation for the `no_std` attribute)
 - #158940 (Implement feature `char_to_u32`)
 - #158951 (Merge three `MaxUniverse`s into one)
 - #158960 (Fix bootstrap submodule path prefix matching)
 - #158961 (Reapply "LLVM 23: Run AssignGUIDPass in some places")
 - #158995 (Use REST API in linkchecker script)
 - #158996 ([compiler] Implement `PartialOrd` via `Ord` for `Span` and newtype_indexes)
 - #159036 (bootstrap: expand '@argfile' arguments to rustc shim)
@rust-bors rust-bors Bot merged commit 2a912c3 into rust-lang:main Jul 10, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 10, 2026
rust-timer added a commit that referenced this pull request Jul 10, 2026
Rollup merge of #158960 - kn1g78:fix-bootstrap-submodule-prefix, r=Kobzol

Fix bootstrap submodule path prefix matching

Fixes bootstrap submodule detection to use path-component matching instead of raw string prefix matching.
This prevents paths like src/tools/cargo-vendor from being treated as inside the src/tools/cargo submodule.
Adds a regression test for sibling paths that only share a string prefix with a submodule path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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