From 702b5c43208572b098d130805bec27590d374ecd Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Fri, 3 Jun 2022 16:16:32 +0100 Subject: [PATCH] [SOL] build-std: pull in our compiler-builtins When -Z build-std is used, patch compiler-builtins so that our own fork is downloaded. Needed for https://github.com/solana-labs/solana/pull/23465. --- src/cargo/core/compiler/standard_lib.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cargo/core/compiler/standard_lib.rs b/src/cargo/core/compiler/standard_lib.rs index e0baebd516b8..2613a7b4cf08 100644 --- a/src/cargo/core/compiler/standard_lib.rs +++ b/src/cargo/core/compiler/standard_lib.rs @@ -6,7 +6,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 crate::Config; @@ -79,7 +79,7 @@ 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))?; @@ -87,6 +87,14 @@ pub fn resolve_std<'cfg>( Ok(dep) }) .collect::>>()?; + patches.push(Dependency::parse( + "compiler_builtins", + None, + SourceId::for_git( + &("https://github.com/solana-labs/compiler-builtins".parse()).unwrap(), + GitReference::Tag("sbf-tools-v1.31".to_string()), + )?, + )?); let crates_io_url = crate::sources::CRATES_IO_INDEX.parse().unwrap(); let patch = HashMap::from([(crates_io_url, patches)]); let members = vec![