diff --git a/Cargo.lock b/Cargo.lock index ca72aa902..a9b4e434e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3323,6 +3323,7 @@ dependencies = [ "reqwest", "rkyv", "rmp-serde", + "rustc_version", "rustversion", "send_wrapper", "serde", diff --git a/server_fn/Cargo.toml b/server_fn/Cargo.toml index 3aca10cba..176550671 100644 --- a/server_fn/Cargo.toml +++ b/server_fn/Cargo.toml @@ -16,7 +16,7 @@ server_fn_macro_default = { workspace = true } const_format = "0.2.33" const-str = "0.6.2" xxhash-rust = { version = "0.8.12", features = ["const_xxh64"] } -rustversion = { workspace = true} +rustversion = { workspace = true } # used across multiple features serde = { version = "1.0", features = ["derive"] } send_wrapper = { version = "0.6.0", features = ["futures"], optional = true } @@ -82,6 +82,9 @@ url = "2" pin-project-lite = "0.2.15" tokio = { version = "1.43.0", features = ["rt"], optional = true } +[build-dependencies] +rustc_version = "0.4.1" + [dev-dependencies] trybuild = { workspace = true } @@ -238,4 +241,7 @@ skip_feature_sets = [ max_combination_size = 2 [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] } +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(leptos_debuginfo)', + 'cfg(rustc_nightly)', +] } diff --git a/server_fn/build.rs b/server_fn/build.rs new file mode 100644 index 000000000..26023daae --- /dev/null +++ b/server_fn/build.rs @@ -0,0 +1,8 @@ +use rustc_version::{version_meta, Channel}; + +fn main() { + // Set cfg flags depending on release channel + if matches!(version_meta().unwrap().channel, Channel::Nightly) { + println!("cargo:rustc-cfg=rustc_nightly"); + } +} diff --git a/server_fn/tests/server_macro.rs b/server_fn/tests/server_macro.rs index 146390a8a..c117dbb97 100644 --- a/server_fn/tests/server_macro.rs +++ b/server_fn/tests/server_macro.rs @@ -3,6 +3,7 @@ // multiple combinations of features are tested. This ensures this file is only // run when **only** the browser feature is enabled. #![cfg(all( + rustc_nightly, feature = "browser", not(any( feature = "postcard",