git: 83810086906d - main - devel/cargo-c: Backport patch-in-config stabilization in Rust 1.56.0

From: Tobias Kortkamp <tobik_at_FreeBSD.org>
Date: Mon, 25 Oct 2021 08:57:32 UTC
The branch main has been updated by tobik:

URL: https://cgit.FreeBSD.org/ports/commit/?id=83810086906d648ffc380fd351dd43481f946666

commit 83810086906d648ffc380fd351dd43481f946666
Author:     Tobias Kortkamp <tobik@FreeBSD.org>
AuthorDate: 2021-10-18 20:35:01 +0000
Commit:     Tobias Kortkamp <tobik@FreeBSD.org>
CommitDate: 2021-10-25 08:49:18 +0000

    devel/cargo-c: Backport patch-in-config stabilization in Rust 1.56.0
    
    Unbreaks multimedia/gstreamer1-plugins-rust
    
    PR:             256581
---
 devel/cargo-c/Makefile                |  1 +
 devel/cargo-c/files/patch-rust-1.56.0 | 51 +++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/devel/cargo-c/Makefile b/devel/cargo-c/Makefile
index a72719d0206c..1194f0493233 100644
--- a/devel/cargo-c/Makefile
+++ b/devel/cargo-c/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	cargo-c
 DISTVERSION=	0.9.4
 DISTVERSIONSUFFIX=	+cargo-0.56
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	CRATESIO
 # XXX Teach USES=cargo to have proper default
diff --git a/devel/cargo-c/files/patch-rust-1.56.0 b/devel/cargo-c/files/patch-rust-1.56.0
new file mode 100644
index 000000000000..054f0e6756d0
--- /dev/null
+++ b/devel/cargo-c/files/patch-rust-1.56.0
@@ -0,0 +1,51 @@
+https://github.com/rust-lang/cargo/commit/1e0d564ff01f
+
+--- cargo-crates/cargo-0.56.0/src/cargo/core/features.rs.orig	1970-01-01 00:00:00 UTC
++++ cargo-crates/cargo-0.56.0/src/cargo/core/features.rs
+@@ -645,7 +645,6 @@ unstable_cli_options!(
+     panic_abort_tests: bool = ("Enable support to run tests with -Cpanic=abort"),
+     host_config: bool = ("Enable the [host] section in the .cargo/config.toml file"),
+     target_applies_to_host: bool = ("Enable the `target-applies-to-host` key in the .cargo/config.toml file"),
+-    patch_in_config: bool = ("Allow `[patch]` sections in .cargo/config.toml files"),
+     rustdoc_map: bool = ("Allow passing external documentation mappings to rustdoc"),
+     separate_nightlies: bool = (HIDDEN),
+     terminal_width: Option<Option<usize>>  = ("Provide a terminal width to rustc for error truncation"),
+@@ -689,6 +688,8 @@ const STABILIZED_FEATURES: &str = "The new feature res
+     See https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2 \
+     for more information.";
+ 
++const STABILIZED_PATCH_IN_CONFIG: &str = "The patch-in-config feature is now always enabled.";
++
+ fn deserialize_build_std<'de, D>(deserializer: D) -> Result<Option<Vec<String>>, D::Error>
+ where
+     D: serde::Deserializer<'de>,
+@@ -834,7 +835,6 @@ impl CliUnstable {
+             "configurable-env" => self.configurable_env = parse_empty(k, v)?,
+             "host-config" => self.host_config = parse_empty(k, v)?,
+             "target-applies-to-host" => self.target_applies_to_host = parse_empty(k, v)?,
+-            "patch-in-config" => self.patch_in_config = parse_empty(k, v)?,
+             "features" => {
+                 // For now this is still allowed (there are still some
+                 // unstable options like "compare"). This should be removed at
+@@ -869,6 +869,7 @@ impl CliUnstable {
+             "config-profile" => stabilized_warn(k, "1.43", STABILIZED_CONFIG_PROFILE),
+             "crate-versions" => stabilized_warn(k, "1.47", STABILIZED_CRATE_VERSIONS),
+             "package-features" => stabilized_warn(k, "1.51", STABILIZED_PACKAGE_FEATURES),
++            "patch-in-config" => stabilized_warn(k, "1.56", STABILIZED_PATCH_IN_CONFIG),
+             "future-incompat-report" => self.future_incompat_report = parse_empty(k, v)?,
+             _ => bail!("unknown `-Z` flag specified: {}", k),
+         }
+--- cargo-crates/cargo-0.56.0/src/cargo/core/workspace.rs.orig	1970-01-01 00:00:00 UTC
++++ cargo-crates/cargo-0.56.0/src/cargo/core/workspace.rs
+@@ -362,11 +362,6 @@ impl<'cfg> Workspace<'cfg> {
+             BTreeMap<String, BTreeMap<String, TomlDependency<ConfigRelativePath>>>,
+         > = self.config.get("patch")?;
+ 
+-        if config_patch.is_some() && !self.config.cli_unstable().patch_in_config {
+-            self.config.shell().warn("`[patch]` in cargo config was ignored, the -Zpatch-in-config command-line flag is required".to_owned())?;
+-            return Ok(HashMap::new());
+-        }
+-
+         let source = SourceId::for_path(self.root())?;
+ 
+         let mut warnings = Vec::new();