File: fix-tests-no-default-features.patch

package info (click to toggle)
rust-crossbeam-channel 0.5.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,248 kB
  • sloc: makefile: 2
file content (362 lines) | stat: -rw-r--r-- 10,580 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
Index: crossbeam-channel/benches/crossbeam.rs
===================================================================
--- crossbeam-channel.orig/benches/crossbeam.rs
+++ crossbeam-channel/benches/crossbeam.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 #![feature(test)]
 
 extern crate test;
Index: crossbeam-channel/examples/fibonacci.rs
===================================================================
--- crossbeam-channel.orig/examples/fibonacci.rs
+++ crossbeam-channel/examples/fibonacci.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! An asynchronous fibonacci sequence generator.
 
 use std::thread;
Index: crossbeam-channel/examples/matching.rs
===================================================================
--- crossbeam-channel.orig/examples/matching.rs
+++ crossbeam-channel/examples/matching.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Using `select!` to send and receive on the same channel at the same time.
 //!
 //! This example is based on the following program in Go.
Index: crossbeam-channel/examples/stopwatch.rs
===================================================================
--- crossbeam-channel.orig/examples/stopwatch.rs
+++ crossbeam-channel/examples/stopwatch.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Prints the elapsed time every 1 second and quits on Ctrl+C.
 
 #[cfg(windows)] // signal_hook::iterator does not work on windows
Index: crossbeam-channel/tests/after.rs
===================================================================
--- crossbeam-channel.orig/tests/after.rs
+++ crossbeam-channel/tests/after.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the after channel flavor.
 
 #![cfg(not(miri))] // TODO: many assertions failed due to Miri is slow
Index: crossbeam-channel/tests/array.rs
===================================================================
--- crossbeam-channel.orig/tests/array.rs
+++ crossbeam-channel/tests/array.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the array channel flavor.
 
 use std::any::Any;
Index: crossbeam-channel/tests/golang.rs
===================================================================
--- crossbeam-channel.orig/tests/golang.rs
+++ crossbeam-channel/tests/golang.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests copied from Go and manually rewritten in Rust.
 //!
 //! Source:
Index: crossbeam-channel/tests/iter.rs
===================================================================
--- crossbeam-channel.orig/tests/iter.rs
+++ crossbeam-channel/tests/iter.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for iteration over receivers.
 
 use crossbeam_channel::unbounded;
Index: crossbeam-channel/tests/list.rs
===================================================================
--- crossbeam-channel.orig/tests/list.rs
+++ crossbeam-channel/tests/list.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the list channel flavor.
 
 use std::any::Any;
Index: crossbeam-channel/tests/mpsc.rs
===================================================================
--- crossbeam-channel.orig/tests/mpsc.rs
+++ crossbeam-channel/tests/mpsc.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests copied from `std::sync::mpsc`.
 //!
 //! This is a copy of tests for the `std::sync::mpsc` channels from the standard library, but
@@ -29,16 +30,19 @@ use std::time::Duration;
 
 use crossbeam_channel as cc;
 
+#[cfg(feature = "std")]
 pub struct Sender<T> {
     pub inner: cc::Sender<T>,
 }
 
+#[cfg(feature = "std")]
 impl<T> Sender<T> {
     pub fn send(&self, t: T) -> Result<(), SendError<T>> {
         self.inner.send(t).map_err(|cc::SendError(m)| SendError(m))
     }
 }
 
