Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
56dbf3d1
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
56dbf3d1
编写于
11月 01, 2014
作者:
E
Eduard Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Register snapshots.
上级
eca8f113
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
18 addition
and
352 deletion
+18
-352
src/libcore/fmt/mod.rs
src/libcore/fmt/mod.rs
+0
-153
src/libcore/intrinsics.rs
src/libcore/intrinsics.rs
+0
-1
src/libcore/ops.rs
src/libcore/ops.rs
+4
-8
src/libcore/panicking.rs
src/libcore/panicking.rs
+0
-47
src/librustc/middle/typeck/collect.rs
src/librustc/middle/typeck/collect.rs
+2
-16
src/librustrt/unwind.rs
src/librustrt/unwind.rs
+0
-8
src/libstd/fmt.rs
src/libstd/fmt.rs
+0
-16
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+0
-3
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/lexer/mod.rs
+0
-6
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+0
-11
src/libsyntax/parse/token.rs
src/libsyntax/parse/token.rs
+0
-77
src/snapshots.txt
src/snapshots.txt
+9
-0
src/test/run-pass/issue-16739.rs
src/test/run-pass/issue-16739.rs
+3
-6
未找到文件。
src/libcore/fmt/mod.rs
浏览文件 @
56dbf3d1
...
...
@@ -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 @@ fn fmt(&self, f: &mut Formatter) -> Result {
}
}
// 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 @@ fn fmt(&self, f: &mut Formatter) -> Result {
}
}
// 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 @@ fn fmt(&self, f: &mut Formatter) -> Result {
}
}
// 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 @@ fn fmt(&self, fmt: &mut Formatter) -> Result {
// 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 @@ fn fmt(&self, f: &mut Formatter) -> Result {
}
}
})
#[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
)
}
}
...
...
src/libcore/intrinsics.rs
浏览文件 @
56dbf3d1
...
...
@@ -171,7 +171,6 @@ pub struct TyDesc {
/// 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.
...
...
src/libcore/ops.rs
浏览文件 @
56dbf3d1
...
...
@@ -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 @@ pub trait FnOnce<Args,Result> {
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
,)
*
)
}
...
...
src/libcore/panicking.rs
浏览文件 @
56dbf3d1
...
...
@@ -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)]
...
...
src/librustc/middle/typeck/collect.rs
浏览文件 @
56dbf3d1
...
...
@@ -574,20 +574,6 @@ fn ty_of_method(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 ty_of_method(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 ty_of_method(ccx: &CrateCtxt,
untransformed_rcvr_ty
,
m
.pe_explicit_self
(),
&*
m
.pe_fn_decl
(),
real_abi
)
m
.pe_abi
()
)
}
};
...
...
src/librustrt/unwind.rs
浏览文件 @
56dbf3d1
...
...
@@ -497,14 +497,6 @@ extern "C" fn inner(
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
...
...
src/libstd/fmt.rs
浏览文件 @
56dbf3d1
...
...
@@ -424,22 +424,6 @@ fn my_fmt_fn(args: &fmt::Arguments) {
#[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.
...
...
src/libsyntax/ast.rs
浏览文件 @
56dbf3d1
...
...
@@ -24,9 +24,6 @@
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".
...
...
src/libsyntax/parse/lexer/mod.rs
浏览文件 @
56dbf3d1
...
...
@@ -1491,13 +1491,7 @@ fn check_tokenization (mut string_reader: StringReader, expected: Vec<token::Tok
}
}
#[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
)
}
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
56dbf3d1
...
...
@@ -63,7 +63,6 @@
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 @@ pub fn parse_trait_items(&mut self) -> Vec<TraitItem> {
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 @@ pub fn parse_method(&mut self,
}
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
};
...
...
src/libsyntax/parse/token.rs
浏览文件 @
56dbf3d1
...
...
@@ -20,69 +20,6 @@
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
>
),
...
...
src/snapshots.txt
浏览文件 @
56dbf3d1
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
...
...
src/test/run-pass/issue-16739.rs
浏览文件 @
56dbf3d1
...
...
@@ -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
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录