Skip to content

Commit 631b877

Browse files
committed
Auto merge of #14273 - gmorenz:rustflags_arc_to_rc, r=weihanglo
Use `Rc` instead of `Arc` for storing rustflags # What does this PR try to resolve? There's no reason that these reference counted pointers (which I introduced in #13900) need to be atomic, so let's use non-atomic pointers. # Additional information First noticed by `@weihanglo` [here](#14205 (comment)). r? `@weihanglo`
2 parents 5f6b9a9 + 22c6a7d commit 631b877

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/cargo/core/compiler/build_context/target_info.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use serde::{Deserialize, Serialize};
2020
use std::cell::RefCell;
2121
use std::collections::hash_map::{Entry, HashMap};
2222
use std::path::{Path, PathBuf};
23+
use std::rc::Rc;
2324
use std::str::{self, FromStr};
24-
use std::sync::Arc;
2525

2626
/// Information about the platform target gleaned from querying rustc.
2727
///
@@ -51,9 +51,9 @@ pub struct TargetInfo {
5151
/// target libraries.
5252
pub sysroot_target_libdir: PathBuf,
5353
/// Extra flags to pass to `rustc`, see [`extra_args`].
54-
pub rustflags: Arc<[String]>,
54+
pub rustflags: Rc<[String]>,
5555
/// Extra flags to pass to `rustdoc`, see [`extra_args`].
56-
pub rustdocflags: Arc<[String]>,
56+
pub rustdocflags: Rc<[String]>,
5757
/// Whether or not rustc (stably) supports the `--check-cfg` flag.
5858
///
5959
/// Can be removed once the minimum supported rustc version of Cargo is

src/cargo/core/compiler/unit.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::fmt;
1414
use std::hash::{Hash, Hasher};
1515
use std::ops::Deref;
1616
use std::rc::Rc;
17-
use std::sync::Arc;
1817

1918
use super::BuildOutput;
2019

@@ -72,7 +71,7 @@ pub struct UnitInner {
7271
///
7372
/// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for
7473
/// [`TargetInfo.rustflags`]: crate::core::compiler::build_context::TargetInfo::rustflags
75-
pub rustflags: Arc<[String]>,
74+
pub rustflags: Rc<[String]>,
7675
/// Extra compiler flags to pass to `rustdoc` for a given unit.
7776
///
7877
/// Although it depends on the caller, in the current Cargo implementation,
@@ -83,7 +82,7 @@ pub struct UnitInner {
8382
///
8483
/// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for
8584
/// [`TargetInfo.rustdocflags`]: crate::core::compiler::build_context::TargetInfo::rustdocflags
86-
pub rustdocflags: Arc<[String]>,
85+
pub rustdocflags: Rc<[String]>,
8786
/// Build script override for the given library name.
8887
///
8988
/// Any package with a `links` value for the given library name will skip
@@ -232,8 +231,8 @@ impl UnitInterner {
232231
kind: CompileKind,
233232
mode: CompileMode,
234233
features: Vec<InternedString>,
235-
rustflags: Arc<[String]>,
236-
rustdocflags: Arc<[String]>,
234+
rustflags: Rc<[String]>,
235+
rustdocflags: Rc<[String]>,
237236
links_overrides: Rc<BTreeMap<String, BuildOutput>>,
238237
is_std: bool,
239238
dep_hash: u64,

0 commit comments

Comments
 (0)