summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel McCarney <daniel@binaryparadox.net>2024-05-06 09:02:39 -0400
committerDaniel McCarney <daniel@binaryparadox.net>2024-05-06 18:19:40 +0000
commit69b5d2374eccdc4093967a188dff9a62e0c8d884 (patch)
tree9d348671a6c2ac3bf222220c399fad8076875a3d
parent1265e55111b8c8d3ee5df221fb8a67ed7a4d493d (diff)
build: emit rustc-check-cfg for bench, read_buf
Fixes warnings generated with nightly when generating cargo docs of the form: ``` error: unexpected `cfg` condition name: `bench` --> rustls/src/lib.rs:305:31 | 305 | #![cfg_attr(not(any(read_buf, bench)), forbid(unstable_features))] | ^^^^^ | = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(bench)");` to the top of the `build.rs` = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration ``` We also need to apply this suggestion for `read_buf`, because of a workaround documented for another upstream rust issue. Note, because our MSRV is 1.63 we have to add the new `build.rs` directives with the prefix `cargo:` instead of `cargo::` as described in the warning output, or we get a new error of the form: ``` error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, but the minimum supported Rust version of `rustls v0.23.5 (/home/daniel/Code/Rust/rustls/rustls)` is 1.63. See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs. ```
-rw-r--r--rustls/build.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/rustls/build.rs b/rustls/build.rs
index 9c73252a..2cf48121 100644
--- a/rustls/build.rs
+++ b/rustls/build.rs
@@ -9,5 +9,7 @@ fn main() {}
#[cfg(feature = "read_buf")]
#[rustversion::nightly]
fn main() {
+ println!("cargo:rustc-check-cfg=cfg(bench)");
+ println!("cargo:rustc-check-cfg=cfg(read_buf)");
println!("cargo:rustc-cfg=read_buf");
}