From 2ce64b51319ec054a6a298c75ddff822ae5d0921 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Fri, 24 Oct 2025 23:29:42 +0100 Subject: [PATCH] Mark `static_flag` and `shared_flag` as deprecated They are meaningless since cc-rs only generates static libraries. Closes #1444 Closes #594 --- Cargo.toml | 2 +- src/lib.rs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 94ad1217..00d72cc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cc" -version = "1.2.42" +version = "1.2.43" authors = ["Alex Crichton "] license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/cc-rs" diff --git a/src/lib.rs b/src/lib.rs index 60090f08..09b37dca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -783,17 +783,19 @@ impl Build { /// Set the `-shared` flag. /// - /// When enabled, the compiler will produce a shared object which can - /// then be linked with other objects to form an executable. + /// This will typically be ignored by the compiler when calling [`Self::compile()`] since it only + /// produces static libraries. /// /// # Example /// /// ```no_run + /// // This will create a library named "liblibfoo.so.a" /// cc::Build::new() /// .file("src/foo.c") /// .shared_flag(true) /// .compile("libfoo.so"); /// ``` + #[deprecated = "cc only creates static libraries, setting this does nothing"] pub fn shared_flag(&mut self, shared_flag: bool) -> &mut Build { self.shared_flag = Some(shared_flag); self @@ -801,8 +803,8 @@ impl Build { /// Set the `-static` flag. /// - /// When enabled on systems that support dynamic linking, this prevents - /// linking with the shared libraries. + /// This will typically be ignored by the compiler when calling [`Self::compile()`] since it only + /// produces static libraries. /// /// # Example /// @@ -813,6 +815,7 @@ impl Build { /// .static_flag(true) /// .compile("foo"); /// ``` + #[deprecated = "cc only creates static libraries, setting this does nothing"] pub fn static_flag(&mut self, static_flag: bool) -> &mut Build { self.static_flag = Some(static_flag); self