File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ impl<T: Send> Consumer<T>{
292
292
293
293
/// The receiving-half of Rust's channel type. This half can only be owned by
294
294
/// one task
295
+ #[ no_freeze] // can't share ports in an arc
295
296
pub struct Port < T > {
296
297
priv queue : Consumer < T > ,
297
298
}
@@ -305,12 +306,15 @@ pub struct PortIterator<'a, T> {
305
306
306
307
/// The sending-half of Rust's channel type. This half can only be owned by one
307
308
/// task
309
+ #[ no_freeze] // can't share chans in an arc
308
310
pub struct Chan < T > {
309
311
priv queue : spsc:: Producer < T , Packet > ,
310
312
}
311
313
312
314
/// The sending-half of Rust's channel type. This half can be shared among many
313
315
/// tasks by creating copies of itself through the `clone` method.
316
+ #[ no_freeze] // technically this implementation is shareable, but it shouldn't
317
+ // be required to be shareable in an arc
314
318
pub struct SharedChan < T > {
315
319
priv queue : mpsc:: Producer < T , Packet > ,
316
320
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ fn test < T : Freeze > ( ) { }
12
+
13
+ fn main ( ) {
14
+ test :: < Chan < int > > ( ) ; //~ ERROR: does not fulfill `Freeze`
15
+ test :: < Port < int > > ( ) ; //~ ERROR: does not fulfill `Freeze`
16
+ test :: < SharedChan < int > > ( ) ; //~ ERROR: does not fulfill `Freeze`
17
+ }
You can’t perform that action at this time.
0 commit comments