auto merge of #18646 : eddyb/rust/snapshots, r=alexcrichton
This commit is contained in:
commit
14cd5c590e
@ -250,37 +250,6 @@ pub trait UpperExp for Sized? {
|
||||
fn fmt(&self, &mut Formatter) -> Result;
|
||||
}
|
||||
|
||||
// NOTE(stage0): Remove macro after next snapshot
|
||||
#[cfg(stage0)]
|
||||
macro_rules! uniform_fn_call_workaround {
|
||||
($( $name: ident, $trait_: ident; )*) => {
|
||||
$(
|
||||
#[doc(hidden)]
|
||||
pub fn $name<Sized? T: $trait_>(x: &T, fmt: &mut Formatter) -> Result {
|
||||
x.fmt(fmt)
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
// NOTE(stage0): Remove macro after next snapshot
|
||||
#[cfg(stage0)]
|
||||
uniform_fn_call_workaround! {
|
||||
secret_show, Show;
|
||||
secret_bool, Bool;
|
||||
secret_char, Char;
|
||||
secret_signed, Signed;
|
||||
secret_unsigned, Unsigned;
|
||||
secret_octal, Octal;
|
||||
secret_binary, Binary;
|
||||
secret_lower_hex, LowerHex;
|
||||
secret_upper_hex, UpperHex;
|
||||
secret_string, String;
|
||||
secret_pointer, Pointer;
|
||||
secret_float, Float;
|
||||
secret_lower_exp, LowerExp;
|
||||
secret_upper_exp, UpperExp;
|
||||
}
|
||||
|
||||
static DEFAULT_ARGUMENT: rt::Argument<'static> = rt::Argument {
|
||||
position: rt::ArgumentNext,
|
||||
format: rt::FormatSpec {
|
||||
@ -570,16 +539,6 @@ pub fn argument<'a, T>(f: extern "Rust" fn(&T, &mut Formatter) -> Result,
|
||||
|
||||
/// When the compiler determines that the type of an argument *must* be a string
|
||||
/// (such as for select), then it invokes this method.
|
||||
// NOTE(stage0): remove function after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[doc(hidden)] #[inline]
|
||||
pub fn argumentstr<'a>(s: &'a &str) -> Argument<'a> {
|
||||
argument(secret_string, s)
|
||||
}
|
||||
|
||||
/// When the compiler determines that the type of an argument *must* be a string
|
||||
/// (such as for select), then it invokes this method.
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[doc(hidden)] #[inline]
|
||||
pub fn argumentstr<'a>(s: &'a &str) -> Argument<'a> {
|
||||
argument(String::fmt, s)
|
||||
@ -587,16 +546,6 @@ pub fn argumentstr<'a>(s: &'a &str) -> Argument<'a> {
|
||||
|
||||
/// When the compiler determines that the type of an argument *must* be a uint
|
||||
/// (such as for plural), then it invokes this method.
|
||||
// NOTE(stage0): remove function after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[doc(hidden)] #[inline]
|
||||
pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
|
||||
argument(secret_unsigned, s)
|
||||
}
|
||||
|
||||
/// When the compiler determines that the type of an argument *must* be a uint
|
||||
/// (such as for plural), then it invokes this method.
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[doc(hidden)] #[inline]
|
||||
pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
|
||||
argument(Unsigned::fmt, s)
|
||||
@ -614,15 +563,6 @@ impl<'a> Show for &'a Show+'a {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { (*self).fmt(f) }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl Bool for bool {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
secret_string(&(if *self {"true"} else {"false"}), f)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl Bool for bool {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
String::fmt(if *self { "true" } else { "false" }, f)
|
||||
@ -641,20 +581,6 @@ impl String for str {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl Char for char {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
use char::Char;
|
||||
|
||||
let mut utf8 = [0u8, ..4];
|
||||
let amt = self.encode_utf8(utf8).unwrap_or(0);
|
||||
let s: &str = unsafe { mem::transmute(utf8[..amt]) };
|
||||
secret_string(&s, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl Char for char {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
use char::Char;
|
||||
@ -666,16 +592,6 @@ impl Char for char {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> Pointer for *const T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
f.flags |= 1 << (rt::FlagAlternate as uint);
|
||||
secret_lower_hex::<uint>(&(*self as uint), f)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> Pointer for *const T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
f.flags |= 1 << (rt::FlagAlternate as uint);
|
||||
@ -683,45 +599,18 @@ impl<T> Pointer for *const T {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> Pointer for *mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
secret_pointer::<*const T>(&(*self as *const T), f)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> Pointer for *mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
Pointer::fmt(&(*self as *const T), f)
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> Pointer for &'a T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
secret_pointer::<*const T>(&(&**self as *const T), f)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> Pointer for &'a T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
Pointer::fmt(&(*self as *const T), f)
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a, T> Pointer for &'a mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
secret_pointer::<*const T>(&(&**self as *const T), f)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<'a, T> Pointer for &'a mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
Pointer::fmt(&(&**self as *const T), f)
|
||||
@ -797,29 +686,6 @@ floating!(f64)
|
||||
|
||||
// Implementation of Show for various core types
|
||||
|
||||
// NOTE(stage0): remove macro after a snapshot
|
||||
#[cfg(stage0)]
|
||||
macro_rules! delegate(($ty:ty to $other:ident) => {
|
||||
impl Show for $ty {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
(concat_idents!(secret_, $other)(self, f))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// NOTE(stage0): remove these macros after a snapshot
|
||||
#[cfg(stage0)]
|
||||
delegate!(str to string)
|
||||
#[cfg(stage0)]
|
||||
delegate!(bool to bool)
|
||||
#[cfg(stage0)]
|
||||
delegate!(char to char)
|
||||
#[cfg(stage0)]
|
||||
delegate!(f32 to float)
|
||||
#[cfg(stage0)]
|
||||
delegate!(f64 to float)
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
macro_rules! delegate(($ty:ty to $other:ident) => {
|
||||
impl Show for $ty {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
@ -827,35 +693,16 @@ macro_rules! delegate(($ty:ty to $other:ident) => {
|
||||
}
|
||||
}
|
||||
})
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
delegate!(str to String)
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
delegate!(bool to Bool)
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
delegate!(char to Char)
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
delegate!(f32 to Float)
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
delegate!(f64 to Float)
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> Show for *const T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> Show for *const T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T> Show for *mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { secret_pointer(self, f) }
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<T> Show for *mut T {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result { Pointer::fmt(self, f) }
|
||||
}
|
||||
|
@ -171,7 +171,6 @@ extern "rust-intrinsic" {
|
||||
/// with optimization of surrounding code and reduce performance. It should
|
||||
/// not be used if the invariant can be discovered by the optimizer on its
|
||||
/// own, or if it does not enable any significant optimizations.
|
||||
#[cfg(not(stage0))]
|
||||
pub fn assume(b: bool);
|
||||
|
||||
/// Execute a breakpoint trap, for inspection by a debugger.
|
||||
|
@ -849,24 +849,21 @@ pub trait DerefMut<Sized? Result>: Deref<Result> {
|
||||
#[lang="fn"]
|
||||
pub trait Fn<Args,Result> {
|
||||
/// This is called when the call operator is used.
|
||||
#[rust_call_abi_hack]
|
||||
fn call(&self, args: Args) -> Result;
|
||||
extern "rust-call" fn call(&self, args: Args) -> Result;
|
||||
}
|
||||
|
||||
/// A version of the call operator that takes a mutable receiver.
|
||||
#[lang="fn_mut"]
|
||||
pub trait FnMut<Args,Result> {
|
||||
/// This is called when the call operator is used.
|
||||
#[rust_call_abi_hack]
|
||||
fn call_mut(&mut self, args: Args) -> Result;
|
||||
extern "rust-call" fn call_mut(&mut self, args: Args) -> Result;
|
||||
}
|
||||
|
||||
/// A version of the call operator that takes a by-value receiver.
|
||||
#[lang="fn_once"]
|
||||
pub trait FnOnce<Args,Result> {
|
||||
/// This is called when the call operator is used.
|
||||
#[rust_call_abi_hack]
|
||||
fn call_once(self, args: Args) -> Result;
|
||||
extern "rust-call" fn call_once(self, args: Args) -> Result;
|
||||
}
|
||||
|
||||
macro_rules! def_fn_mut(
|
||||
@ -874,9 +871,8 @@ macro_rules! def_fn_mut(
|
||||
impl<Result$(,$args)*>
|
||||
FnMut<($($args,)*),Result>
|
||||
for extern "Rust" fn($($args: $args,)*) -> Result {
|
||||
#[rust_call_abi_hack]
|
||||
#[allow(non_snake_case)]
|
||||
fn call_mut(&mut self, args: ($($args,)*)) -> Result {
|
||||
extern "rust-call" fn call_mut(&mut self, args: ($($args,)*)) -> Result {
|
||||
let ($($args,)*) = args;
|
||||
(*self)($($args,)*)
|
||||
}
|
||||
|
@ -33,49 +33,6 @@
|
||||
use fmt;
|
||||
use intrinsics;
|
||||
|
||||
// NOTE(stage0): remove after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[cold] #[inline(never)] // this is the slow path, always
|
||||
#[lang="fail"]
|
||||
pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
|
||||
let (expr, file, line) = *expr_file_line;
|
||||
let ref file_line = (file, line);
|
||||
format_args!(|args| -> () {
|
||||
panic_fmt(args, file_line);
|
||||
}, "{}", expr);
|
||||
|
||||
unsafe { intrinsics::abort() }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[cold] #[inline(never)]
|
||||
#[lang="fail_bounds_check"]
|
||||
fn panic_bounds_check(file_line: &(&'static str, uint),
|
||||
index: uint, len: uint) -> ! {
|
||||
format_args!(|args| -> () {
|
||||
panic_fmt(args, file_line);
|
||||
}, "index out of bounds: the len is {} but the index is {}", len, index);
|
||||
unsafe { intrinsics::abort() }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[cold] #[inline(never)]
|
||||
pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
|
||||
#[allow(improper_ctypes)]
|
||||
extern {
|
||||
#[lang = "fail_fmt"]
|
||||
fn panic_impl(fmt: &fmt::Arguments, file: &'static str,
|
||||
line: uint) -> !;
|
||||
|
||||
}
|
||||
let (file, line) = *file_line;
|
||||
unsafe { panic_impl(fmt, file, line) }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove cfg after a snapshot
|
||||
#[cfg(not(stage0))]
|
||||
#[cold] #[inline(never)] // this is the slow path, always
|
||||
#[lang="panic"]
|
||||
pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
|
||||
@ -88,8 +45,6 @@ pub fn panic(expr_file_line: &(&'static str, &'static str, uint)) -> ! {
|
||||
unsafe { intrinsics::abort() }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove cfg after a snapshot
|
||||
#[cfg(not(stage0))]
|
||||
#[cold] #[inline(never)]
|
||||
#[lang="panic_bounds_check"]
|
||||
fn panic_bounds_check(file_line: &(&'static str, uint),
|
||||
@ -100,8 +55,6 @@ fn panic_bounds_check(file_line: &(&'static str, uint),
|
||||
unsafe { intrinsics::abort() }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove cfg after a snapshot
|
||||
#[cfg(not(stage0))]
|
||||
#[cold] #[inline(never)]
|
||||
pub fn panic_fmt(fmt: &fmt::Arguments, file_line: &(&'static str, uint)) -> ! {
|
||||
#[allow(improper_ctypes)]
|
||||
|
@ -574,20 +574,6 @@ fn convert_methods<'a,I>(ccx: &CrateCtxt,
|
||||
rcvr_ty_generics: &ty::Generics,
|
||||
rcvr_visibility: ast::Visibility)
|
||||
-> ty::Method {
|
||||
// FIXME(pcwalton): Hack until we have syntax in stage0 for snapshots.
|
||||
let real_abi = match container {
|
||||
ty::TraitContainer(trait_id) => {
|
||||
if ccx.tcx.lang_items.fn_trait() == Some(trait_id) ||
|
||||
ccx.tcx.lang_items.fn_mut_trait() == Some(trait_id) ||
|
||||
ccx.tcx.lang_items.fn_once_trait() == Some(trait_id) {
|
||||
abi::RustCall
|
||||
} else {
|
||||
m.pe_abi()
|
||||
}
|
||||
}
|
||||
_ => m.pe_abi(),
|
||||
};
|
||||
|
||||
let m_ty_generics =
|
||||
ty_generics_for_fn_or_method(
|
||||
ccx,
|
||||
@ -607,7 +593,7 @@ fn convert_methods<'a,I>(ccx: &CrateCtxt,
|
||||
untransformed_rcvr_ty,
|
||||
m.pe_explicit_self(),
|
||||
&*m.pe_fn_decl(),
|
||||
real_abi)
|
||||
m.pe_abi())
|
||||
}
|
||||
TraitConvertMethodContext(trait_id, trait_items) => {
|
||||
let tmcx = TraitMethodCtxt {
|
||||
@ -622,7 +608,7 @@ fn convert_methods<'a,I>(ccx: &CrateCtxt,
|
||||
untransformed_rcvr_ty,
|
||||
m.pe_explicit_self(),
|
||||
&*m.pe_fn_decl(),
|
||||
real_abi)
|
||||
m.pe_abi())
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -497,14 +497,6 @@ pub extern fn rust_begin_unwind(msg: &fmt::Arguments,
|
||||
begin_unwind_fmt(msg, &(file, line))
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove after a snapshot
|
||||
#[cfg(not(test))]
|
||||
#[lang = "fail_fmt"]
|
||||
pub extern fn rust_fail_begin_unwind(msg: &fmt::Arguments,
|
||||
file: &'static str, line: uint) -> ! {
|
||||
rust_begin_unwind(msg, file, line)
|
||||
}
|
||||
|
||||
/// The entry point for unwinding with a formatted message.
|
||||
///
|
||||
/// This is designed to reduce the amount of code required at the call
|
||||
|
@ -424,22 +424,6 @@ pub use core::fmt::{Argument, Arguments, write, radix, Radix, RadixFmt};
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use core::fmt::{argument, argumentstr, argumentuint};
|
||||
// NOTE(stage0): remove these imports after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[doc(hidden)]
|
||||
pub use core::fmt::{secret_show, secret_string, secret_unsigned};
|
||||
#[cfg(stage0)]
|
||||
#[doc(hidden)]
|
||||
pub use core::fmt::{secret_signed, secret_lower_hex, secret_upper_hex};
|
||||
#[cfg(stage0)]
|
||||
#[doc(hidden)]
|
||||
pub use core::fmt::{secret_bool, secret_char, secret_octal, secret_binary};
|
||||
#[cfg(stage0)]
|
||||
#[doc(hidden)]
|
||||
pub use core::fmt::{secret_float, secret_upper_exp, secret_lower_exp};
|
||||
#[cfg(stage0)]
|
||||
#[doc(hidden)]
|
||||
pub use core::fmt::{secret_pointer};
|
||||
|
||||
/// The format function takes a precompiled format string and a list of
|
||||
/// arguments, to return the resulting formatted string.
|
||||
|
@ -24,9 +24,6 @@ use std::fmt::Show;
|
||||
use std::rc::Rc;
|
||||
use serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
#[cfg(stage0)]
|
||||
pub use self::TtToken as TTTok;
|
||||
|
||||
// FIXME #6993: in librustc, uses of "ident" should be replaced
|
||||
// by just "Name".
|
||||
|
||||
|
@ -1491,13 +1491,7 @@ mod test {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
fn mk_ident (id: &str, is_mod_name: bool) -> token::Token {
|
||||
token::Ident(str_to_ident(id), is_mod_name)
|
||||
}
|
||||
|
||||
// make the identifier by looking up the string in the interner
|
||||
#[cfg(not(stage0))]
|
||||
fn mk_ident(id: &str, style: token::IdentStyle) -> token::Token {
|
||||
token::Ident(str_to_ident(id), style)
|
||||
}
|
||||
|
@ -63,7 +63,6 @@ use ast::{Visibility, WhereClause, WherePredicate};
|
||||
use ast;
|
||||
use ast_util::{as_prec, ident_to_path, operator_prec};
|
||||
use ast_util;
|
||||
use attr;
|
||||
use codemap::{Span, BytePos, Spanned, spanned, mk_sp};
|
||||
use codemap;
|
||||
use parse;
|
||||
@ -1262,11 +1261,6 @@ impl<'a> Parser<'a> {
|
||||
let vis = p.parse_visibility();
|
||||
let abi = if p.eat_keyword(keywords::Extern) {
|
||||
p.parse_opt_abi().unwrap_or(abi::C)
|
||||
} else if attr::contains_name(attrs.as_slice(),
|
||||
"rust_call_abi_hack") {
|
||||
// FIXME(stage0, pcwalton): Remove this awful hack after a
|
||||
// snapshot, and change to `extern "rust-call" fn`.
|
||||
abi::RustCall
|
||||
} else {
|
||||
abi::Rust
|
||||
};
|
||||
@ -4446,11 +4440,6 @@ impl<'a> Parser<'a> {
|
||||
} else {
|
||||
let abi = if self.eat_keyword(keywords::Extern) {
|
||||
self.parse_opt_abi().unwrap_or(abi::C)
|
||||
} else if attr::contains_name(attrs.as_slice(),
|
||||
"rust_call_abi_hack") {
|
||||
// FIXME(stage0, pcwalton): Remove this awful hack after a
|
||||
// snapshot, and change to `extern "rust-call" fn`.
|
||||
abi::RustCall
|
||||
} else {
|
||||
abi::Rust
|
||||
};
|
||||
|
@ -20,69 +20,6 @@ use std::mem;
|
||||
use std::path::BytesContainer;
|
||||
use std::rc::Rc;
|
||||
|
||||
// NOTE(stage0): remove these re-exports after the next snapshot
|
||||
// (needed to allow quotations to pass stage0)
|
||||
#[cfg(stage0)] pub use self::Plus as PLUS;
|
||||
#[cfg(stage0)] pub use self::Minus as MINUS;
|
||||
#[cfg(stage0)] pub use self::Star as STAR;
|
||||
#[cfg(stage0)] pub use self::Slash as SLASH;
|
||||
#[cfg(stage0)] pub use self::Percent as PERCENT;
|
||||
#[cfg(stage0)] pub use self::Caret as CARET;
|
||||
#[cfg(stage0)] pub use self::And as AND;
|
||||
#[cfg(stage0)] pub use self::Or as OR;
|
||||
#[cfg(stage0)] pub use self::Shl as SHL;
|
||||
#[cfg(stage0)] pub use self::Shr as SHR;
|
||||
#[cfg(stage0)] pub use self::Eq as EQ;
|
||||
#[cfg(stage0)] pub use self::Lt as LT;
|
||||
#[cfg(stage0)] pub use self::Le as LE;
|
||||
#[cfg(stage0)] pub use self::EqEq as EQEQ;
|
||||
#[cfg(stage0)] pub use self::Ne as NE;
|
||||
#[cfg(stage0)] pub use self::Ge as GE;
|
||||
#[cfg(stage0)] pub use self::Gt as GT;
|
||||
#[cfg(stage0)] pub use self::AndAnd as ANDAND;
|
||||
#[cfg(stage0)] pub use self::OrOr as OROR;
|
||||
#[cfg(stage0)] pub use self::Not as NOT;
|
||||
#[cfg(stage0)] pub use self::Tilde as TILDE;
|
||||
#[cfg(stage0)] pub use self::BinOp as BINOP;
|
||||
#[cfg(stage0)] pub use self::BinOpEq as BINOPEQ;
|
||||
#[cfg(stage0)] pub use self::At as AT;
|
||||
#[cfg(stage0)] pub use self::Dot as DOT;
|
||||
#[cfg(stage0)] pub use self::DotDot as DOTDOT;
|
||||
#[cfg(stage0)] pub use self::DotDotDot as DOTDOTDOT;
|
||||
#[cfg(stage0)] pub use self::Comma as COMMA;
|
||||
#[cfg(stage0)] pub use self::Semi as SEMI;
|
||||
#[cfg(stage0)] pub use self::Colon as COLON;
|
||||
#[cfg(stage0)] pub use self::ModSep as MOD_SEP;
|
||||
#[cfg(stage0)] pub use self::RArrow as RARROW;
|
||||
#[cfg(stage0)] pub use self::LArrow as LARROW;
|
||||
#[cfg(stage0)] pub use self::FatArrow as FAT_ARROW;
|
||||
#[cfg(stage0)] pub use self::Pound as POUND;
|
||||
#[cfg(stage0)] pub use self::Dollar as DOLLAR;
|
||||
#[cfg(stage0)] pub use self::Question as QUESTION;
|
||||
#[cfg(stage0)] pub use self::LitByte as LIT_BYTE;
|
||||
#[cfg(stage0)] pub use self::LitChar as LIT_CHAR;
|
||||
#[cfg(stage0)] pub use self::LitInteger as LIT_INTEGER;
|
||||
#[cfg(stage0)] pub use self::LitFloat as LIT_FLOAT;
|
||||
#[cfg(stage0)] pub use self::LitStr as LIT_STR;
|
||||
#[cfg(stage0)] pub use self::LitStrRaw as LIT_STR_RAW;
|
||||
#[cfg(stage0)] pub use self::LitBinary as LIT_BINARY;
|
||||
#[cfg(stage0)] pub use self::LitBinaryRaw as LIT_BINARY_RAW;
|
||||
#[cfg(stage0)] pub use self::Ident as IDENT;
|
||||
#[cfg(stage0)] pub use self::Underscore as UNDERSCORE;
|
||||
#[cfg(stage0)] pub use self::Lifetime as LIFETIME;
|
||||
#[cfg(stage0)] pub use self::Interpolated as INTERPOLATED;
|
||||
#[cfg(stage0)] pub use self::DocComment as DOC_COMMENT;
|
||||
#[cfg(stage0)] pub use self::Whitespace as WS;
|
||||
#[cfg(stage0)] pub use self::Comment as COMMENT;
|
||||
#[cfg(stage0)] pub use self::Shebang as SHEBANG;
|
||||
#[cfg(stage0)] pub use self::Eof as EOF;
|
||||
#[cfg(stage0)] pub const LPAREN: Token = OpenDelim(Paren);
|
||||
#[cfg(stage0)] pub const RPAREN: Token = CloseDelim(Paren);
|
||||
#[cfg(stage0)] pub const LBRACKET: Token = OpenDelim(Bracket);
|
||||
#[cfg(stage0)] pub const RBRACKET: Token = CloseDelim(Bracket);
|
||||
#[cfg(stage0)] pub const LBRACE: Token = OpenDelim(Brace);
|
||||
#[cfg(stage0)] pub const RBRACE: Token = CloseDelim(Brace);
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
|
||||
pub enum BinOpToken {
|
||||
@ -109,15 +46,7 @@ pub enum DelimToken {
|
||||
Brace,
|
||||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const ModName: bool = true;
|
||||
#[cfg(stage0)]
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const Plain: bool = false;
|
||||
|
||||
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
|
||||
#[cfg(not(stage0))]
|
||||
pub enum IdentStyle {
|
||||
/// `::` follows the identifier with no whitespace in-between.
|
||||
ModName,
|
||||
@ -173,9 +102,6 @@ pub enum Token {
|
||||
LitBinaryRaw(ast::Name, uint), /* raw binary str delimited by n hash symbols */
|
||||
|
||||
/* Name components */
|
||||
#[cfg(stage0)]
|
||||
Ident(ast::Ident, bool),
|
||||
#[cfg(not(stage0))]
|
||||
Ident(ast::Ident, IdentStyle),
|
||||
Underscore,
|
||||
Lifetime(ast::Ident),
|
||||
@ -398,9 +324,6 @@ pub enum Nonterminal {
|
||||
NtPat(P<ast::Pat>),
|
||||
NtExpr(P<ast::Expr>),
|
||||
NtTy(P<ast::Ty>),
|
||||
#[cfg(stage0)]
|
||||
NtIdent(Box<ast::Ident>, bool),
|
||||
#[cfg(not(stage0))]
|
||||
NtIdent(Box<ast::Ident>, IdentStyle),
|
||||
/// Stuff inside brackets for attributes
|
||||
NtMeta(P<ast::MetaItem>),
|
||||
|
@ -1,3 +1,12 @@
|
||||
S 2014-11-04 1b2ad78
|
||||
freebsd-x86_64 f8c41a522d6a3c9691a0865dab170dcb988e9141
|
||||
linux-i386 d827fbbd778b854923971873cf03bdb79c2e8575
|
||||
linux-x86_64 1ddca522a8ba4a4f662dc17ca16b0f50f2c15f87
|
||||
macos-i386 597cd42301e1569df8ad090574cd535d19283387
|
||||
macos-x86_64 4bfb2aff1c3e3c57653b32adc34b399c5aeb759b
|
||||
winnt-i386 11390f5607bf638b515931dd2f85a7245bf91581
|
||||
winnt-x86_64 905c34b5eeaa502fe4ad7446b3d9afb4a8d167c9
|
||||
|
||||
S 2014-10-22 d44ea72
|
||||
freebsd-x86_64 8bf5ee7c1ca8ab880800cf3a535e16bb7ffbf9e8
|
||||
linux-i386 1fc8302b405406a3fc183b23c8397bef5a56c52a
|
||||
|
@ -16,18 +16,15 @@
|
||||
struct Foo { foo: uint }
|
||||
|
||||
impl FnOnce<(), uint> for Foo {
|
||||
#[rust_call_abi_hack]
|
||||
fn call_once(self, _: ()) -> uint { self.foo }
|
||||
extern "rust-call" fn call_once(self, _: ()) -> uint { self.foo }
|
||||
}
|
||||
|
||||
impl FnOnce<(uint,), uint> for Foo {
|
||||
#[rust_call_abi_hack]
|
||||
fn call_once(self, (x,): (uint,)) -> uint { self.foo + x }
|
||||
extern "rust-call" fn call_once(self, (x,): (uint,)) -> uint { self.foo + x }
|
||||
}
|
||||
|
||||
impl FnOnce<(uint, uint), uint> for Foo {
|
||||
#[rust_call_abi_hack]
|
||||
fn call_once(self, (x, y): (uint, uint)) -> uint { self.foo + x + y }
|
||||
extern "rust-call" fn call_once(self, (x, y): (uint, uint)) -> uint { self.foo + x + y }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user