+#[cfg(feature = "std")]
 impl<T> Clone for Sender<T> {
     fn clone(&self) -> Sender<T> {
         Sender {
@@ -47,10 +51,12 @@ impl<T> Clone for Sender<T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub struct SyncSender<T> {
     pub inner: cc::Sender<T>,
 }
 
+#[cfg(feature = "std")]
 impl<T> SyncSender<T> {
     pub fn send(&self, t: T) -> Result<(), SendError<T>> {
         self.inner.send(t).map_err(|cc::SendError(m)| SendError(m))
@@ -64,6 +70,7 @@ impl<T> SyncSender<T> {
     }
 }
 
+#[cfg(feature = "std")]
 impl<T> Clone for SyncSender<T> {
     fn clone(&self) -> SyncSender<T> {
         SyncSender {
@@ -72,10 +79,12 @@ impl<T> Clone for SyncSender<T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub struct Receiver<T> {
     pub inner: cc::Receiver<T>,
 }
 
+#[cfg(feature = "std")]
 impl<T> Receiver<T> {
     pub fn try_recv(&self) -> Result<T, TryRecvError> {
         self.inner.try_recv().map_err(|err| match err {
@@ -104,6 +113,7 @@ impl<T> Receiver<T> {
     }
 }
 
+#[cfg(feature = "std")]
 impl<'a, T> IntoIterator for &'a Receiver<T> {
     type Item = T;
     type IntoIter = Iter<'a, T>;
@@ -113,6 +123,7 @@ impl<'a, T> IntoIterator for &'a Receive
     }
 }
 
+#[cfg(feature = "std")]
 impl<T> IntoIterator for Receiver<T> {
     type Item = T;
     type IntoIter = IntoIter<T>;
@@ -122,10 +133,12 @@ impl<T> IntoIterator for Receiver<T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub struct TryIter<'a, T: 'a> {
     inner: &'a Receiver<T>,
 }
 
+#[cfg(feature = "std")]
 impl<'a, T> Iterator for TryIter<'a, T> {
     type Item = T;
 
@@ -134,10 +147,12 @@ impl<'a, T> Iterator for TryIter<'a, T>
     }
 }
 
+#[cfg(feature = "std")]
 pub struct Iter<'a, T: 'a> {
     inner: &'a Receiver<T>,
 }
 
+#[cfg(feature = "std")]
 impl<'a, T> Iterator for Iter<'a, T> {
     type Item = T;
 
@@ -146,10 +161,12 @@ impl<'a, T> Iterator for Iter<'a, T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub struct IntoIter<T> {
     inner: Receiver<T>,
 }
 
+#[cfg(feature = "std")]
 impl<T> Iterator for IntoIter<T> {
     type Item = T;
 
@@ -158,6 +175,7 @@ impl<T> Iterator for IntoIter<T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
     let (s, r) = cc::unbounded();
     let s = Sender { inner: s };
@@ -165,6 +183,7 @@ pub fn channel<T>() -> (Sender<T>, Recei
     (s, r)
 }
 
+#[cfg(feature = "std")]
 pub fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>) {
     let (s, r) = cc::bounded(bound);
     let s = SyncSender { inner: s };
@@ -172,6 +191,7 @@ pub fn sync_channel<T>(bound: usize) ->
     (s, r)
 }
 
+#[cfg(feature = "std")]
 macro_rules! select {
     (
         $($name:pat = $rx:ident.$meth:ident() => $code:expr),+
@@ -202,6 +222,7 @@ mod channel_tests {
         }
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke() {
         let (tx, rx) = channel::<i32>();
@@ -209,12 +230,14 @@ mod channel_tests {
         assert_eq!(rx.recv().unwrap(), 1);
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn drop_full() {
         let (tx, _rx) = channel::<Box<isize>>();
         tx.send(Box::new(1)).unwrap();
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn drop_full_shared() {
         let (tx, _rx) = channel::<Box<isize>>();
@@ -223,6 +246,7 @@ mod channel_tests {
         tx.send(Box::new(1)).unwrap();
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke_shared() {
         let (tx, rx) = channel::<i32>();
@@ -233,6 +257,7 @@ mod channel_tests {
         assert_eq!(rx.recv().unwrap(), 1);
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke_threads() {
         let (tx, rx) = channel::<i32>();
@@ -243,6 +268,7 @@ mod channel_tests {
         t.join().unwrap();
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke_port_gone() {
         let (tx, rx) = channel::<i32>();
@@ -250,6 +276,7 @@ mod channel_tests {
         assert!(tx.send(1).is_err());
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke_shared_port_gone() {
         let (tx, rx) = channel::<i32>();
@@ -1703,6 +1730,7 @@ mod sync_channel_tests {
 mod select_tests {
     use super::*;
 
+#[cfg(feature = "std")]
     use std::thread;
 
     #[test]
Index: crossbeam-channel/tests/never.rs
===================================================================
--- crossbeam-channel.orig/tests/never.rs
+++ crossbeam-channel/tests/never.rs
@@ -1,5 +1,5 @@
 //! Tests for the never channel flavor.
-
+#![cfg(feature = "std")]
 use std::thread;
 use std::time::{Duration, Instant};
 
Index: crossbeam-channel/tests/ready.rs
===================================================================
--- crossbeam-channel.orig/tests/ready.rs
+++ crossbeam-channel/tests/ready.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for channel readiness using the `Select` struct.
 
 use std::any::Any;
Index: crossbeam-channel/tests/same_channel.rs
===================================================================
--- crossbeam-channel.orig/tests/same_channel.rs
+++ crossbeam-channel/tests/same_channel.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 use std::time::Duration;
 
 use crossbeam_channel::{after, bounded, never, tick, unbounded};
Index: crossbeam-channel/tests/select.rs
===================================================================
--- crossbeam-channel.orig/tests/select.rs
+++ crossbeam-channel/tests/select.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for channel selection using the `Select` struct.
 
 use std::any::Any;
Index: crossbeam-channel/tests/select_macro.rs
===================================================================
--- crossbeam-channel.orig/tests/select_macro.rs
+++ crossbeam-channel/tests/select_macro.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the `select!` macro.
 
 #![forbid(unsafe_code)] // select! is safe.
Index: crossbeam-channel/tests/thread_locals.rs
===================================================================
--- crossbeam-channel.orig/tests/thread_locals.rs
+++ crossbeam-channel/tests/thread_locals.rs
@@ -1,5 +1,5 @@
 //! Tests that make sure accessing thread-locals while exiting the thread doesn't cause panics.
-
+#![cfg(feature = "std")]
 #![cfg(not(miri))] // Miri detects that this test is buggy: the destructor of `FOO` uses `std::thread::current()`!
 
 use std::thread;
Index: crossbeam-channel/tests/tick.rs
===================================================================
--- crossbeam-channel.orig/tests/tick.rs
+++ crossbeam-channel/tests/tick.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the tick channel flavor.
 
 #![cfg(not(miri))] // TODO: many assertions failed due to Miri is slow
Index: crossbeam-channel/tests/zero.rs
===================================================================
--- crossbeam-channel.orig/tests/zero.rs
+++ crossbeam-channel/tests/zero.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the zero channel flavor.
 
 use std::any::Any;