Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
d0a9a39b
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,发现更多精彩内容 >>
提交
d0a9a39b
编写于
1月 24, 2015
作者:
M
Ms2ger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename found_ast to FoundAst and qualify uses.
This matches contemporary Rust style.
上级
a530cc97
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
24 deletion
+20
-24
src/librustc/metadata/csearch.rs
src/librustc/metadata/csearch.rs
+5
-9
src/librustc/metadata/decoder.rs
src/librustc/metadata/decoder.rs
+5
-5
src/librustc/middle/const_eval.rs
src/librustc/middle/const_eval.rs
+2
-2
src/librustc_trans/trans/inline.rs
src/librustc_trans/trans/inline.rs
+8
-8
未找到文件。
src/librustc/metadata/csearch.rs
浏览文件 @
d0a9a39b
...
...
@@ -10,10 +10,6 @@
// Searching for information from the cstore
#![allow(non_camel_case_types)]
pub
use
self
::
found_ast
::
*
;
use
metadata
::
common
::
*
;
use
metadata
::
cstore
;
use
metadata
::
decoder
;
...
...
@@ -101,10 +97,10 @@ pub fn get_item_path(tcx: &ty::ctxt, def: ast::DefId) -> Vec<ast_map::PathElem>
r
}
pub
enum
found_a
st
<
'ast
>
{
f
ound
(
&
'ast
ast
::
InlinedItem
),
found_p
arent
(
ast
::
DefId
,
&
'ast
ast
::
InlinedItem
),
not_f
ound
,
pub
enum
FoundA
st
<
'ast
>
{
F
ound
(
&
'ast
ast
::
InlinedItem
),
FoundP
arent
(
ast
::
DefId
,
&
'ast
ast
::
InlinedItem
),
NotF
ound
,
}
// Finds the AST for this item in the crate metadata, if any. If the item was
...
...
@@ -112,7 +108,7 @@ pub enum found_ast<'ast> {
// will be returned.
pub
fn
maybe_get_item_ast
<
'tcx
>
(
tcx
:
&
ty
::
ctxt
<
'tcx
>
,
def
:
ast
::
DefId
,
decode_inlined_item
:
decoder
::
DecodeInlinedItem
)
->
found_a
st
<
'tcx
>
{
->
FoundA
st
<
'tcx
>
{
let
cstore
=
&
tcx
.sess.cstore
;
let
cdata
=
cstore
.get_crate_data
(
def
.krate
);
decoder
::
maybe_get_item_ast
(
&*
cdata
,
tcx
,
def
.node
,
decode_inlined_item
)
...
...
src/librustc/metadata/decoder.rs
浏览文件 @
d0a9a39b
...
...
@@ -693,23 +693,23 @@ pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> Vec<ast_map::PathElem> {
pub
fn
maybe_get_item_ast
<
'tcx
>
(
cdata
:
Cmd
,
tcx
:
&
ty
::
ctxt
<
'tcx
>
,
id
:
ast
::
NodeId
,
mut
decode_inlined_item
:
DecodeInlinedItem
)
->
csearch
::
found_a
st
<
'tcx
>
{
->
csearch
::
FoundA
st
<
'tcx
>
{
debug!
(
"Looking up item: {}"
,
id
);
let
item_doc
=
lookup_item
(
id
,
cdata
.data
());
let
path
=
item_path
(
item_doc
)
.init
()
.to_vec
();
match
decode_inlined_item
(
cdata
,
tcx
,
path
,
item_doc
)
{
Ok
(
ii
)
=>
csearch
::
f
ound
(
ii
),
Ok
(
ii
)
=>
csearch
::
FoundAst
::
F
ound
(
ii
),
Err
(
path
)
=>
{
match
item_parent_item
(
item_doc
)
{
Some
(
did
)
=>
{
let
did
=
translate_def_id
(
cdata
,
did
);
let
parent_item
=
lookup_item
(
did
.node
,
cdata
.data
());
match
decode_inlined_item
(
cdata
,
tcx
,
path
,
parent_item
)
{
Ok
(
ii
)
=>
csearch
::
found_p
arent
(
did
,
ii
),
Err
(
_
)
=>
csearch
::
not_f
ound
Ok
(
ii
)
=>
csearch
::
FoundAst
::
FoundP
arent
(
did
,
ii
),
Err
(
_
)
=>
csearch
::
FoundAst
::
NotF
ound
}
}
None
=>
csearch
::
not_f
ound
None
=>
csearch
::
FoundAst
::
NotF
ound
}
}
}
...
...
src/librustc/middle/const_eval.rs
浏览文件 @
d0a9a39b
...
...
@@ -133,7 +133,7 @@ fn variant_expr<'a>(variants: &'a [P<ast::Variant>], id: ast::NodeId)
}
let
expr_id
=
match
csearch
::
maybe_get_item_ast
(
tcx
,
enum_def
,
box
|
a
,
b
,
c
,
d
|
astencode
::
decode_inlined_item
(
a
,
b
,
c
,
d
))
{
csearch
::
f
ound
(
&
ast
::
IIItem
(
ref
item
))
=>
match
item
.node
{
csearch
::
FoundAst
::
F
ound
(
&
ast
::
IIItem
(
ref
item
))
=>
match
item
.node
{
ast
::
ItemEnum
(
ast
::
EnumDef
{
ref
variants
},
_
)
=>
{
// NOTE this doesn't do the right thing, it compares inlined
// NodeId's to the original variant_def's NodeId, but they
...
...
@@ -173,7 +173,7 @@ pub fn lookup_const_by_id<'a>(tcx: &'a ty::ctxt, def_id: ast::DefId)
}
let
expr_id
=
match
csearch
::
maybe_get_item_ast
(
tcx
,
def_id
,
box
|
a
,
b
,
c
,
d
|
astencode
::
decode_inlined_item
(
a
,
b
,
c
,
d
))
{
csearch
::
f
ound
(
&
ast
::
IIItem
(
ref
item
))
=>
match
item
.node
{
csearch
::
FoundAst
::
F
ound
(
&
ast
::
IIItem
(
ref
item
))
=>
match
item
.node
{
ast
::
ItemConst
(
_
,
ref
const_expr
)
=>
Some
(
const_expr
.id
),
_
=>
None
},
...
...
src/librustc_trans/trans/inline.rs
浏览文件 @
d0a9a39b
...
...
@@ -43,11 +43,11 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
box
|
a
,
b
,
c
,
d
|
astencode
::
decode_inlined_item
(
a
,
b
,
c
,
d
));
let
inline_def
=
match
csearch_result
{
csearch
::
not_f
ound
=>
{
csearch
::
FoundAst
::
NotF
ound
=>
{
ccx
.external
()
.borrow_mut
()
.insert
(
fn_id
,
None
);
return
None
;
}
csearch
::
f
ound
(
&
ast
::
IIItem
(
ref
item
))
=>
{
csearch
::
FoundAst
::
F
ound
(
&
ast
::
IIItem
(
ref
item
))
=>
{
ccx
.external
()
.borrow_mut
()
.insert
(
fn_id
,
Some
(
item
.id
));
ccx
.external_srcs
()
.borrow_mut
()
.insert
(
item
.id
,
fn_id
);
...
...
@@ -90,12 +90,12 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
local_def
(
item
.id
)
}
csearch
::
f
ound
(
&
ast
::
IIForeign
(
ref
item
))
=>
{
csearch
::
FoundAst
::
F
ound
(
&
ast
::
IIForeign
(
ref
item
))
=>
{
ccx
.external
()
.borrow_mut
()
.insert
(
fn_id
,
Some
(
item
.id
));
ccx
.external_srcs
()
.borrow_mut
()
.insert
(
item
.id
,
fn_id
);
local_def
(
item
.id
)
}
csearch
::
found_p
arent
(
parent_id
,
&
ast
::
IIItem
(
ref
item
))
=>
{
csearch
::
FoundAst
::
FoundP
arent
(
parent_id
,
&
ast
::
IIItem
(
ref
item
))
=>
{
ccx
.external
()
.borrow_mut
()
.insert
(
parent_id
,
Some
(
item
.id
));
ccx
.external_srcs
()
.borrow_mut
()
.insert
(
item
.id
,
parent_id
);
...
...
@@ -124,11 +124,11 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
trans_item
(
ccx
,
&**
item
);
local_def
(
my_id
)
}
csearch
::
found_p
arent
(
_
,
_
)
=>
{
ccx
.sess
()
.bug
(
"maybe_get_item_ast returned a
found_p
arent
\
csearch
::
FoundAst
::
FoundP
arent
(
_
,
_
)
=>
{
ccx
.sess
()
.bug
(
"maybe_get_item_ast returned a
FoundP
arent
\
with a non-item parent"
);
}
csearch
::
f
ound
(
&
ast
::
IITraitItem
(
_
,
ref
trait_item
))
=>
{
csearch
::
FoundAst
::
F
ound
(
&
ast
::
IITraitItem
(
_
,
ref
trait_item
))
=>
{
match
*
trait_item
{
ast
::
RequiredMethod
(
_
)
=>
ccx
.sess
()
.bug
(
"found RequiredMethod IITraitItem"
),
ast
::
ProvidedMethod
(
ref
mth
)
=>
{
...
...
@@ -147,7 +147,7 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
}
}
}
csearch
::
f
ound
(
&
ast
::
IIImplItem
(
impl_did
,
ref
impl_item
))
=>
{
csearch
::
FoundAst
::
F
ound
(
&
ast
::
IIImplItem
(
impl_did
,
ref
impl_item
))
=>
{
match
*
impl_item
{
ast
::
MethodImplItem
(
ref
mth
)
=>
{
ccx
.external
()
.borrow_mut
()
.insert
(
fn_id
,
Some
(
mth
.id
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录