fix smoke from builds produced by --all-features

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-05-19 13:02:55 +00:00 committed by June 🍓🦴
parent fdc9a9a1b8
commit 74832bdc47
9 changed files with 21 additions and 22 deletions

View file

@ -526,7 +526,6 @@ inherits = "release"
# To enable hot-reloading:
# 1. Uncomment all of the rustflags here.
# 2. Uncomment crate-type=dylib in src/*/Cargo.toml and deps/rust-rocksdb/Cargo.toml
# 2. Build with the 'mods' feature.
#
# opt-level, mir-opt-level, validate-mir are not known to interfere with reloading
# and can be raised if build times are tolerable.
@ -540,6 +539,7 @@ incremental = true
codegen-units = 64
rpath = true
#rustflags = [
# '--cfg', 'conduit_mods',
# '-Ztime-passes',
# '-Zmir-opt-level=0',
# '-Zvalidate-mir=false',
@ -560,6 +560,7 @@ rpath = true
inherits = "dev"
incremental = false
#rustflags = [
# '--cfg', 'conduit_mods',
# '-Ztime-passes',
# '-Zmir-opt-level=0',
# '-Ztls-model=initial-exec',
@ -580,6 +581,7 @@ incremental = false
inherits = "dev"
incremental = false
#rustflags = [
# '--cfg', 'conduit_mods',
# '-Ztime-passes',
# '-Zmir-opt-level=0',
# '-Zvalidate-mir=false',
@ -601,6 +603,7 @@ incremental = false
codegen-units = 1
opt-level = 'z'
#rustflags = [
# '--cfg', 'conduit_mods',
# '-Ztls-model=initial-exec',
# '-Cprefer-dynamic=true',
# '-Zstaticlib-prefer-dynamic=true',
@ -621,6 +624,7 @@ incremental = false
codegen-units = 1
opt-level = 'z'
#rustflags = [
# '--cfg', 'conduit_mods',
# '-Ztls-model=global-dynamic',
# '-Cprefer-dynamic=true',
# '-Zstaticlib-prefer-dynamic=true',
@ -655,6 +659,11 @@ unreachable_pub = "warn"
# this seems to suggest broken code and is not working correctly
unused_braces = "allow"
# cfgs cannot be limited to features or cargo build --all-features panics for unsuspecting users.
# cfgs cannot be limited to expected cfgs or their de facto non-transitive/opt-in use-case e.g.
# tokio_unstable will warn.
unexpected_cfgs = "allow"
# some sadness
missing_docs = "allow"

View file

@ -63,10 +63,6 @@ brotli_compression = [
]
perf_measurements = []
sentry_telemetry = []
mods = [
"dep:libloading"
]
panic_trap = []
[dependencies]
async-trait.workspace = true
@ -86,7 +82,6 @@ infer.workspace = true
ipaddress.workspace = true
itertools.workspace = true
libloading.workspace = true
libloading.optional = true
log.workspace = true
lru-cache.workspace = true
parking_lot.optional = true

View file

@ -62,7 +62,6 @@ fn panic_handler(info: &PanicInfo<'_>, next: &dyn Fn(&PanicInfo<'_>)) {
}
#[inline(always)]
#[allow(unexpected_cfgs)]
pub fn trap() {
#[cfg(core_intrinsics)]
//SAFETY: embeds llvm intrinsic for hardware breakpoint

View file

@ -14,8 +14,8 @@ pub use pducount::PduCount;
pub use server::Server;
pub use utils::conduwuit_version;
#[cfg(not(feature = "mods"))]
mod mods {
#[cfg(not(conduit_mods))]
pub mod mods {
#[macro_export]
macro_rules! mod_ctor {
() => {};

View file

@ -1,4 +1,4 @@
#![cfg(feature = "mods")]
#![cfg(conduit_mods)]
pub(crate) use libloading::os::unix::{Library, Symbol};

View file

@ -67,8 +67,6 @@ perf_measurements = [
jemalloc = [
"dep:tikv-jemallocator",
]
panic_trap = []
mods = []
[dependencies]
conduit-router.workspace = true

View file

@ -37,7 +37,7 @@ fn main() -> Result<(), Error> {
/// Operate the server normally in release-mode static builds. This will start,
/// run and stop the server within the asynchronous runtime.
#[cfg(not(feature = "mods"))]
#[cfg(not(conduit_mods))]
async fn async_main(server: Arc<Server>) -> Result<(), Error> {
extern crate conduit_router as router;
use tracing::error;
@ -64,7 +64,7 @@ async fn async_main(server: Arc<Server>) -> Result<(), Error> {
/// Operate the server in developer-mode dynamic builds. This will start, run,
/// and hot-reload portions of the server as-needed before returning for an
/// actual shutdown. This is not available in release-mode or static builds.
#[cfg(feature = "mods")]
#[cfg(conduit_mods)]
async fn async_main(server: Arc<Server>) -> Result<(), Error> {
let mut starts = true;
let mut reloads = true;

View file

@ -1,6 +1,4 @@
#![cfg(feature = "mods")]
#[cfg(not(any(clippy, debug_assertions, doctest, test)))]
compile_error!("Feature 'mods' is only available in developer builds");
#![cfg(conduit_mods)]
use std::{
future::Future,
@ -26,7 +24,7 @@ const MODULE_NAMES: &[&str] = &[
"conduit_router",
];
#[cfg(feature = "panic_trap")]
#[cfg(panic_trap)]
conduit::mod_init! {{
conduit::debug::set_panic_trap();
}}

View file

@ -21,8 +21,8 @@ pub(crate) struct Server {
#[cfg(feature = "sentry_telemetry")]
_sentry_guard: Option<sentry::ClientInitGuard>,
#[cfg(conduit_mods)]
// Module instances; TODO: move to mods::loaded mgmt vector
#[cfg(feature = "mods")]
pub(crate) mods: tokio::sync::RwLock<Vec<conduit::mods::Module>>,
}
@ -52,7 +52,7 @@ impl Server {
#[cfg(feature = "sentry_telemetry")]
_sentry_guard: sentry_guard,
#[cfg(feature = "mods")]
#[cfg(conduit_mods)]
mods: tokio::sync::RwLock::new(Vec::new()),
}))
}
@ -109,7 +109,7 @@ fn init_tracing(config: &Config) -> (LogLevelReloadHandles, TracingFlameGuard) {
let mut reload_handles = Vec::<Box<dyn ReloadHandle<EnvFilter> + Send + Sync>>::new();
let subscriber = registry;
#[cfg(feature = "tokio_console")]
#[cfg(all(feature = "tokio_console", tokio_unstable))]
let subscriber = {
let console_layer = console_subscriber::spawn();
subscriber.with(console_layer)
@ -176,7 +176,7 @@ fn init_tracing(config: &Config) -> (LogLevelReloadHandles, TracingFlameGuard) {
tracing::subscriber::set_global_default(subscriber).unwrap();
#[cfg(all(feature = "tokio_console", feature = "release_max_log_level"))]
#[cfg(all(feature = "tokio_console", feature = "release_max_log_level", tokio_unstable))]
tracing::error!(
"'tokio_console' feature and 'release_max_log_level' feature are incompatible, because console-subscriber \
needs access to trace-level events. 'release_max_log_level' must be disabled to use tokio-console."