Skip to content

Commit

Permalink
[SOL] build-std: pull in our compiler-builtins
Browse files Browse the repository at this point in the history
When -Z build-std is used, patch compiler-builtins so that our own fork is
downloaded.

Needed for solana-labs/solana#23465.
  • Loading branch information
alessandrod committed Jun 3, 2022
1 parent 49d8809 commit 8d8bc1a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/cargo/core/compiler/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::core::compiler::{CompileKind, CompileMode, RustcTargetData, Unit};
use crate::core::profiles::{Profiles, UnitFor};
use crate::core::resolver::features::{CliFeatures, FeaturesFor, ResolvedFeatures};
use crate::core::resolver::HasDevUnits;
use crate::core::{Dependency, PackageId, PackageSet, Resolve, SourceId, Workspace};
use crate::core::{Dependency, GitReference, PackageId, PackageSet, Resolve, SourceId, Workspace};
use crate::ops::{self, Packages};
use crate::util::errors::CargoResult;
use std::collections::{HashMap, HashSet};
Expand Down Expand Up @@ -43,14 +43,22 @@ pub fn resolve_std<'cfg>(
"rustc-std-workspace-alloc",
"rustc-std-workspace-std",
];
let patches = to_patch
let mut patches = to_patch
.iter()
.map(|&name| {
let source_path = SourceId::for_path(&src_path.join("library").join(name))?;
let dep = Dependency::parse(name, None, source_path)?;
Ok(dep)
})
.collect::<CargoResult<Vec<_>>>()?;
patches.push(Dependency::parse(
"compiler_builtins",
None,
SourceId::for_git(
&("https://github.com/solana-labs/compiler-builtins".parse()).unwrap(),
GitReference::Tag("bpf-tools-v1.27".to_string()),
)?,
)?);
let crates_io_url = crate::sources::CRATES_IO_INDEX.parse().unwrap();
let mut patch = HashMap::new();
patch.insert(crates_io_url, patches);
Expand Down

0 comments on commit 8d8bc1a

Please sign in to comment.