File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -62,5 +62,8 @@ version = "0.1"
62
62
version = " >=0.2.0,<0.4"
63
63
optional = true
64
64
65
+ [build-dependencies ]
66
+ rustc_version = " 0.4.0"
67
+
65
68
[package .metadata .docs .rs ]
66
69
all-features = true
Original file line number Diff line number Diff line change 2
2
3
3
use std:: { env, error:: Error } ;
4
4
5
+ use rustc_version:: Channel ;
6
+
5
7
fn main ( ) -> Result < ( ) , Box < dyn Error > > {
6
8
let target = env:: var ( "TARGET" ) ?;
7
9
@@ -66,5 +68,12 @@ fn main() -> Result<(), Box<dyn Error>> {
66
68
_ => { }
67
69
}
68
70
71
+ if !matches ! (
72
+ rustc_version:: version_meta( ) . unwrap( ) . channel,
73
+ Channel :: Stable | Channel :: Beta
74
+ ) {
75
+ println ! ( "cargo:rustc-cfg=unstable_channel" ) ;
76
+ }
77
+
69
78
Ok ( ( ) )
70
79
}
Original file line number Diff line number Diff line change 1
- #![ feature( scoped_threads) ]
1
+ #![ cfg_attr ( unstable_channel , feature( scoped_threads) ) ]
2
2
#![ deny( rust_2018_compatibility) ]
3
3
#![ deny( rust_2018_idioms) ]
4
4
#![ deny( warnings) ]
5
5
6
- use std:: { sync :: mpsc , thread} ;
6
+ use std:: thread;
7
7
8
- use heapless:: { mpmc :: Q64 , spsc} ;
8
+ use heapless:: spsc;
9
9
10
10
#[ test]
11
11
fn once ( ) {
@@ -51,6 +51,7 @@ fn twice() {
51
51
}
52
52
53
53
#[ test]
54
+ #[ cfg( unstable_channel) ]
54
55
fn scoped ( ) {
55
56
let mut rb: spsc:: Queue < i32 , 5 > = spsc:: Queue :: new ( ) ;
56
57
@@ -75,6 +76,7 @@ fn scoped() {
75
76
76
77
#[ test]
77
78
#[ cfg_attr( miri, ignore) ] // too slow
79
+ #[ cfg( unstable_channel) ]
78
80
fn contention ( ) {
79
81
const N : usize = 1024 ;
80
82
@@ -120,7 +122,12 @@ fn contention() {
120
122
121
123
#[ test]
122
124
#[ cfg_attr( miri, ignore) ] // too slow
125
+ #[ cfg( unstable_channel) ]
123
126
fn mpmc_contention ( ) {
127
+ use std:: sync:: mpsc;
128
+
129
+ use heapless:: mpmc:: Q64 ;
130
+
124
131
const N : u32 = 64 ;
125
132
126
133
static Q : Q64 < u32 > = Q64 :: new ( ) ;
@@ -166,6 +173,7 @@ fn mpmc_contention() {
166
173
167
174
#[ test]
168
175
#[ cfg_attr( miri, ignore) ] // too slow
176
+ #[ cfg( unstable_channel) ]
169
177
fn unchecked ( ) {
170
178
const N : usize = 1024 ;
171
179
You can’t perform that action at this time.
0 commit comments