fix(CI): free-up disk, properly gate nightly feature and pre-install deps (#3735)

* fix(CI): pre-install tailwind and sass

* chore: retrigger CI

* fix(CI): properly set `erased_mode` in examples

* fix(CI): workflow logic install deps locally

* chore(CI): organized tailwind and sass versions

* fix: properly ignore nightly features on stable rustc

* fix(CI): typo

* fix: missing cfg attr

* fix: properly gate nightly module in `reactive_graph``

* fix: complete `rustc_nightly` cfg gate

* fix(CI): making even more space for CI workers

* fix: missing one more rustc_nightly gated feature

* fix: maximize the speed of cargo-all-features by limiting combinations to 2
This commit is contained in:
Saber Haj Rabiee
2025-03-20 14:28:07 -07:00
committed by GitHub
parent 9210636266
commit 52c770c7da
42 changed files with 185 additions and 48 deletions

View File

@@ -1,5 +1,4 @@
name: Changed Examples Matrix Call name: Changed Examples Matrix Call
on: on:
workflow_call: workflow_call:
inputs: inputs:
@@ -11,7 +10,6 @@ on:
matrix: matrix:
description: "Matrix" description: "Matrix"
value: ${{ jobs.get-example-changed.outputs.matrix }} value: ${{ jobs.get-example-changed.outputs.matrix }}
jobs: jobs:
get-example-changed: get-example-changed:
name: Get Changed Example Matrix name: Get Changed Example Matrix
@@ -23,7 +21,6 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Get example project directories that changed - name: Get example project directories that changed
id: changed-dirs id: changed-dirs
uses: tj-actions/changed-files@v45 uses: tj-actions/changed-files@v45
@@ -38,17 +35,17 @@ jobs:
!examples/*.md !examples/*.md
json: true json: true
quotepath: false quotepath: false
- name: List example project directories that changed - name: List example project directories that changed
run: echo '${{ steps.changed-dirs.outputs.all_changed_files }}' run: echo '${{ steps.changed-dirs.outputs.all_changed_files }}'
- name: Set Matrix - name: Set Matrix
id: set-matrix id: set-matrix
run: | run: |
if [ ${{ inputs.example_changed }} == 'true' ]; then if [ ${{ inputs.example_changed }} == 'true' ]; then
# Create matrix with changed directories # Create matrix with changed directories
echo "matrix={\"directory\":${{ steps.changed-dirs.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT" directories="${{ steps.changed-dirs.outputs.all_changed_files }}"
else else
directories="NO_CHANGE"
# Create matrix with one item to prevent an empty vector error # Create matrix with one item to prevent an empty vector error
echo "matrix={\"directory\":[\"NO_CHANGE\"], \"erased_mode\": [false, true]}" >> "$GITHUB_OUTPUT"
fi fi
echo "matrix={\"directory\":"$directories", \"erased_mode\": [false, true]}" >> "$GITHUB_OUTPUT"

View File

@@ -7,7 +7,7 @@ on:
type: string type: string
erased_mode: erased_mode:
required: true required: true
type: boolean type: boolean
cargo_make_task: cargo_make_task:
required: true required: true
type: string type: string
@@ -19,6 +19,8 @@ env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
DEBIAN_FRONTEND: noninteractive DEBIAN_FRONTEND: noninteractive
RUSTFLAGS: ${{ inputs.erased_mode && '--cfg erase_components' || '' }} RUSTFLAGS: ${{ inputs.erased_mode && '--cfg erase_components' || '' }}
LEPTOS_TAILWIND_VERSION: v4.0.14
LEPTOS_SASS_VERSION: 1.86.0
jobs: jobs:
test: test:
name: "Run ${{ inputs.cargo_make_task }} (${{ inputs.toolchain }}) (erased_mode: ${{ inputs.erased_mode }})" name: "Run ${{ inputs.cargo_make_task }} (${{ inputs.toolchain }}) (erased_mode: ${{ inputs.erased_mode }})"
@@ -30,11 +32,19 @@ jobs:
df -h df -h
sudo rm -rf /usr/local/.ghcup sudo rm -rf /usr/local/.ghcup
sudo rm -rf /opt/hostedtoolcache/CodeQL sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/lib/android/sdk/ndk sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/lib/node_modules
sudo apt-get clean sudo apt-get clean
sudo apt-get purge -y '^ghc-.*' '^dotnet-.*' '^llvm-.*' '^mono-.*' '^php.*' '^ruby.*'
sudo apt-get autoremove -y
sudo apt-get clean
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker system prune -af
docker image prune -af
docker volume prune -f
echo "Disk space after cleanup:" echo "Disk space after cleanup:"
df -h df -h
# Setup environment # Setup environment
@@ -125,8 +135,26 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y libglib2.0-dev libgio2.0-cil-dev libgraphene-1.0-dev libcairo2-dev libpango1.0-dev libgtk-4-dev sudo apt-get install -y libglib2.0-dev libgio2.0-cil-dev libgraphene-1.0-dev libcairo2-dev libpango1.0-dev libgtk-4-dev
fi fi
- name: Enter ${{ inputs.directory }}
run: |
cd ${{ inputs.directory }}
- name: Install Tailwind and Sass dependencies
if: contains(inputs.directory, 'examples')
run: |
tailwindcss_version=$(echo "$LEPTOS_TAILWIND_VERSION" | sed 's/^v//')
sass_version="$LEPTOS_SASS_VERSION"
pnpm add "tailwindcss@$tailwindcss_version" "@tailwindcss/cli@$tailwindcss_version" "sass@$sass_version"
echo "Tailwind CSS version:"
./node_modules/.bin/tailwindcss --version
echo "Sass version:"
./node_modules/.bin/sass --version
# Run Cargo Make Task # Run Cargo Make Task
- name: ${{ inputs.cargo_make_task }} - name: ${{ inputs.cargo_make_task }}
run: | run: |
cd ${{ inputs.directory }}
cargo make --profile=github-actions ${{ inputs.cargo_make_task }} cargo make --profile=github-actions ${{ inputs.cargo_make_task }}
- name: Clean up ${{ inputs.directory }}
run: |
cargo clean || true
rm -rf node_modules || true

6
Cargo.lock generated
View File

@@ -1796,6 +1796,7 @@ dependencies = [
"rand 0.8.5", "rand 0.8.5",
"reactive_graph", "reactive_graph",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"rustc_version",
"send_wrapper", "send_wrapper",
"serde", "serde",
"serde_json", "serde_json",
@@ -1953,6 +1954,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rstml", "rstml",
"rustc_version",
"serde", "serde",
"server_fn", "server_fn",
"server_fn_macro 0.8.0-beta", "server_fn_macro 0.8.0-beta",
@@ -1993,6 +1995,7 @@ dependencies = [
"or_poisoned", "or_poisoned",
"percent-encoding", "percent-encoding",
"reactive_graph", "reactive_graph",
"rustc_version",
"send_wrapper", "send_wrapper",
"tachys", "tachys",
"thiserror 2.0.12", "thiserror 2.0.12",
@@ -2742,6 +2745,7 @@ dependencies = [
"or_poisoned", "or_poisoned",
"pin-project-lite", "pin-project-lite",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"rustc_version",
"send_wrapper", "send_wrapper",
"serde", "serde",
"slotmap", "slotmap",
@@ -3295,6 +3299,7 @@ dependencies = [
"convert_case 0.6.0", "convert_case 0.6.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustc_version",
"syn 2.0.100", "syn 2.0.100",
"xxhash-rust", "xxhash-rust",
] ]
@@ -3520,6 +3525,7 @@ dependencies = [
"reactive_graph", "reactive_graph",
"reactive_stores", "reactive_stores",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"rustc_version",
"send_wrapper", "send_wrapper",
"serde", "serde",
"serde_json", "serde_json",

View File

@@ -81,6 +81,7 @@ opt-level = 'z'
[workspace.metadata.cargo-all-features] [workspace.metadata.cargo-all-features]
skip_feature_sets = [["csr", "ssr"], ["csr", "hydrate"], ["ssr", "hydrate"]] skip_feature_sets = [["csr", "ssr"], ["csr", "hydrate"], ["ssr", "hydrate"]]
max_combination_size = 2
[workspace.lints.rust] [workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [ unexpected_cfgs = { level = "warn", check-cfg = [

View File

@@ -34,3 +34,4 @@ rustdoc-args = ["--cfg", "docsrs"]
[package.metadata.cargo-all-features] [package.metadata.cargo-all-features]
denylist = ["tracing"] denylist = ["tracing"]
max_combination_size = 2

View File

@@ -1,5 +1,3 @@
use std::sync::LazyLock;
use leptos::prelude::*; use leptos::prelude::*;
use leptos_meta::*; use leptos_meta::*;
use leptos_router::{ use leptos_router::{
@@ -9,6 +7,7 @@ use leptos_router::{
ParamSegment, SsrMode, StaticSegment, ParamSegment, SsrMode, StaticSegment,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::sync::LazyLock;
use thiserror::Error; use thiserror::Error;
#[component] #[component]
@@ -18,14 +17,14 @@ pub fn App() -> impl IntoView {
let fallback = || view! { "Page not found." }.into_view(); let fallback = || view! { "Page not found." }.into_view();
view! { view! {
<Stylesheet id="leptos" href="/pkg/ssr_modes.css"/> <Stylesheet id="leptos" href="/pkg/ssr_modes.css" />
<Title text="Welcome to Leptos"/> <Title text="Welcome to Leptos" />
<Meta name="color-scheme" content="dark light"/> <Meta name="color-scheme" content="dark light" />
<Router> <Router>
<main> <main>
<FlatRoutes fallback> <FlatRoutes fallback>
// Well load the home page with out-of-order streaming and <Suspense/> // Well load the home page with out-of-order streaming and <Suspense/>
<Route path=StaticSegment("") view=HomePage/> <Route path=StaticSegment("") view=HomePage />
// We'll load the posts with async rendering, so they can set // We'll load the posts with async rendering, so they can set
// the title and metadata *after* loading the data // the title and metadata *after* loading the data
@@ -115,8 +114,8 @@ fn Post() -> impl IntoView {
// since we're using async rendering for this page, // since we're using async rendering for this page,
// this metadata should be included in the actual HTML <head> // this metadata should be included in the actual HTML <head>
// when it's first served // when it's first served
<Title text=post.title/> <Title text=post.title />
<Meta name="description" content=post.content/> <Meta name="description" content=post.content />
}), }),
_ => Err(PostError::ServerError), _ => Err(PostError::ServerError),
} }

View File

@@ -1,3 +1,3 @@
body { body {
font-family: sans-serif; font-family: sans-serif;
} }

View File

@@ -39,3 +39,4 @@ tracing = ["dep:tracing"]
[package.metadata.cargo-all-features] [package.metadata.cargo-all-features]
denylist = ["tracing"] denylist = ["tracing"]
max_combination_size = 2

View File

@@ -51,3 +51,4 @@ rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features] [package.metadata.cargo-all-features]
denylist = ["tracing"] denylist = ["tracing"]
max_combination_size = 2

View File

@@ -96,6 +96,9 @@ trace-component-props = [
] ]
delegation = ["tachys/delegation"] delegation = ["tachys/delegation"]
[build-dependencies]
rustc_version = "0.4.1"
# Having an erasure feature rather than normal --cfg erase_components for the proc macro crate is a workaround for this rust issue: # Having an erasure feature rather than normal --cfg erase_components for the proc macro crate is a workaround for this rust issue:
# https://github.com/rust-lang/cargo/issues/4423 # https://github.com/rust-lang/cargo/issues/4423
# TLDR proc macros will ignore RUSTFLAGS when --target is specified on the cargo command. # TLDR proc macros will ignore RUSTFLAGS when --target is specified on the cargo command.
@@ -160,9 +163,13 @@ skip_feature_sets = [
"rustls", "rustls",
], ],
] ]
max_combination_size = 2
[package.metadata.docs.rs] [package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"] rustdoc-args = ["--generate-link-to-definition"]
[lints.rust] [lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] } unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)',
'cfg(rustc_nightly)',
] }

8
leptos/build.rs Normal file
View File

@@ -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");
}
}

View File

@@ -141,8 +141,8 @@
//! } //! }
//! ``` //! ```
#![cfg_attr(feature = "nightly", feature(fn_traits))] #![cfg_attr(all(feature = "nightly", rustc_nightly), feature(fn_traits))]
#![cfg_attr(feature = "nightly", feature(unboxed_closures))] #![cfg_attr(all(feature = "nightly", rustc_nightly), feature(unboxed_closures))]
extern crate self as leptos; extern crate self as leptos;

View File

@@ -37,6 +37,7 @@ rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features] [package.metadata.cargo-all-features]
denylist = ["tracing"] denylist = ["tracing"]
max_combination_size = 2
[lints.rust] [lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] } unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] }

