Use Rc instead of Arc for storing rustflags

This commit is contained in:
Greg Morenz 2024-07-19 22:50:39 -04:00
parent 5f6b9a9220
commit 22c6a7db72
2 changed files with 7 additions and 8 deletions

View File

@ -20,8 +20,8 @@ use serde::{Deserialize, Serialize};
use std::cell::RefCell; use std::cell::RefCell;
use std::collections::hash_map::{Entry, HashMap}; use std::collections::hash_map::{Entry, HashMap};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::rc::Rc;
use std::str::{self, FromStr}; use std::str::{self, FromStr};
use std::sync::Arc;
/// Information about the platform target gleaned from querying rustc. /// Information about the platform target gleaned from querying rustc.
/// ///
@ -51,9 +51,9 @@ pub struct TargetInfo {
/// target libraries. /// target libraries.
pub sysroot_target_libdir: PathBuf, pub sysroot_target_libdir: PathBuf,
/// Extra flags to pass to `rustc`, see [`extra_args`]. /// Extra flags to pass to `rustc`, see [`extra_args`].
pub rustflags: Arc<[String]>, pub rustflags: Rc<[String]>,
/// Extra flags to pass to `rustdoc`, see [`extra_args`]. /// Extra flags to pass to `rustdoc`, see [`extra_args`].
pub rustdocflags: Arc<[String]>, pub rustdocflags: Rc<[String]>,
/// Whether or not rustc (stably) supports the `--check-cfg` flag. /// Whether or not rustc (stably) supports the `--check-cfg` flag.
/// ///
/// Can be removed once the minimum supported rustc version of Cargo is /// Can be removed once the minimum supported rustc version of Cargo is

View File

@ -14,7 +14,6 @@ use std::fmt;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::ops::Deref; use std::ops::Deref;
use std::rc::Rc; use std::rc::Rc;
use std::sync::Arc;
use super::BuildOutput; use super::BuildOutput;
@ -72,7 +71,7 @@ pub struct UnitInner {
/// ///
/// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for /// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for
/// [`TargetInfo.rustflags`]: crate::core::compiler::build_context::TargetInfo::rustflags /// [`TargetInfo.rustflags`]: crate::core::compiler::build_context::TargetInfo::rustflags
pub rustflags: Arc<[String]>, pub rustflags: Rc<[String]>,
/// Extra compiler flags to pass to `rustdoc` for a given unit. /// Extra compiler flags to pass to `rustdoc` for a given unit.
/// ///
/// Although it depends on the caller, in the current Cargo implementation, /// Although it depends on the caller, in the current Cargo implementation,
@ -83,7 +82,7 @@ pub struct UnitInner {
/// ///
/// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for /// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for
/// [`TargetInfo.rustdocflags`]: crate::core::compiler::build_context::TargetInfo::rustdocflags /// [`TargetInfo.rustdocflags`]: crate::core::compiler::build_context::TargetInfo::rustdocflags
pub rustdocflags: Arc<[String]>, pub rustdocflags: Rc<[String]>,
/// Build script override for the given library name. /// Build script override for the given library name.
/// ///
/// Any package with a `links` value for the given library name will skip /// Any package with a `links` value for the given library name will skip
@ -232,8 +231,8 @@ impl UnitInterner {
kind: CompileKind, kind: CompileKind,
mode: CompileMode, mode: CompileMode,
features: Vec<InternedString>, features: Vec<InternedString>,
rustflags: Arc<[String]>, rustflags: Rc<[String]>,
rustdocflags: Arc<[String]>, rustdocflags: Rc<[String]>,
links_overrides: Rc<BTreeMap<String, BuildOutput>>, links_overrides: Rc<BTreeMap<String, BuildOutput>>,
is_std: bool, is_std: bool,
dep_hash: u64, dep_hash: u64,