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

More eager-resolution refinements #151

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/elan/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
use elan_dist::dist::ToolchainDesc;
use itertools::Itertools;

use crate::{lookup_toolchain_desc, read_toolchain_desc_from_file, Cfg, Toolchain};
use crate::{lookup_unresolved_toolchain_desc, read_toolchain_desc_from_file, resolve_toolchain_desc_ext, Cfg, Toolchain};

fn get_root_file(cfg: &Cfg) -> PathBuf {
cfg.elan_dir.join("known-projects")
Expand Down Expand Up @@ -48,11 +48,12 @@ pub fn analyze_toolchains(cfg: &Cfg) -> crate::Result<(Vec<Toolchain>, Vec<(Stri
})
.collect::<Vec<_>>();
if let Some(default) = cfg.get_default()? {
let default = lookup_toolchain_desc(cfg, &default)?;
used_toolchains.push(("default toolchain".to_string(), default));
if let Ok(default) = resolve_toolchain_desc_ext(cfg, &lookup_unresolved_toolchain_desc(cfg, &default)?, true, true) {
used_toolchains.push(("default toolchain".to_string(), default));
}
}
if let Some(ref env_override) = cfg.env_override {
if let Ok(desc) = lookup_toolchain_desc(cfg, env_override) {
if let Ok(desc) = resolve_toolchain_desc_ext(cfg, &lookup_unresolved_toolchain_desc(cfg, &env_override)?, true, true) {
used_toolchains.push(("ELAN_TOOLCHAIN".to_string(), desc));
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/elan/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ pub fn resolve_toolchain_desc_ext(cfg: &Cfg, unresolved_tc: &UnresolvedToolchain
Ok(release) => Ok(ToolchainDesc::Remote { origin: origin.clone(), release, from_channel: Some(channel.clone()) }),
Err(e) => {
if let (true, Some(tc)) = (use_cache, find_latest_local_toolchain(cfg, &release)) {
(cfg.notify_handler)(Notification::UsingExistingRelease(&tc));
if !no_net {
(cfg.notify_handler)(Notification::UsingExistingRelease(&tc));
}
Ok(tc)
} else {
Err(e)?
Expand Down
Loading