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
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | |
// file at the top-level directory of this distribution and at | |
// http://rust-lang.org/COPYRIGHT. | |
// | |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
// option. This file may not be copied, modified, or distributed | |
// except according to those terms. |
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 modes_(&mut self, reg: u8, modecode: u8) -> AddressingMode { | |
match (reg, modecode) { | |
(2,0b00) => Direct, | |
(2,0b01) => Absolute(self.next_inst()), | |
(2,0b10) => Const(4), | |
(2,0b11) => Const(8), | |
(3,0b00) => Const(0), | |
(3,0b01) => Const(1), | |
(3,0b10) => Const(2), | |
(3,0b11) => Const(-1), |
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
macro_rules! report_diag ( | |
($f: tt, $name: tt, $msg: tt, $(arg: tt)*) => { { | |
reg_diag_msg!($name, $msg); | |
let msg = format!($msg, $($arg)*); | |
let msg = format!("{}: {}", stringify!($name), msg); | |
$f(msg); | |
} }; | |
($f: tt, $name: tt, $msg: tt) => { { | |
reg_diag_msg!($name, $msg); | |
let msg = format!("{}: {}", stringify!($name), $msg); |
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 ifV<'a, T>(rc : &str, star: &'a T) -> Option<&'a T> { | |
if (Path::new( rc )).exists() { | |
Some(star) | |
} else { | |
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
trait A {} | |
fn foo<T: A>(_: &T) {} | |
struct B; | |
impl A for B {} | |
impl<'self> A for &'self A {} | |
fn main() { | |
let a = B; |
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
use std::rt::io; | |
struct HttpResponse<'self> { | |
out: &'self mut io::Writer, | |
} | |
fn write_http_header(_: &mut &mut io::Writer) {} | |
// fn write_http_header<W: io::Writer>(_: &mut W) {} | |
impl<'self> HttpResponse<'self> { |
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
use t2::t3::fun; | |
mod t2; | |
fn main() { | |
t2::fun(); | |
fun(); // calling t3::fun | |
} |
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 mut f = None; | |
match *e { | |
expr_call(f, ref args, _) => match f.node { | |
expr_path(path) => match dm.find(&f.id) { | |
Some(&v) => match v { | |
ast::def_variant(*) |ast::def_struct(*) => { | |
f = Some(expr_struct( | |
fld.fold_path(&path), | |
args.map(|x| fold_unnamed_field(*x)), | |
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
trait Nat { } | |
struct Zero; | |
struct Suc<N>(N); | |
impl Nat for Zero { } | |
impl<N: Nat> Nat for Suc<N> { } | |
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
pub mod other; | |
fn main() { | |
other::hello(); | |
} |