File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 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>{
292292
293293/// The receiving-half of Rust's channel type. This half can only be owned by
294294/// one task
295+ #[ no_freeze] // can't share ports in an arc
295296pub struct Port < T > {
296297 priv queue : Consumer < T > ,
297298}
@@ -305,12 +306,15 @@ pub struct PortIterator<'a, T> {
305306
306307/// The sending-half of Rust's channel type. This half can only be owned by one
307308/// task
309+ #[ no_freeze] // can't share chans in an arc
308310pub struct Chan < T > {
309311 priv queue : spsc:: Producer < T , Packet > ,
310312}
311313
312314/// The sending-half of Rust's channel type. This half can be shared among many
313315/// 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
314318pub struct SharedChan < T > {
315319 priv queue : mpsc:: Producer < T , Packet > ,
316320}
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