Skip to content

Write .cargo/config.toml in x vendor #144124

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 1 commit into
base: master
Choose a base branch
from

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Jul 18, 2025

x vendor hides the cargo vendor telling you what to write to .cargo/config.toml. to use the vendored sources, so without this PR it isn't obvious how to use the vendored sources.

@rustbot
Copy link
Collaborator

rustbot commented Jul 18, 2025

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

@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 18, 2025
@clubby789
Copy link
Contributor

Why not just print out the config info captured? That avoids the trailing

To use vendored sources, add this to your .cargo/config.toml for this project:

and avoids automatically overwriting a potentially existing config.toml.

@bjorn3
Copy link
Member Author

bjorn3 commented Jul 18, 2025

I found this will working on vendoring support for -Zbuild-std. That will require two separate .cargo/config.toml files to be written. One in the root and one in library/.

@clubby789
Copy link
Contributor

Sounds good - the broken output is a bit unfortunate but not the end of the world. r=me when green

@Kobzol
Copy link
Member

Kobzol commented Jul 18, 2025

I don't think people will appreciate when running x vendor might overwrite their .cargo/config.toml file. Bootstrap should just print what to do, or this behavior should be opt-in.

}

impl Step for Vendor {
type Output = VendorOutput;
type Output = ();
Copy link
Member

Choose a reason for hiding this comment

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

Why remove this? GenerateCopyright can still make use of the final path, instead of having to know about VENDOR_DIR, which is an implementation detail of the vendor step.

Copy link
Member Author

Choose a reason for hiding this comment

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

VendorOutput only ever contained the data that should be written to .cargo/config.toml.

Copy link
Member

Choose a reason for hiding this comment

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

I don't like overwriting the config.toml file on disk (as per my other comment), but if we did that, we can at least return the path to the vendor directory from the step, to avoid other steps reaching for VENDOR_DIR.

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