Skip to content

Warn when installing with a non-default toolchain#16131

Draft
smoelius wants to merge 4 commits intorust-lang:masterfrom
smoelius:second-half-of-11036
Draft

Warn when installing with a non-default toolchain#16131
smoelius wants to merge 4 commits intorust-lang:masterfrom
smoelius:second-half-of-11036

Conversation

@smoelius
Copy link
Contributor

@smoelius smoelius commented Oct 18, 2025

This PR implements the cargo changes for #11036. The rustup changes were implemented in rust-lang/rustup#4518.

The PR is currently organized as four commits:

  • The first expands the rustup tests to set RUSTUP_TOOLCHAIN_SOURCE. This change is not strictly necessary, but it improves the rustup tests' fidelity.
  • The second moves the pkg function to a location where the next commit can use it.
  • The third implements a test to check the fourth commit's fix.
  • The fourth warns when cargo install is invoked with a non-default toolchain, as indicated by RUSTUP_TOOLCHAIN_SOURCE.

In the third commit, two significant changes were made to simulated_rustup_environment:

  • Previously, the constructed proxy would call an always-panicking executable whenever it was asked to run cargo. Now, the proxy can be made to run the cargo under test.
  • The proxy can now be made to set additional environment variables (e.g., RUSTUP_TOOLCHAIN_SOURCE) before calling the proxied tool.

The PR is currently marked as draft because rust-lang/rustup#4518 has not yet been released. Technically, this PR could be merged before then. But testing it with a fixed rustup would seem to make sense.

Nits are welcome.

cc: @epage

@rustbot rustbot added Command-install S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 18, 2025

r? @weihanglo

rustbot has assigned @weihanglo.
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

@smoelius smoelius marked this pull request as draft October 18, 2025 09:36
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2025
@smoelius smoelius force-pushed the second-half-of-11036 branch from 2157847 to 9006944 Compare October 18, 2025 09:52
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

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

EDIT: The force push was to make Clippy happy.

Feel free to force-push and re-organize your commits during the iterations.

@rustbot

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Nov 6, 2025
@smoelius smoelius force-pushed the second-half-of-11036 branch from c64e01a to f0f222f Compare November 6, 2025 23:07
@smoelius
Copy link
Contributor Author

smoelius commented Nov 6, 2025

Just FYI, I know it looks like only some of the comments have been addressed. I am still hoping to get feedback on #16131 (comment) and #16131 (comment).

@rustbot rustbot added A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. A-testing-cargo-itself Area: cargo's tests labels Dec 28, 2025
@smoelius smoelius force-pushed the second-half-of-11036 branch from f75ccb8 to a386ddd Compare December 28, 2025 21:21
@smoelius
Copy link
Contributor Author

smoelius commented Dec 28, 2025

I resolved comments that I thought I implemented uncontroversially. I hope that was okay.

EDIT: I also hid a few of my own comments that were old.

@epage
Copy link
Contributor

epage commented Dec 30, 2025

Please clean up your commits for how they should be reviewed and merged, rather than for how it was developed.

@smoelius smoelius force-pushed the second-half-of-11036 branch from 2e97d39 to 79a32f6 Compare January 3, 2026 12:40
epage added a commit to epage/cargo that referenced this pull request Jan 5, 2026
Thought of this when reviewing new cases for `std::env` in rust-lang#16131.
epage added a commit to epage/cargo that referenced this pull request Jan 5, 2026
Thought of this when reviewing new cases for `std::env` in rust-lang#16131.
github-merge-queue bot pushed a commit that referenced this pull request Jan 5, 2026
### What does this PR try to resolve?

Thought of this when reviewing new cases for `std::env` in #16131.

### How to test and review this PR?
This is the first of several commits to implement a fix for rust-lang#11036.
The changes fetch the `RUSTUP_TOOLCHAIN_SOURCE` environment variable set
by Rustup, and warn if it is anything other than "default" or "cli".
@smoelius smoelius force-pushed the second-half-of-11036 branch from 79a32f6 to a106b1d Compare January 10, 2026 13:03
@smoelius
Copy link
Contributor Author

I need to fix the commits. I will do that within the next few hours.

@smoelius smoelius force-pushed the second-half-of-11036 branch from a106b1d to bd62811 Compare January 10, 2026 14:13
@smoelius
Copy link
Contributor Author

The commits should be fixed now.

@smoelius smoelius force-pushed the second-half-of-11036 branch from bd62811 to 78f7c63 Compare January 14, 2026 11:20
@epage
Copy link
Contributor

epage commented Jan 14, 2026

Thanks for your patience through the rounds of feedback! This is looking great!

@smoelius smoelius force-pushed the second-half-of-11036 branch from 78f7c63 to 5aee235 Compare January 20, 2026 21:56
@smoelius smoelius force-pushed the second-half-of-11036 branch from 5aee235 to 815ceb1 Compare February 2, 2026 23:43
@smoelius smoelius force-pushed the second-half-of-11036 branch from 815ceb1 to 8f464a5 Compare February 4, 2026 11:10
@epage
Copy link
Contributor

epage commented Feb 4, 2026

@rami3l when would we be good for merging support for this?

@rami3l
Copy link
Member

rami3l commented Feb 4, 2026

@epage I'd say after v1.29.0 has been properly released and stabilized for a bit, but that will be pretty close from here. Judging from the current progress, I'd say the release could happen next week or another week after that, unless new blocking PRs resurface by then. I'm planning that out depending on my availabilities during the night. Please stay tuned and many thanks in advance for your comprehension!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-infrastructure Area: infrastructure around the cargo repo, ci, releases, etc. A-testing-cargo-itself Area: cargo's tests Command-install S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants