This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| atomic<state_data_t>::transaction tx = state_data.transact(); | |
| tx->state = state; | |
| tx->cond = NULL; | |
| tx->cond_name = "none"; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mod pingpong { | |
| enum ping { ping, } | |
| enum ping_message = *pipes::packet<pong_message>; | |
| enum pong { pong, } | |
| enum pong_message = *pipes::packet<ping_message>; | |
| fn init() -> (client::ping, server::ping) { | |
| pipes::entangle() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let endpoints = vec::map_consume( | |
| endpoints, | |
| |p| unsafe { uniquify(p.unwrap()) }); | |
| let endpoints_r = vec::view(endpoints, 0, endpoints.len()); | |
| let ready = wait_many(endpoints_r.map_r(|p| &p.header)); | |
| let mut remaining = ~[]; | |
| let mut result = none; | |
| do vec::consume(endpoints) |i, p| { ... } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs | |
| index 6c93dbc..c2b9e33 100644 | |
| --- a/src/libsyntax/ext/base.rs | |
| +++ b/src/libsyntax/ext/base.rs | |
| @@ -30,11 +30,14 @@ enum syntax_extension { | |
| fn syntax_expander_table() -> hashmap<str, syntax_extension> { | |
| fn builtin(f: syntax_expander_) -> syntax_extension | |
| {normal({expander: f, span: none})} | |
| + fn builtin_tt(f: syntax_expander_tt_) -> syntax_extension | |
| + {normal_tt({expander: f, span: none})} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| } else if !self.is_any_keyword(self.look_ahead(0)) | |
| && self.look_ahead(1) == token::NOT | |
| { | |
| // item macro. | |
| let pth = self.parse_path_without_tps(); | |
| self.expect(token::NOT); | |
| let id = self.parse_ident(); | |
| let tt = self.parse_token_tree(); | |
| let m = ast::mac_invoc_tt(pth, tt); | |
| let m: ast::mac = {node: m, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // An example to make sure the protocol parsing syntax extension works. | |
| proto! pingpong { | |
| ping:send { | |
| ping -> pong | |
| } | |
| pong:recv { | |
| pong -> ping | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn foo<T>(x: T) { | |
| fn bar(x: T) { | |
| log(error, x); | |
| } | |
| bar(x); | |
| } | |
| fn main() { | |
| foo(5); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| impl to_str<T> for T { | |
| fn to_str() -> str { "a" } | |
| } | |
| fn foo<T>(_f:fn()) -> T { fail } | |
| fn main() { | |
| log(error, | |
| // 16 in a row | |
| [do foo::<~@&*()>{;}]/_. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // New view signature | |
| pure fn view<T>(v: &a.[T], start: uint, end: uint) -> &a.[T] | |
| // I get an error here | |
| fn with_doc_data<T>(d: doc, f: fn(x: &[u8]) -> T) -> T { | |
| ret f(vec::view::<u8>(*d.data, d.start, d.end)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| impl private_methods/&<T: send> for &self.recv_packet<T> { | |
| pure fn header() -> &self.packet_header { | |
| alt self.p { | |
| some(packet) { | |
| unsafe { | |
| let packet = uniquify(packet); | |
| let header = reinterpret_cast(&packet.header); | |
| forget(packet); | |
| header | |
| } |