Skip to content

Commit b452971

Browse files
authored
meshtls: replace build script with compile_error! macro (#1357)
Currently, the `linkerd-meshtls` crate uses a build script to ensure that at least one TLS implementation feature flag is enabled when compiling the crate. This can be done much more simply using the `compile_error!` macro. Removing the build script may make compilation (very slightly) faster, because the build script no longer needs to be compiled. Also, the error message is a bit nicer, since it just prints the error, rather than "failed to run custom build command".
1 parent 824d784 commit b452971

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

linkerd/meshtls/build.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

linkerd/meshtls/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#![deny(warnings, rust_2018_idioms)]
22
#![forbid(unsafe_code)]
33

4+
// Emit a compile-time error if no TLS implementations are enabled. When adding
5+
// new implementations, add their feature flags here!
6+
#[cfg(not(any(feature = "rustls")))]
7+
compile_error!("at least one of the following TLS implementations must be enabled: 'rustls'");
8+
49
mod client;
510
pub mod creds;
611
mod server;

0 commit comments

Comments
 (0)