Skip to content

Commit 88a876f

Browse files
committed
feat: new table [patchtool] in config.toml
1 parent e75b6a4 commit 88a876f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/cargo/util/context/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ pub struct GlobalContext {
228228
doc_extern_map: LazyCell<RustdocExternMap>,
229229
progress_config: ProgressConfig,
230230
env_config: LazyCell<EnvConfig>,
231+
patchtool_config: LazyCell<PatchtoolConfig>,
231232
/// This should be false if:
232233
/// - this is an artifact of the rustc distribution process for "stable" or for "beta"
233234
/// - this is an `#[test]` that does not opt in with `enable_nightly_features`
@@ -322,6 +323,7 @@ impl GlobalContext {
322323
doc_extern_map: LazyCell::new(),
323324
progress_config: ProgressConfig::default(),
324325
env_config: LazyCell::new(),
326+
patchtool_config: LazyCell::new(),
325327
nightly_features_allowed: matches!(&*features::channel(), "nightly" | "dev"),
326328
ws_roots: RefCell::new(HashMap::new()),
327329
global_cache_tracker: LazyCell::new(),
@@ -1861,6 +1863,11 @@ impl GlobalContext {
18611863
Ok(env_config)
18621864
}
18631865

1866+
pub fn patchtool_config(&self) -> CargoResult<&PatchtoolConfig> {
1867+
self.patchtool_config
1868+
.try_borrow_with(|| self.get::<PatchtoolConfig>("patchtool"))
1869+
}
1870+
18641871
/// This is used to validate the `term` table has valid syntax.
18651872
///
18661873
/// This is necessary because loading the term settings happens very
@@ -2732,6 +2739,12 @@ where
27322739
deserializer.deserialize_option(ProgressVisitor)
27332740
}
27342741

2742+
#[derive(Debug, Default, Deserialize)]
2743+
#[serde(rename_all = "kebab-case")]
2744+
pub struct PatchtoolConfig {
2745+
pub path: Option<PathAndArgs>,
2746+
}
2747+
27352748
#[derive(Debug)]
27362749
enum EnvConfigValueInner {
27372750
Simple(String),

0 commit comments

Comments
 (0)