mirror of https://github.com/yewstack/yew
Convert nightly from a feature flag to a compiler flag (#2827)
* `nightly_yew` compiler flag instead of `nightly` feature * update ci * update ci: 2 * fmt & nightly_yew for examples * update size-cmp too
This commit is contained in:
parent
9e602b94ff
commit
a4e70914ac
|
@ -35,7 +35,7 @@ jobs:
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: clippy
|
command: clippy
|
||||||
args: --all-targets --features "csr,ssr,hydration,tokio" --profile ${{ matrix.profile }} -- -D warnings
|
args: --all-targets --all-features --profile ${{ matrix.profile }} -- -D warnings
|
||||||
|
|
||||||
- name: Lint feature soundness
|
- name: Lint feature soundness
|
||||||
if: matrix.profile == 'dev'
|
if: matrix.profile == 'dev'
|
||||||
|
@ -181,15 +181,23 @@ jobs:
|
||||||
|
|
||||||
- name: Run native tests
|
- name: Run native tests
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
env:
|
||||||
|
# workaround for lack of ternary operator
|
||||||
|
# see https://github.com/orgs/community/discussions/25725
|
||||||
|
RUSTFLAGS: ${{ matrix.toolchain == 'nightly && '--cfg nightly_yew' || '' }}
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
args: --all-targets --workspace --exclude yew
|
args: --all-targets --workspace --exclude yew
|
||||||
|
|
||||||
- name: Run native tests for yew
|
- name: Run native tests for yew
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
env:
|
||||||
|
# workaround for lack of ternary operator
|
||||||
|
# see https://github.com/orgs/community/discussions/25725
|
||||||
|
RUSTFLAGS: ${{ matrix.toolchain == 'nightly && '--cfg nightly_yew' || '' }}
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
args: -p yew --features "csr,ssr,hydration,tokio"
|
args: -p yew --all-features
|
||||||
|
|
||||||
test-lints:
|
test-lints:
|
||||||
name: Test lints on nightly
|
name: Test lints on nightly
|
||||||
|
@ -207,6 +215,8 @@ jobs:
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
env:
|
||||||
|
RUSTFLAGS: --cfg nightly_yew
|
||||||
with:
|
with:
|
||||||
command: test
|
command: test
|
||||||
args: -p yew-macro test_html_lints --features lints
|
args: -p yew-macro test_html_lints --features lints
|
||||||
|
|
|
@ -66,6 +66,7 @@ jobs:
|
||||||
working-directory: current-pr/examples
|
working-directory: current-pr/examples
|
||||||
env:
|
env:
|
||||||
RUSTUP_TOOLCHAIN: nightly
|
RUSTUP_TOOLCHAIN: nightly
|
||||||
|
RUSTFLAGS: --cfg nightly_yew
|
||||||
|
|
||||||
- name: Collect size information
|
- name: Collect size information
|
||||||
run: python3 current-pr/ci/collect_sizes.py
|
run: python3 current-pr/ci/collect_sizes.py
|
||||||
|
|
|
@ -24,12 +24,13 @@ for path in examples/*; do
|
||||||
# shellcheck disable=SC2164
|
# shellcheck disable=SC2164
|
||||||
cd "$path"
|
cd "$path"
|
||||||
dist_dir="$output/$example"
|
dist_dir="$output/$example"
|
||||||
|
export RUSTFLAGS="--cfg nightly_yew"
|
||||||
if [[ "$example" == "boids" || "$example" == "password_strength" ]]; then
|
if [[ "$example" == "boids" || "$example" == "password_strength" ]]; then
|
||||||
# works around issue rust-lang/rust#96486
|
# works around issue rust-lang/rust#96486
|
||||||
# where the compiler forgets to link some symbols connected to const_eval
|
# where the compiler forgets to link some symbols connected to const_eval
|
||||||
# only an issue on nightly and with build-std enabled which we do for code size
|
# only an issue on nightly and with build-std enabled which we do for code size
|
||||||
# this deoptimizes only the examples that otherwise fail to build
|
# this deoptimizes only the examples that otherwise fail to build
|
||||||
export RUSTFLAGS="-Zshare-generics=n -Clto=thin"
|
export RUSTFLAGS="-Zshare-generics=n -Clto=thin $RUSTFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trunk build --release --dist "$dist_dir" --public-url "$PUBLIC_URL_PREFIX$example"
|
trunk build --release --dist "$dist_dir" --public-url "$PUBLIC_URL_PREFIX$example"
|
||||||
|
|
|
@ -34,4 +34,3 @@ yew = { path = "../yew" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
lints = []
|
lints = []
|
||||||
nightly = []
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ impl ToTokens for HtmlElement {
|
||||||
}}
|
}}
|
||||||
});
|
});
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(nightly_yew)]
|
||||||
let invalid_void_tag_msg_start = {
|
let invalid_void_tag_msg_start = {
|
||||||
let span = vtag.span().unwrap();
|
let span = vtag.span().unwrap();
|
||||||
let source_file = span.source_file().path();
|
let source_file = span.source_file().path();
|
||||||
|
@ -369,7 +369,7 @@ impl ToTokens for HtmlElement {
|
||||||
format!("[{}:{}:{}] ", source_file, start.line, start.column)
|
format!("[{}:{}:{}] ", source_file, start.line, start.column)
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "nightly"))]
|
#[cfg(not(nightly_yew))]
|
||||||
let invalid_void_tag_msg_start = "";
|
let invalid_void_tag_msg_start = "";
|
||||||
|
|
||||||
// this way we get a nice error message (with the correct span) when the expression
|
// this way we get a nice error message (with the correct span) when the expression
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![cfg_attr(feature = "nightly", feature(proc_macro_span))]
|
#![cfg_attr(nightly_yew, feature(proc_macro_span))]
|
||||||
|
|
||||||
//! This crate provides Yew's procedural macro `html!` which allows using JSX-like syntax
|
//! This crate provides Yew's procedural macro `html!` which allows using JSX-like syntax
|
||||||
//! for generating html and the `Properties` derive macro for deriving the `Properties` trait
|
//! for generating html and the `Properties` derive macro for deriving the `Properties` trait
|
||||||
|
|
|
@ -59,7 +59,7 @@ impl Parse for PreparedState {
|
||||||
|
|
||||||
impl PreparedState {
|
impl PreparedState {
|
||||||
// Async closure is not stable, so we rewrite it to closure + async block
|
// Async closure is not stable, so we rewrite it to closure + async block
|
||||||
#[cfg(not(feature = "nightly"))]
|
#[cfg(not(nightly_yew))]
|
||||||
pub fn rewrite_to_closure_with_async_block(&self) -> ExprClosure {
|
pub fn rewrite_to_closure_with_async_block(&self) -> ExprClosure {
|
||||||
use proc_macro2::Span;
|
use proc_macro2::Span;
|
||||||
use syn::parse_quote;
|
use syn::parse_quote;
|
||||||
|
@ -95,7 +95,7 @@ impl PreparedState {
|
||||||
closure
|
closure
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(nightly_yew)]
|
||||||
pub fn rewrite_to_closure_with_async_block(&self) -> ExprClosure {
|
pub fn rewrite_to_closure_with_async_block(&self) -> ExprClosure {
|
||||||
self.closure.clone()
|
self.closure.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,6 @@ tokio = ["tokio/rt", "tokio/time", "dep:num_cpus", "dep:tokio-util"]
|
||||||
ssr = ["dep:html-escape", "dep:base64ct", "dep:bincode"]
|
ssr = ["dep:html-escape", "dep:base64ct", "dep:bincode"]
|
||||||
csr = []
|
csr = []
|
||||||
hydration = ["csr", "dep:bincode"]
|
hydration = ["csr", "dep:bincode"]
|
||||||
nightly = ["yew-macro/nightly"]
|
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||||
|
|
|
@ -23,7 +23,7 @@ impl UseForceUpdateHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
#[cfg(nightly_yew)]
|
||||||
mod feat_nightly {
|
mod feat_nightly {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ pub fn use_force_update() -> impl Hook<Output = UseForceUpdateHandle> {
|
||||||
UseRerenderHook
|
UseRerenderHook
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(test, feature = "nightly"))]
|
#[cfg(all(test, nightly_yew))]
|
||||||
mod nightly_test {
|
mod nightly_test {
|
||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
#![doc(html_logo_url = "https://yew.rs/img/logo.png")]
|
#![doc(html_logo_url = "https://yew.rs/img/logo.png")]
|
||||||
#![cfg_attr(documenting, feature(doc_cfg))]
|
#![cfg_attr(documenting, feature(doc_cfg))]
|
||||||
#![cfg_attr(documenting, feature(doc_auto_cfg))]
|
#![cfg_attr(documenting, feature(doc_auto_cfg))]
|
||||||
#![cfg_attr(
|
#![cfg_attr(nightly_yew, feature(fn_traits, async_closure, unboxed_closures))]
|
||||||
feature = "nightly",
|
|
||||||
feature(fn_traits, async_closure, unboxed_closures)
|
|
||||||
)]
|
|
||||||
|
|
||||||
//! # Yew Framework - API Documentation
|
//! # Yew Framework - API Documentation
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#![cfg(target_arch = "wasm32")]
|
#![cfg(target_arch = "wasm32")]
|
||||||
#![cfg(feature = "hydration")]
|
#![cfg(feature = "hydration")]
|
||||||
#![cfg_attr(feature = "nightly", feature(async_closure))]
|
#![cfg_attr(nightly_yew, feature(async_closure))]
|
||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue