Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4e7d86c0
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,发现更多精彩内容 >>
提交
4e7d86c0
编写于
10月 16, 2014
作者:
N
Nick Cameron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resolve methods called as functions and...
...defined in another crate. Fixes #18061
上级
5e834243
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
26 deletion
+34
-26
src/librustc/metadata/decoder.rs
src/librustc/metadata/decoder.rs
+6
-0
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+27
-20
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+1
-6
未找到文件。
src/librustc/metadata/decoder.rs
浏览文件 @
4e7d86c0
...
...
@@ -115,6 +115,8 @@ enum Family {
CtorFn
,
// o
StaticMethod
,
// F
UnsafeStaticMethod
,
// U
Method
,
// h
UnsafeMethod
,
// H
Type
,
// y
ForeignType
,
// T
Mod
,
// m
...
...
@@ -141,6 +143,8 @@ fn item_family(item: rbml::Doc) -> Family {
'o'
=>
CtorFn
,
'F'
=>
StaticMethod
,
'U'
=>
UnsafeStaticMethod
,
'h'
=>
Method
,
'H'
=>
UnsafeMethod
,
'y'
=>
Type
,
'T'
=>
ForeignType
,
'm'
=>
Mod
,
...
...
@@ -312,6 +316,8 @@ fn item_to_def_like(item: rbml::Doc, did: ast::DefId, cnum: ast::CrateNum)
UnsafeFn
=>
DlDef
(
def
::
DefFn
(
did
,
ast
::
UnsafeFn
,
false
)),
Fn
=>
DlDef
(
def
::
DefFn
(
did
,
ast
::
NormalFn
,
false
)),
CtorFn
=>
DlDef
(
def
::
DefFn
(
did
,
ast
::
NormalFn
,
true
)),
UnsafeMethod
=>
DlDef
(
def
::
DefMethod
(
did
,
ast
::
UnsafeFn
,
false
)),
Method
=>
DlDef
(
def
::
DefMethod
(
did
,
ast
::
NormalFn
,
false
)),
StaticMethod
|
UnsafeStaticMethod
=>
{
let
fn_style
=
if
fam
==
UnsafeStaticMethod
{
ast
::
UnsafeFn
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
4e7d86c0
...
...
@@ -840,7 +840,7 @@ fn encode_method_ty_fields(ecx: &EncodeContext,
ty
::
StaticExplicitSelfCategory
=>
{
encode_family
(
rbml_w
,
fn_style_static_method_family
(
fn_style
));
}
_
=>
encode_family
(
rbml_w
,
style_fn
_family
(
fn_style
))
_
=>
encode_family
(
rbml_w
,
fn_style_method
_family
(
fn_style
))
}
encode_provided_source
(
rbml_w
,
method_ty
.provided_source
);
}
...
...
@@ -978,6 +978,13 @@ fn fn_style_static_method_family(s: FnStyle) -> char {
}
}
fn
fn_style_method_family
(
s
:
FnStyle
)
->
char
{
match
s
{
UnsafeFn
=>
'h'
,
NormalFn
=>
'H'
,
}
}
fn
should_inline
(
attrs
:
&
[
Attribute
])
->
bool
{
use
syntax
::
attr
::
*
;
...
...
@@ -1407,7 +1414,7 @@ fn add_to_index(item: &Item, rbml_w: &Encoder,
}
_
=>
{
encode_family
(
rbml_w
,
style_fn
_family
(
fn_style_method
_family
(
method_ty
.fty.fn_style
));
}
}
...
...
@@ -1432,30 +1439,30 @@ fn add_to_index(item: &Item, rbml_w: &Encoder,
encode_parent_sort
(
rbml_w
,
't'
);
let
trait_item
=
&
ms
[
i
];
match
&
ms
[
i
]
{
&
RequiredMethod
(
ref
tm
)
=>
{
encode_attributes
(
rbml_w
,
tm
.attrs
.as_slice
());
let
foo
=
|
rbml_w
:
&
mut
Encoder
|
{
// If this is a static method, we've already
// encoded this.
if
is_nonstatic_method
{
// FIXME: I feel like there is something funny
// going on.
let
pty
=
ty
::
lookup_item_type
(
tcx
,
item_def_id
.def_id
());
encode_bounds_and_type
(
rbml_w
,
ecx
,
&
pty
);
}
};
match
trait_item
{
&
RequiredMethod
(
ref
m
)
=>
{
encode_attributes
(
rbml_w
,
m
.attrs
.as_slice
());
foo
(
rbml_w
);
encode_item_sort
(
rbml_w
,
'r'
);
encode_method_argument_names
(
rbml_w
,
&*
t
m
.decl
);
encode_method_argument_names
(
rbml_w
,
&*
m
.decl
);
}
&
ProvidedMethod
(
ref
m
)
=>
{
encode_attributes
(
rbml_w
,
m
.attrs
.as_slice
());
// If this is a static method, we've already
// encoded this.
if
is_nonstatic_method
{
// FIXME: I feel like there is something funny
// going on.
let
pty
=
ty
::
lookup_item_type
(
tcx
,
item_def_id
.def_id
());
encode_bounds_and_type
(
rbml_w
,
ecx
,
&
pty
);
}
foo
(
rbml_w
);
encode_item_sort
(
rbml_w
,
'p'
);
encode_inlined_item
(
ecx
,
rbml_w
,
IITraitItemRef
(
def_id
,
trait_item
));
encode_method_argument_names
(
rbml_w
,
&*
m
.pe_fn_decl
());
encode_inlined_item
(
ecx
,
rbml_w
,
IITraitItemRef
(
def_id
,
trait_item
));
encode_method_argument_names
(
rbml_w
,
&*
m
.pe_fn_decl
());
}
&
TypeTraitItem
(
ref
associated_type
)
=>
{
...
...
src/librustc/middle/resolve.rs
浏览文件 @
4e7d86c0
...
...
@@ -1837,7 +1837,7 @@ fn handle_external_def(&mut self,
csearch
::
get_tuple_struct_definition_if_ctor
(
&
self
.session.cstore
,
ctor_id
)
.map_or
(
def
,
|
_
|
DefStruct
(
ctor_id
)),
DUMMY_SP
,
is_public
);
}
DefFn
(
..
)
|
DefStaticMethod
(
..
)
|
DefStatic
(
..
)
|
DefConst
(
..
)
=>
{
DefFn
(
..
)
|
DefStaticMethod
(
..
)
|
DefStatic
(
..
)
|
DefConst
(
..
)
|
DefMethod
(
..
)
=>
{
debug!
(
"(building reduced graph for external
\
crate) building value (fn/static) {}"
,
final_ident
);
child_name_bindings
.define_value
(
def
,
DUMMY_SP
,
is_public
);
...
...
@@ -1902,11 +1902,6 @@ fn handle_external_def(&mut self,
// Record the def ID and fields of this struct.
self
.structs
.insert
(
def_id
,
fields
);
}
DefMethod
(
..
)
=>
{
debug!
(
"(building reduced graph for external crate)
\
ignoring {}"
,
def
);
// Ignored; handled elsewhere.
}
DefLocal
(
..
)
|
DefPrimTy
(
..
)
|
DefTyParam
(
..
)
|
DefUse
(
..
)
|
DefUpvar
(
..
)
|
DefRegion
(
..
)
|
DefTyParamBinder
(
..
)
|
DefLabel
(
..
)
|
DefSelfTy
(
..
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录