Skip to content

fix(rustup): installed toolchains for legacy rustup #1683

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

Merged
merged 1 commit into from
May 24, 2025

Conversation

reneleonhardt
Copy link
Contributor

Fixes #1678

Unfortunately some installations use legacy versions, my previous fix was only working for the current rustup >= 1.28.0.

src/rustup.rs Outdated
// Emulate --quiet by removing suffixes like " (active, default)" or " (override)" manually
Ok(out
.lines()
.map(|l| SUFFIX_REGEX.replace(l.trim(), "").into_owned())
Copy link
Member

Choose a reason for hiding this comment

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

Regex is not needed for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How? 🤔

Copy link
Member

@Emilgardis Emilgardis May 23, 2025

Choose a reason for hiding this comment

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

.map(|l| l.split_once(" (").map(|(a, _)| a).unwrap_or(l))

Copy link
Member

Choose a reason for hiding this comment

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

or what you did with split, I just have a habit of using split_once when I really only need one split :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know if it can be improved further.
Can you squash yourself upon merge or should I do it manually?

Copy link
Member

Choose a reason for hiding this comment

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

Please squash the commits and we can merge. If possible I'd like a test for this also, but no stress we can fo that later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find any tests for rustup.rs and I know that you don't like new crates like visibility to allow doctests...
#1684

@reneleonhardt reneleonhardt force-pushed the fix/installed-toolchains branch 2 times, most recently from bf62f44 to db297cb Compare May 23, 2025 21:22
@reneleonhardt reneleonhardt force-pushed the fix/installed-toolchains branch from db297cb to 3e09576 Compare May 23, 2025 21:32
@Emilgardis Emilgardis added this pull request to the merge queue May 24, 2025
Merged via the queue into cross-rs:main with commit 51f46f2 May 24, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect toolchain check when running cross with active or default toolchain
2 participants