Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
116897fa
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,发现更多精彩内容 >>
提交
116897fa
编写于
6月 21, 2013
作者:
C
Corey Richardson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove `ast::pure_fn` and all concept of `pure` from the compiler
上级
45f588e8
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
21 addition
and
39 deletion
+21
-39
src/librustc/metadata/decoder.rs
src/librustc/metadata/decoder.rs
+1
-13
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+0
-2
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tydecode.rs
+1
-2
src/librustc/metadata/tyencode.rs
src/librustc/metadata/tyencode.rs
+0
-1
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/reflect.rs
+0
-1
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+1
-1
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+1
-1
src/librustc/middle/typeck/infer/glb.rs
src/librustc/middle/typeck/infer/glb.rs
+1
-2
src/librustc/middle/typeck/infer/lub.rs
src/librustc/middle/typeck/infer/lub.rs
+2
-3
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+0
-2
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+14
-11
未找到文件。
src/librustc/metadata/decoder.rs
浏览文件 @
116897fa
...
...
@@ -100,10 +100,8 @@ enum Family {
Const
,
// c
Fn
,
// f
UnsafeFn
,
// u
PureFn
,
// p
StaticMethod
,
// F
UnsafeStaticMethod
,
// U
PureStaticMethod
,
// P
ForeignFn
,
// e
Type
,
// y
ForeignType
,
// T
...
...
@@ -125,10 +123,8 @@ fn item_family(item: ebml::Doc) -> Family {
'c'
=>
Const
,
'f'
=>
Fn
,
'u'
=>
UnsafeFn
,
'p'
=>
PureFn
,
'F'
=>
StaticMethod
,
'U'
=>
UnsafeStaticMethod
,
'P'
=>
PureStaticMethod
,
'e'
=>
ForeignFn
,
'y'
=>
Type
,
'T'
=>
ForeignType
,
...
...
@@ -325,7 +321,6 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::crate_num)
Struct
=>
dl_def
(
ast
::
def_struct
(
did
)),
UnsafeFn
=>
dl_def
(
ast
::
def_fn
(
did
,
ast
::
unsafe_fn
)),
Fn
=>
dl_def
(
ast
::
def_fn
(
did
,
ast
::
impure_fn
)),
PureFn
=>
dl_def
(
ast
::
def_fn
(
did
,
ast
::
pure_fn
)),
ForeignFn
=>
dl_def
(
ast
::
def_fn
(
did
,
ast
::
extern_fn
)),
UnsafeStaticMethod
=>
{
let
trait_did_opt
=
translated_parent_item_opt
(
cnum
,
item
);
...
...
@@ -335,10 +330,6 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::crate_num)
let
trait_did_opt
=
translated_parent_item_opt
(
cnum
,
item
);
dl_def
(
ast
::
def_static_method
(
did
,
trait_did_opt
,
ast
::
impure_fn
))
}
PureStaticMethod
=>
{
let
trait_did_opt
=
translated_parent_item_opt
(
cnum
,
item
);
dl_def
(
ast
::
def_static_method
(
did
,
trait_did_opt
,
ast
::
pure_fn
))
}
Type
|
ForeignType
=>
dl_def
(
ast
::
def_ty
(
did
)),
Mod
=>
dl_def
(
ast
::
def_mod
(
did
)),
ForeignMod
=>
dl_def
(
ast
::
def_foreign_mod
(
did
)),
...
...
@@ -822,12 +813,11 @@ pub fn get_static_methods_if_impl(intr: @ident_interner,
let
impl_method_doc
=
lookup_item
(
impl_method_id
.node
,
cdata
.data
);
let
family
=
item_family
(
impl_method_doc
);
match
family
{
StaticMethod
|
UnsafeStaticMethod
|
PureStaticMethod
=>
{
StaticMethod
|
UnsafeStaticMethod
=>
{
let
purity
;
match
item_family
(
impl_method_doc
)
{
StaticMethod
=>
purity
=
ast
::
impure_fn
,
UnsafeStaticMethod
=>
purity
=
ast
::
unsafe_fn
,
PureStaticMethod
=>
purity
=
ast
::
pure_fn
,
_
=>
fail
!
()
}
...
...
@@ -934,10 +924,8 @@ fn item_family_to_str(fam: Family) -> ~str {
Const
=>
~
"const"
,
Fn
=>
~
"fn"
,
UnsafeFn
=>
~
"unsafe fn"
,
PureFn
=>
~
"pure fn"
,
StaticMethod
=>
~
"static method"
,
UnsafeStaticMethod
=>
~
"unsafe static method"
,
PureStaticMethod
=>
~
"pure static method"
,
ForeignFn
=>
~
"foreign fn"
,
Type
=>
~
"type"
,
ForeignType
=>
~
"foreign type"
,
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
116897fa
...
...
@@ -753,7 +753,6 @@ fn encode_info_for_method(ecx: &EncodeContext,
fn
purity_fn_family
(
p
:
purity
)
->
char
{
match
p
{
unsafe_fn
=>
'u'
,
pure_fn
=>
'p'
,
impure_fn
=>
'f'
,
extern_fn
=>
'e'
}
...
...
@@ -762,7 +761,6 @@ fn purity_fn_family(p: purity) -> char {
fn
purity_static_method_family
(
p
:
purity
)
->
char
{
match
p
{
unsafe_fn
=>
'U'
,
pure_fn
=>
'P'
,
impure_fn
=>
'F'
,
_
=>
fail
!
(
"extern fn can't be static"
)
}
...
...
src/librustc/metadata/tydecode.rs
浏览文件 @
116897fa
...
...
@@ -439,10 +439,9 @@ fn parse_hex(st: &mut PState) -> uint {
fn
parse_purity
(
c
:
char
)
->
purity
{
match
c
{
'u'
=>
unsafe_fn
,
'p'
=>
pure_fn
,
'i'
=>
impure_fn
,
'c'
=>
extern_fn
,
_
=>
fail
!
(
"parse_purity: bad purity
"
)
_
=>
fail
!
(
"parse_purity: bad purity
%c"
,
c
)
}
}
...
...
src/librustc/metadata/tyencode.rs
浏览文件 @
116897fa
...
...
@@ -347,7 +347,6 @@ fn enc_sigil(w: @io::Writer, sigil: Sigil) {
fn
enc_purity
(
w
:
@
io
::
Writer
,
p
:
purity
)
{
match
p
{
pure_fn
=>
w
.write_char
(
'p'
),
impure_fn
=>
w
.write_char
(
'i'
),
unsafe_fn
=>
w
.write_char
(
'u'
),
extern_fn
=>
w
.write_char
(
'c'
)
...
...
src/librustc/middle/trans/reflect.rs
浏览文件 @
116897fa
...
...
@@ -398,7 +398,6 @@ pub fn ast_sigil_constant(sigil: ast::Sigil) -> uint {
pub
fn
ast_purity_constant
(
purity
:
ast
::
purity
)
->
uint
{
match
purity
{
ast
::
pure_fn
=>
0u
,
ast
::
unsafe_fn
=>
1u
,
ast
::
impure_fn
=>
2u
,
ast
::
extern_fn
=>
3u
...
...
src/librustc/middle/ty.rs
浏览文件 @
116897fa
...
...
@@ -1253,7 +1253,7 @@ pub fn mk_ctor_fn(cx: ctxt, input_tys: &[ty::t], output: ty::t) -> t {
let
input_args
=
input_tys
.map
(|
t
|
*
t
);
mk_bare_fn
(
cx
,
BareFnTy
{
purity
:
ast
::
pure_fn
,
purity
:
ast
::
im
pure_fn
,
abis
:
AbiSet
::
Rust
(),
sig
:
FnSig
{
bound_lifetime_names
:
opt_vec
::
Empty
,
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
116897fa
...
...
@@ -275,7 +275,7 @@ pub fn blank_fn_ctxt(ccx: @mut CrateCtxt,
err_count_on_creation
:
ccx
.tcx.sess
.err_count
(),
ret_ty
:
rty
,
indirect_ret_ty
:
None
,
ps
:
PurityState
::
function
(
ast
::
pure_fn
,
0
),
ps
:
PurityState
::
function
(
ast
::
im
pure_fn
,
0
),
region_lb
:
region_bnd
,
in_scope_regions
:
@
Nil
,
fn_kind
:
Vanilla
,
...
...
src/librustc/middle/typeck/infer/glb.rs
浏览文件 @
116897fa
...
...
@@ -23,7 +23,7 @@
use
middle
::
typeck
::
isr_alist
;
use
syntax
::
ast
;
use
syntax
::
ast
::{
Many
,
Once
,
extern_fn
,
impure_fn
,
m_const
,
m_imm
,
m_mutbl
};
use
syntax
::
ast
::{
pure_fn
,
unsafe_fn
};
use
syntax
::
ast
::{
unsafe_fn
};
use
syntax
::
ast
::{
Onceness
,
purity
};
use
syntax
::
abi
::
AbiSet
;
use
syntax
::
codemap
::
span
;
...
...
@@ -103,7 +103,6 @@ fn contratys(&self, a: ty::t, b: ty::t) -> cres<ty::t> {
fn
purities
(
&
self
,
a
:
purity
,
b
:
purity
)
->
cres
<
purity
>
{
match
(
a
,
b
)
{
(
pure_fn
,
_
)
|
(
_
,
pure_fn
)
=>
Ok
(
pure_fn
),
(
extern_fn
,
_
)
|
(
_
,
extern_fn
)
=>
Ok
(
extern_fn
),
(
impure_fn
,
_
)
|
(
_
,
impure_fn
)
=>
Ok
(
impure_fn
),
(
unsafe_fn
,
unsafe_fn
)
=>
Ok
(
unsafe_fn
)
...
...
src/librustc/middle/typeck/infer/lub.rs
浏览文件 @
116897fa
...
...
@@ -28,7 +28,7 @@
use
syntax
::
abi
::
AbiSet
;
use
syntax
::
ast
;
use
syntax
::
ast
::{
Many
,
Once
,
extern_fn
,
m_const
,
impure_fn
};
use
syntax
::
ast
::{
pure_fn
,
unsafe_fn
};
use
syntax
::
ast
::{
unsafe_fn
};
use
syntax
::
ast
::{
Onceness
,
purity
};
use
syntax
::
codemap
::
span
;
...
...
@@ -92,8 +92,7 @@ fn purities(&self, a: purity, b: purity) -> cres<purity> {
match
(
a
,
b
)
{
(
unsafe_fn
,
_
)
|
(
_
,
unsafe_fn
)
=>
Ok
(
unsafe_fn
),
(
impure_fn
,
_
)
|
(
_
,
impure_fn
)
=>
Ok
(
impure_fn
),
(
extern_fn
,
_
)
|
(
_
,
extern_fn
)
=>
Ok
(
extern_fn
),
(
pure_fn
,
pure_fn
)
=>
Ok
(
pure_fn
)
(
extern_fn
,
extern_fn
)
=>
Ok
(
extern_fn
),
}
}
...
...
src/libsyntax/ast.rs
浏览文件 @
116897fa
...
...
@@ -845,7 +845,6 @@ pub struct fn_decl {
#[deriving(Eq,
Encodable,
Decodable)]
pub
enum
purity
{
pure_fn
,
// declared with "pure fn"
unsafe_fn
,
// declared with "unsafe fn"
impure_fn
,
// declared with "fn"
extern_fn
,
// declared with "extern fn"
...
...
@@ -856,7 +855,6 @@ fn to_str(&self) -> ~str {
match
*
self
{
impure_fn
=>
~
"impure"
,
unsafe_fn
=>
~
"unsafe"
,
pure_fn
=>
~
"pure"
,
extern_fn
=>
~
"extern"
}
}
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
116897fa
...
...
@@ -2188,26 +2188,29 @@ pub fn print_fn_header_info(s: @ps,
print_opt_sigil
(
s
,
opt_sigil
);
}
pub
fn
opt_sigil_to_str
(
opt_p
:
Option
<
ast
::
Sigil
>
)
->
~
str
{
pub
fn
opt_sigil_to_str
(
opt_p
:
Option
<
ast
::
Sigil
>
)
->
&
'static
str
{
match
opt_p
{
None
=>
~
"fn"
,
Some
(
p
)
=>
fmt!
(
"fn%s"
,
p
.to_str
())
None
=>
"fn"
,
Some
(
p
)
=>
match
p
{
ast
::
BorrowedSigil
=>
"fn&"
,
ast
::
OwnedSigil
=>
"fn~"
,
ast
::
ManagedSigil
=>
"fn@"
}
}
}
pub
fn
purity_to_str
(
p
:
ast
::
purity
)
->
~
str
{
pub
fn
purity_to_str
(
p
:
ast
::
purity
)
->
&
'static
str
{
match
p
{
ast
::
impure_fn
=>
~
"impure"
,
ast
::
unsafe_fn
=>
~
"unsafe"
,
ast
::
pure_fn
=>
~
"pure"
,
ast
::
extern_fn
=>
~
"extern"
ast
::
impure_fn
=>
"impure"
,
ast
::
unsafe_fn
=>
"unsafe"
,
ast
::
extern_fn
=>
"extern"
}
}
pub
fn
onceness_to_str
(
o
:
ast
::
Onceness
)
->
~
str
{
pub
fn
onceness_to_str
(
o
:
ast
::
Onceness
)
->
&
'static
str
{
match
o
{
ast
::
Once
=>
~
"once"
,
ast
::
Many
=>
~
"many"
ast
::
Once
=>
"once"
,
ast
::
Many
=>
"many"
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录