File tree Expand file tree Collapse file tree 5 files changed +149
-0
lines changed Expand file tree Collapse file tree 5 files changed +149
-0
lines changed 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+
12+ use std:: io;
13+
14+ macro_rules! print_hd_tl (
15+ ( $field_hd: ident, $( $field_tl: ident) ,+) => ( {
16+ io:: print( stringify!( $field) ) ; //~ ERROR unknown macro variable
17+ io:: print( "::[" ) ;
18+ $(
19+ io:: print( stringify!( $field_tl) ) ;
20+ io:: print( ", " ) ;
21+ ) +
22+ io:: print( "]\n " ) ;
23+ } )
24+ )
25+
26+ fn main ( ) {
27+ print_hd_tl ! ( x, y, z, w)
28+ }
29+
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+ use std:: { pipes, io, task, comm} ;
12+
13+ fn main ( ) {
14+ let ( port, chan) = comm:: stream ( ) ;
15+
16+ do task:: spawn {
17+ io : : println ( port. recv ( ) ) ;
18+ }
19+
20+ chan. send ( "hello, world" ) ;
21+ }
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+ use std:: io;
12+
13+ macro_rules! print_hd_tl (
14+ ( $field_hd: ident, $( $field_tl: ident) ,+) => ( {
15+ io:: print( stringify!( $field_hd) ) ;
16+ io:: print( "::[" ) ;
17+ $(
18+ io:: print( stringify!( $field_tl) ) ;
19+ io:: print( ", " ) ;
20+ ) +
21+ io:: print( "]\n " ) ;
22+ } )
23+ )
24+
25+ fn main ( ) {
26+ print_hd_tl ! ( x, y, z, w)
27+ }
28+
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+ pub trait EventLoop {
12+ }
13+
14+ pub struct UvEventLoop {
15+ uvio : int
16+ }
17+
18+ impl UvEventLoop {
19+ pub fn new ( ) -> UvEventLoop {
20+ UvEventLoop {
21+ uvio : 0
22+ }
23+ }
24+ }
25+
26+ impl EventLoop for UvEventLoop {
27+ }
28+
29+ pub struct Scheduler {
30+ event_loop : ~EventLoop ,
31+ }
32+
33+ impl Scheduler {
34+
35+ pub fn new ( event_loop : ~EventLoop ) -> Scheduler {
36+ Scheduler {
37+ event_loop : event_loop,
38+ }
39+ }
40+ }
41+
42+ fn main ( ) {
43+ let mut sched = Scheduler :: new ( ~UvEventLoop :: new ( ) as ~EventLoop ) ;
44+ }
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+ // xfail-test
12+
13+ type FontTableTag = u32 ;
14+
15+ trait FontTableTagConversions {
16+ fn tag_to_str ( self ) ;
17+ }
18+
19+ impl FontTableTagConversions for FontTableTag {
20+ fn tag_to_str ( self ) {
21+ & self ;
22+ }
23+ }
24+
25+ fn main ( ) {
26+ 5 . tag_to_str ( ) ;
27+ }
You can’t perform that action at this time.
0 commit comments