From 921927462a1649b79b9d919fb7bf2c3bb7d8b158 Mon Sep 17 00:00:00 2001 From: Kornel Date: Wed, 3 Jan 2018 15:54:33 +0000 Subject: [PATCH 1/2] Make is_flag_supported public Closes #277 --- src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 28d6393..fa443a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -391,7 +391,11 @@ impl Build { Ok(src) } - fn is_flag_supported(&self, flag: &str) -> Result { + /// Run the compiler to test if it accepts the given flag. + /// + /// For a convenience method for setting flags conditionally, + /// see `flag_if_supported()`. + pub fn is_flag_supported(&self, flag: &str) -> Result { let out_dir = self.get_out_dir()?; let src = self.ensure_check_file()?; let obj = out_dir.join("flag_check"); From 51bded7426b9a8b192390cd547aa1fead596a889 Mon Sep 17 00:00:00 2001 From: Kornel Date: Wed, 3 Jan 2018 16:22:21 +0000 Subject: [PATCH 2/2] Doc --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index fa443a1..67d8f6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -395,6 +395,9 @@ impl Build { /// /// For a convenience method for setting flags conditionally, /// see `flag_if_supported()`. + /// + /// It may return error if it's unable to run the compilier with a test file + /// (e.g. the compiler is missing or a write to the `out_dir` failed). pub fn is_flag_supported(&self, flag: &str) -> Result { let out_dir = self.get_out_dir()?; let src = self.ensure_check_file()?;