Work around a Rust problem tripped by working around a Rust problem, which in turn was tripped by working around a Rust problem We are now several layers deep in working around problems in this language. Rust's bindgen cannot even bind headers that reference <stdio.h> without tripping a Rust warning due to https://github.com/rust-lang/rust-bindgen/issues/2807 As a result we need to manually suppress the warning. However, that warning is not available until newer Rusts, so trying to suppress the warning causes a different warning in older Rusts. https://boringssl-review.googlesource.com/c/boringssl/+/80707 attempted to work around this Rust bug by using cfg_version, but that broke the Chromium build because it is not part of Stable Rust. Stable Rust has not yet caught up to C89 in having some way to condition code on version. Instead, suppress the future lint by just suppresing unknown lints. Also add some comments so we remember where all this nonsense came from. This unbreaks the Chromium roll. Change-Id: I47dcedadae5695b2edab05dfbc08a9cd8cfafdc1 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80747 Commit-Queue: Adam Langley <agl@google.com> Auto-Submit: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com>
diff --git a/rust/bssl-sys/src/lib.rs b/rust/bssl-sys/src/lib.rs index c306e7a..a55bdff 100644 --- a/rust/bssl-sys/src/lib.rs +++ b/rust/bssl-sys/src/lib.rs
@@ -1,11 +1,16 @@ #![no_std] +// unnecessary_transmutes, needed to work around a Rust bug, is not available in +// older Rusts. Stable lacks any way to condition code on Rust version, so the +// workaroud for a Rust bug below needs this additional Rust workaround. +#![allow(unknown_lints)] + #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] + +// Work around https://github.com/rust-lang/rust-bindgen/issues/2807 #![allow(unnecessary_transmutes)] -#![feature(cfg_version)] -#![cfg_attr(version("1.88"), allow(unnecessary_transmutes))] use core::ffi::c_ulong;