File tree Expand file tree Collapse file tree 6 files changed +27
-7
lines changed
Expand file tree Collapse file tree 6 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ no-std = ["hashbrown", "bitcoin/no-std"]
1717compiler = []
1818trace = []
1919
20- unstable = []
2120serde = [" actual-serde" , " bitcoin/serde" ]
2221rand = [" bitcoin/rand" ]
2322base64 = [" bitcoin/base64" ]
Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ architectural mismatches. If you have any questions or ideas you want to discuss
5353please join us in
5454[ ##miniscript] ( https://web.libera.chat/?channels=##miniscript ) on Libera.
5555
56+ ## Benchmarks
57+
58+ We use a custom Rust compiler configuration conditional to guard the bench mark code. To run the
59+ bench marks use: ` RUSTFLAGS='--cfg=bench' cargo +nightly bench ` .
60+
5661
5762## Release Notes
5863
Original file line number Diff line number Diff line change @@ -7,6 +7,12 @@ FEATURES="compiler serde rand base64"
77cargo --version
88rustc --version
99
10+ # Cache the toolchain we are using.
11+ NIGHTLY=false
12+ if cargo --version | grep nightly; then
13+ NIGHTLY=true
14+ fi
15+
1016# Format if told to
1117if [ " $DO_FMT " = true ]
1218then
7783 done
7884fi
7985
80- # Bench if told to (this only works with the nightly toolchain)
86+ # Bench if told to, only works with non-stable toolchain ( nightly, beta).
8187if [ " $DO_BENCH " = true ]
8288then
83- cargo bench --features=" unstable compiler"
89+ if [ " $NIGHTLY " = false ]; then
90+ if [ -n " $RUSTUP_TOOLCHAIN " ]; then
91+ echo " RUSTUP_TOOLCHAIN is set to a non-nightly toolchain but DO_BENCH requires a nightly toolchain"
92+ else
93+ echo " DO_BENCH requires a nightly toolchain"
94+ fi
95+ exit 1
96+ fi
97+ RUSTFLAGS=' --cfg=bench' cargo bench
8498fi
8599
86100# Build the docs if told to (this only works with the nightly toolchain)
Original file line number Diff line number Diff line change 7474//!
7575
7676#![ cfg_attr( all( not( feature = "std" ) , not( test) ) , no_std) ]
77- #![ cfg_attr( all( test, feature = "unstable" ) , feature( test) ) ]
77+ // Experimental features we need.
78+ #![ cfg_attr( bench, feature( test) ) ]
7879// Coding conventions
7980#![ deny( unsafe_code) ]
8081#![ deny( non_upper_case_globals) ]
@@ -107,7 +108,8 @@ extern crate core;
107108
108109#[ cfg( feature = "serde" ) ]
109110pub use actual_serde as serde;
110- #[ cfg( all( test, feature = "unstable" ) ) ]
111+
112+ #[ cfg( bench) ]
111113extern crate test;
112114
113115#[ macro_use]
Original file line number Diff line number Diff line change @@ -1598,7 +1598,7 @@ mod tests {
15981598 }
15991599}
16001600
1601- #[ cfg( all ( test , feature = "unstable" ) ) ]
1601+ #[ cfg( bench ) ]
16021602mod benches {
16031603 use std:: str:: FromStr ;
16041604
Original file line number Diff line number Diff line change @@ -541,7 +541,7 @@ mod tests {
541541 }
542542}
543543
544- #[ cfg( all( test , feature = "compiler" , feature = "unstable ") ) ]
544+ #[ cfg( all( bench , feature = "compiler" ) ) ]
545545mod benches {
546546 use core:: str:: FromStr ;
547547
You can’t perform that action at this time.
0 commit comments