View File

@@ -19,3 +19,6 @@ futures = "0.3.0"
default = ["ssr"] default = ["ssr"]
ssr = ["leptos/ssr", "dep:actix-files", "dep:actix-web"] ssr = ["leptos/ssr", "dep:actix-files", "dep:actix-web"]
hydrate = ["leptos/hydrate", "dep:wasm-bindgen", "dep:gloo"] hydrate = ["leptos/hydrate", "dep:wasm-bindgen", "dep:gloo"]
[package.metadata.cargo-all-features]
max_combination_size = 2

View File

@@ -39,6 +39,9 @@ server_fn = { path = "../server_fn", features = ["cbor"] }
insta = "1.41" insta = "1.41"
serde = "1.0" serde = "1.0"
[build-dependencies]
rustc_version = "0.4.1"
[features] [features]
csr = [] csr = []
hydrate = [] hydrate = []
@@ -87,6 +90,10 @@ skip_feature_sets = [
"axum", "axum",
], ],
] ]
max_combination_size = 2
[package.metadata.docs.rs] [package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"] rustdoc-args = ["--generate-link-to-definition"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rustc_nightly)'] }

8
leptos_macro/build.rs Normal file
View File

@@ -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");
}
}

View File

@@ -1,6 +1,6 @@
//! Macros for use with the Leptos framework. //! Macros for use with the Leptos framework.
#![cfg_attr(feature = "nightly", feature(proc_macro_span))] #![cfg_attr(all(feature = "nightly", rustc_nightly), feature(proc_macro_span))]
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
// to prevent warnings from popping up when a nightly feature is stabilized // to prevent warnings from popping up when a nightly feature is stabilized
#![allow(stable_features)] #![allow(stable_features)]
@@ -359,7 +359,7 @@ fn view_macro_impl(tokens: TokenStream, template: bool) -> TokenStream {
fn normalized_call_site(site: proc_macro::Span) -> Option<String> { fn normalized_call_site(site: proc_macro::Span) -> Option<String> {
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(all(debug_assertions, feature = "nightly"))] { if #[cfg(all(debug_assertions, feature = "nightly", rustc_nightly))] {
Some(leptos_hot_reload::span_to_stable_id( Some(leptos_hot_reload::span_to_stable_id(
site.source_file().path(), site.source_file().path(),
site.start().line() site.start().line()

View File

@@ -327,9 +327,9 @@ fn is_attr_let(key: &NodeName) -> bool {
} }
} }
pub fn items_to_clone_to_tokens<'a>( pub fn items_to_clone_to_tokens(
items_to_clone: &'a [Ident], items_to_clone: &[Ident],
) -> impl Iterator<Item = TokenStream> + 'a { ) -> impl Iterator<Item = TokenStream> + '_ {
items_to_clone.iter().map(|ident| { items_to_clone.iter().map(|ident| {
let ident_ref = quote_spanned!(ident.span()=> &#ident); let ident_ref = quote_spanned!(ident.span()=> &#ident);
quote! { let #ident = ::core::clone::Clone::clone(#ident_ref); } quote! { let #ident = ::core::clone::Clone::clone(#ident_ref); }

View File

@@ -611,7 +611,7 @@ fn node_to_tokens(
fn text_to_tokens(text: &LitStr) -> TokenStream { fn text_to_tokens(text: &LitStr) -> TokenStream {
// on nightly, can use static string optimization // on nightly, can use static string optimization
if cfg!(feature = "nightly") { if cfg!(all(feature = "nightly", rustc_nightly)) {
quote! { quote! {
::leptos::tachys::view::static_types::Static::<#text> ::leptos::tachys::view::static_types::Static::<#text>
} }
@@ -1512,7 +1512,7 @@ fn attribute_value(
Some(value) => match &value.value { Some(value) => match &value.value {
KVAttributeValue::Expr(expr) => { KVAttributeValue::Expr(expr) => {
if let Expr::Lit(lit) = expr { if let Expr::Lit(lit) = expr {
if cfg!(feature = "nightly") { if cfg!(all(feature = "nightly", rustc_nightly)) {
if let Lit::Str(str) = &lit.lit { if let Lit::Str(str) = &lit.lit {
return quote! { return quote! {
::leptos::tachys::view::static_types::Static::<#str> ::leptos::tachys::view::static_types::Static::<#str>

View File

@@ -43,6 +43,7 @@ tracing = ["dep:tracing"]
[package.metadata.cargo-all-features] [package.metadata.cargo-all-features]
denylist = ["tracing"] denylist = ["tracing"]
max_combination_size = 2
[package.metadata.docs.rs] [package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"] rustdoc-args = ["--generate-link-to-definition"]

View File

@@ -33,6 +33,7 @@ rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features] [package.metadata.cargo-all-features]
denylist = ["tracing"] denylist = ["tracing"]
max_combination_size = 2
[lints.rust] [lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] } unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] }

View File

@@ -32,6 +32,9 @@ tokio = { version = "1.43", features = ["rt-multi-thread", "macros"] }
tokio-test = { version = "0.4.4" } tokio-test = { version = "0.4.4" }
any_spawner = { workspace = true, features = ["futures-executor", "tokio"] } any_spawner = { workspace = true, features = ["futures-executor", "tokio"] }
[build-dependencies]
rustc_version = "0.4.1"
[features] [features]
nightly = [] nightly = []
serde = ["dep:serde"] serde = ["dep:serde"]
@@ -47,6 +50,10 @@ rustdoc-args = ["--cfg", "docsrs"]
[package.metadata.cargo-all-features] [package.metadata.cargo-all-features]
denylist = ["tracing"] denylist = ["tracing"]
max_combination_size = 2
[lints.rust] [lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] } unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)',
'cfg(rustc_nightly)',
] }

8
reactive_graph/build.rs Normal file
View File

@@ -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");
}
}

View File

@@ -68,8 +68,8 @@
//! [Reactively](https://github.com/modderme123/reactively), as described //! [Reactively](https://github.com/modderme123/reactively), as described
//! [in this article](https://dev.to/modderme123/super-charging-fine-grained-reactive-performance-47ph). //! [in this article](https://dev.to/modderme123/super-charging-fine-grained-reactive-performance-47ph).
#![cfg_attr(feature = "nightly", feature(unboxed_closures))] #![cfg_attr(all(feature = "nightly", rustc_nightly), feature(unboxed_closures))]
#![cfg_attr(feature = "nightly", feature(fn_traits))] #![cfg_attr(all(feature = "nightly", rustc_nightly), feature(fn_traits))]
#![deny(missing_docs)] #![deny(missing_docs)]
use std::{fmt::Arguments, future::Future}; use std::{fmt::Arguments, future::Future};
@@ -92,7 +92,7 @@ pub mod wrappers;
use computed::ScopedFuture; use computed::ScopedFuture;
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
mod nightly; mod nightly;
/// Reexports frequently-used traits. /// Reexports frequently-used traits.

View File

@@ -56,6 +56,9 @@ features = [
"Response", "Response",
] ]
[build-dependencies]
rustc_version = "0.4.1"
[features] [features]
tracing = ["dep:tracing"] tracing = ["dep:tracing"]
ssr = ["dep:percent-encoding"] ssr = ["dep:percent-encoding"]
@@ -66,9 +69,11 @@ rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features] [package.metadata.cargo-all-features]
denylist = ["tracing"] denylist = ["tracing"]
max_combination_size = 2
[lints.rust] [lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [ unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)', 'cfg(leptos_debuginfo)',
'cfg(erase_components)', 'cfg(erase_components)',
'cfg(rustc_nightly)',
] } ] }

8
router/build.rs Normal file
View File

@@ -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");
}
}

View File

@@ -121,8 +121,8 @@
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![deny(missing_docs)] #![deny(missing_docs)]
#![cfg_attr(feature = "nightly", feature(auto_traits))] #![cfg_attr(all(feature = "nightly", rustc_nightly), feature(auto_traits))]
#![cfg_attr(feature = "nightly", feature(negative_impls))] #![cfg_attr(all(feature = "nightly", rustc_nightly), feature(negative_impls))]
/// Components for route definition and for enhanced links and forms. /// Components for route definition and for enhanced links and forms.
pub mod components; pub mod components;

View File

@@ -200,7 +200,7 @@ where
} }
// TODO can we support Option<T> and T in a non-nightly way? // TODO can we support Option<T> and T in a non-nightly way?
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
mod option_param { mod option_param {
use super::{IntoParam, ParamsError}; use super::{IntoParam, ParamsError};
use std::{str::FromStr, sync::Arc}; use std::{str::FromStr, sync::Arc};

View File

@@ -231,6 +231,7 @@ skip_feature_sets = [
"rkyv", "rkyv",
], ],
] ]
max_combination_size = 2
[lints.rust] [lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] } unexpected_cfgs = { level = "warn", check-cfg = ['cfg(leptos_debuginfo)'] }

View File

@@ -19,3 +19,6 @@ nightly = ["server_fn_macro/nightly"]
ssr = ["server_fn_macro/ssr"] ssr = ["server_fn_macro/ssr"]
actix = ["server_fn_macro/actix"] actix = ["server_fn_macro/actix"]
axum = ["server_fn_macro/axum"] axum = ["server_fn_macro/axum"]
[package.metadata.cargo-all-features]
max_combination_size = 2

View File

@@ -16,6 +16,11 @@ xxhash-rust = { version = "0.8.12", features = ["const_xxh64"] }
const_format = "0.2.33" const_format = "0.2.33"
convert_case = "0.6.0" convert_case = "0.6.0"
[build-dependencies]
rustc_version = "0.4.1"
[features] [features]
nightly = [] nightly = []
ssr = [] ssr = []
@@ -26,3 +31,9 @@ reqwest = []
[package.metadata.docs.rs] [package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"] rustdoc-args = ["--generate-link-to-definition"]
[package.metadata.cargo-all-features]
max_combination_size = 2
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rustc_nightly)'] }

8
server_fn_macro/build.rs Normal file
View File

@@ -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");
}
}

View File

@@ -1,4 +1,4 @@
#![cfg_attr(feature = "nightly", feature(proc_macro_span))] #![cfg_attr(all(feature = "nightly", rustc_nightly), feature(proc_macro_span))]
#![forbid(unsafe_code)] #![forbid(unsafe_code)]
#![deny(missing_docs)] #![deny(missing_docs)]

View File

@@ -169,6 +169,9 @@ serde_json = { version = "1", optional = true }
tokio-test = "0.4.4" tokio-test = "0.4.4"
tokio = { version = "1.43", features = ["rt", "macros"] } tokio = { version = "1.43", features = ["rt", "macros"] }
[build-dependencies]
rustc_version = "0.4.1"
[features] [features]
default = ["testing"] default = ["testing"]
delegation = [] # enables event delegation delegation = [] # enables event delegation
@@ -200,9 +203,11 @@ skip_feature_sets = [
"delegation", "delegation",
], ],
] ]
max_combination_size = 2
[lints.rust] [lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [ unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(leptos_debuginfo)', 'cfg(leptos_debuginfo)',
'cfg(erase_components)', 'cfg(erase_components)',
'cfg(rustc_nightly)',
] } ] }

8
tachys/build.rs Normal file
View File

@@ -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");
}
}

