Skip to content

Commit

Permalink
Emit compile error when no runtime feature specified
Browse files Browse the repository at this point in the history
  • Loading branch information
mzeitlin11 committed Oct 29, 2022
1 parent 9da5cd9 commit af1aef5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@
#![warn(clippy::unwrap_used, clippy::missing_errors_doc, clippy::missing_panics_doc)]
#![forbid(unsafe_code)]

// Give a clear error when a required runtime error is not present. Would be better for this
// to be a fatal error preventing emission of further compile errors relating to lack of
// a runtime feature, but that does not seem currently possible:
// https://github.com/rust-lang/rust/issues/68838

#[cfg(not(any(
feature = "runtime-tokio-hyper",
feature = "runtime-tokio-hyper-rustls",
feature = "runtime-blocking",
feature = "runtime-blocking-rustls",
feature = "runtime-async-std-surf",
)))]
compile_error!(
r"one of the following runtime features must be enabled:
[
'runtime-tokio-hyper',
'runtime-tokio-hyper-rustls',
'runtime-blocking',
'runtime-blocking-rustls',
'runtime-async-std-surf'
]"
);

mod client;
mod error;
mod ids;
Expand Down

0 comments on commit af1aef5

Please sign in to comment.