Skip to content
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

ensure sysroot is correct #1231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Emilgardis
Copy link
Member

@Emilgardis Emilgardis commented Mar 25, 2023

This resolves #1198

@Emilgardis Emilgardis requested a review from a team as a code owner March 25, 2023 12:14
Comment on lines -94 to +151
l.replace(" (default)", "")
.replace(" (override)", "")
.trim()
.to_owned()
let mut mode = ToolchainMode::None;
let mut l = if l.contains(" (override)") {
mode = ToolchainMode::Override;
l.replace(" (override)", "")
} else {
l.to_owned()
};
if l.contains(" (default)") {
if mode.is_overriden() {
mode = ToolchainMode::DefaultOverride;
} else {
mode = ToolchainMode::Default;
}
l = l.replace(" (default)", "");
}

(l, mode)
})
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not super happy about this.

Comment on lines +124 to +126
pub fn installed_toolchains(
msg_info: &mut MessageInfo,
) -> Result<Vec<(String, ToolchainMode, std::path::PathBuf)>> {
Copy link
Member Author

Choose a reason for hiding this comment

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

should probably return a vec of struct, like available_targets

Comment on lines -367 to -375
pub fn sysroot(msg_info: &mut MessageInfo) -> Result<PathBuf> {
let stdout = rustc_command()
.args(["--print", "sysroot"])
.run_and_get_stdout(msg_info)?
.trim()
.to_owned();
Ok(PathBuf::from(stdout))
}

Copy link
Member Author

Choose a reason for hiding this comment

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

this is not needed anymore, rustup toolchain list -v gives us this, for all toolchains

Comment on lines +204 to +217
let (toolchain_name, sysroot) = if let Some((toolchain_name, _, sysroot)) =
installed_toolchains
.iter()
.find(|(_, mode, _)| mode.is_overriden())
{
(toolchain_name, sysroot)
} else if let Some((toolchain_name, _, sysroot)) = installed_toolchains
.iter()
.find(|(_, mode, _)| mode.is_defaulted())
{
(toolchain_name, sysroot)
} else {
eyre::bail!("no default toolchain found");
};
Copy link
Member Author

Choose a reason for hiding this comment

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

I feel like there is a better way to write this, not sure how though

@Emilgardis Emilgardis added this to the v0.3.0 milestone Mar 27, 2023
@Emilgardis Emilgardis modified the milestones: v0.3.0, v0.3.1 Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using rust from distro repo makes cross mount wierd directory
1 participant