View File

@@ -170,7 +170,7 @@ impl CustomAttributeKey for Arc<str> {
const KEY: &'static str = ""; const KEY: &'static str = "";
} }
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
impl<const K: &'static str> CustomAttributeKey impl<const K: &'static str> CustomAttributeKey
for crate::view::static_types::Static<K> for crate::view::static_types::Static<K>
{ {

View File

@@ -202,7 +202,7 @@ impl<'a> AttributeValue for &'a str {
} }
} }
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> AttributeValue impl<const V: &'static str> AttributeValue
for crate::view::static_types::Static<V> for crate::view::static_types::Static<V>
{ {

View File

@@ -571,7 +571,7 @@ impl IntoClass for (&'static str, bool) {
} }
} }
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> IntoClass for crate::view::static_types::Static<V> { impl<const V: &'static str> IntoClass for crate::view::static_types::Static<V> {
const TEMPLATE: &'static str = V; const TEMPLATE: &'static str = V;

View File

@@ -745,7 +745,7 @@ where
/* /*
#[cfg(all(test, feature = "testing"))] #[cfg(all(test, feature = "testing"))]
mod tests { mod tests {
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
use super::RenderHtml; use super::RenderHtml;
use super::{main, p, HtmlElement}; use super::{main, p, HtmlElement};
use crate::{ use crate::{
@@ -782,7 +782,7 @@ mod tests {
); );
} }
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
#[test] #[test]
fn html_render_allocates_appropriate_buffer() { fn html_render_allocates_appropriate_buffer() {
use crate::view::static_types::Static; use crate::view::static_types::Static;

View File

@@ -2,7 +2,7 @@ use super::attribute::{
maybe_next_attr_erasure_macros::next_attr_output_type, Attribute, maybe_next_attr_erasure_macros::next_attr_output_type, Attribute,
NextAttribute, NextAttribute,
}; };
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
use crate::view::static_types::Static; use crate::view::static_types::Static;
use crate::{ use crate::{
html::attribute::maybe_next_attr_erasure_macros::next_attr_combine, html::attribute::maybe_next_attr_erasure_macros::next_attr_combine,
@@ -661,7 +661,7 @@ impl_style_value!(String);
#[cfg(feature = "oco")] #[cfg(feature = "oco")]
impl_style_value!(oco_ref::Oco<'static, str>); impl_style_value!(oco_ref::Oco<'static, str>);
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> IntoStyleValue for Static<V> { impl<const V: &'static str> IntoStyleValue for Static<V> {
type AsyncOutput = Self; type AsyncOutput = Self;
type State = Self; type State = Self;
@@ -707,7 +707,7 @@ impl<const V: &'static str> IntoStyleValue for Static<V> {
} }
} }
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> IntoStyleValue for Option<Static<V>> { impl<const V: &'static str> IntoStyleValue for Option<Static<V>> {
type AsyncOutput = Self; type AsyncOutput = Self;
type State = Self; type State = Self;
@@ -764,7 +764,7 @@ impl<const V: &'static str> IntoStyleValue for Option<Static<V>> {
} }
} }
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
impl<const V: &'static str> IntoStyle for crate::view::static_types::Static<V> { impl<const V: &'static str> IntoStyle for crate::view::static_types::Static<V> {
type AsyncOutput = Self; type AsyncOutput = Self;
type State = (); type State = ();

View File

@@ -6,7 +6,10 @@
// this is specifically used for `unsized_const_params` below // this is specifically used for `unsized_const_params` below
// this allows us to use const generic &'static str for static text nodes and attributes // this allows us to use const generic &'static str for static text nodes and attributes
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![cfg_attr(feature = "nightly", feature(unsized_const_params))] #![cfg_attr(
all(feature = "nightly", rustc_nightly),
feature(unsized_const_params)
)]
#![deny(missing_docs)] #![deny(missing_docs)]
/// Commonly-used traits. /// Commonly-used traits.

View File

@@ -22,7 +22,7 @@ pub mod iterators;
pub mod keyed; pub mod keyed;
mod primitives; mod primitives;
/// Optimized types for static strings known at compile time. /// Optimized types for static strings known at compile time.
#[cfg(feature = "nightly")] #[cfg(all(feature = "nightly", rustc_nightly))]
pub mod static_types; pub mod static_types;
/// View implementation for string types. /// View implementation for string types.
pub mod strings; pub mod strings;