Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fecef74d
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,发现更多精彩内容 >>
提交
fecef74d
编写于
12月 22, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: De-`@mut` the inherent implementations list
上级
ed819c9a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
9 deletion
+19
-9
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+4
-2
src/librustc/middle/dead.rs
src/librustc/middle/dead.rs
+2
-1
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+7
-3
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/method.rs
+2
-1
src/librustc/middle/typeck/coherence.rs
src/librustc/middle/typeck/coherence.rs
+4
-2
未找到文件。
src/librustc/metadata/encoder.rs
浏览文件 @
fecef74d
...
...
@@ -449,7 +449,8 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
let
inherent_impls
=
ecx
.tcx.inherent_impls
.borrow
();
match
inherent_impls
.get
()
.find
(
&
exp
.def_id
)
{
Some
(
implementations
)
=>
{
for
&
base_impl
in
implementations
.iter
()
{
let
implementations
=
implementations
.borrow
();
for
&
base_impl
in
implementations
.get
()
.iter
()
{
for
&
m
in
base_impl
.methods
.iter
()
{
if
m
.explicit_self
==
ast
::
sty_static
{
encode_reexported_static_method
(
ecx
,
ebml_w
,
exp
,
...
...
@@ -884,7 +885,8 @@ fn encode_inherent_implementations(ecx: &EncodeContext,
match
inherent_impls
.get
()
.find
(
&
def_id
)
{
None
=>
{}
Some
(
&
implementations
)
=>
{
for
implementation
in
implementations
.iter
()
{
let
implementations
=
implementations
.borrow
();
for
implementation
in
implementations
.get
()
.iter
()
{
ebml_w
.start_tag
(
tag_items_data_item_inherent_impl
);
encode_def_id
(
ebml_w
,
implementation
.did
);
ebml_w
.end_tag
();
...
...
src/librustc/middle/dead.rs
浏览文件 @
fecef74d
...
...
@@ -287,7 +287,8 @@ fn symbol_is_live(&mut self, id: ast::NodeId,
match
inherent_impls
.get
()
.find
(
&
def_id
)
{
None
=>
(),
Some
(
ref
impl_list
)
=>
{
for
impl_
in
impl_list
.iter
()
{
let
impl_list
=
impl_list
.borrow
();
for
impl_
in
impl_list
.get
()
.iter
()
{
for
method
in
impl_
.methods
.iter
()
{
if
self
.live_symbols
.contains
(
&
method
.def_id.node
)
{
return
true
;
...
...
src/librustc/middle/ty.rs
浏览文件 @
fecef74d
...
...
@@ -338,7 +338,7 @@ struct ctxt_ {
// Maps a def_id of a type to a list of its inherent impls.
// Contains implementations of methods that are inherent to a type.
// Methods in these implementations don't need to be exported.
inherent_impls
:
RefCell
<
HashMap
<
ast
::
DefId
,
@
mut
~
[
@
Impl
]
>>
,
inherent_impls
:
RefCell
<
HashMap
<
ast
::
DefId
,
@
RefCell
<~
[
@
Impl
]
>
>>
,
// Maps a def_id of an impl to an Impl structure.
// Note that this contains all of the impls that we know about,
...
...
@@ -4561,14 +4561,18 @@ pub fn populate_implementations_for_type_if_necessary(tcx: ctxt,
let
mut
inherent_impls
=
tcx
.inherent_impls
.borrow_mut
();
match
inherent_impls
.get
()
.find
(
&
type_id
)
{
None
=>
{
implementation_list
=
@
mut
~
[]
;
implementation_list
=
@
RefCell
::
new
(
~
[])
;
inherent_impls
.get
()
.insert
(
type_id
,
implementation_list
);
}
Some
(
&
existing_implementation_list
)
=>
{
implementation_list
=
existing_implementation_list
;
}
}
implementation_list
.push
(
implementation
);
{
let
mut
implementation_list
=
implementation_list
.borrow_mut
();
implementation_list
.get
()
.push
(
implementation
);
}
}
// Store the implementation info.
...
...
src/librustc/middle/typeck/check/method.rs
浏览文件 @
fecef74d
...
...
@@ -536,7 +536,8 @@ fn push_inherent_impl_candidates_for_type(&self, did: DefId) {
let
inherent_impls
=
self
.tcx
()
.inherent_impls
.borrow
();
let
opt_impl_infos
=
inherent_impls
.get
()
.find
(
&
did
);
for
impl_infos
in
opt_impl_infos
.iter
()
{
for
impl_info
in
impl_infos
.iter
()
{
let
impl_infos
=
impl_infos
.borrow
();
for
impl_info
in
impl_infos
.get
()
.iter
()
{
let
mut
inherent_candidates
=
self
.inherent_candidates
.borrow_mut
();
self
.push_candidates_from_impl
(
inherent_candidates
.get
(),
...
...
src/librustc/middle/typeck/coherence.rs
浏览文件 @
fecef74d
...
...
@@ -45,6 +45,7 @@
use
syntax
::
opt_vec
;
use
syntax
::
visit
;
use
std
::
cell
::
RefCell
;
use
std
::
hashmap
::
HashSet
;
use
std
::
result
::
Ok
;
use
std
::
vec
;
...
...
@@ -391,7 +392,7 @@ pub fn add_inherent_impl(&self,
let
mut
inherent_impls
=
tcx
.inherent_impls
.borrow_mut
();
match
inherent_impls
.get
()
.find
(
&
base_def_id
)
{
None
=>
{
implementation_list
=
@
mut
~
[]
;
implementation_list
=
@
RefCell
::
new
(
~
[])
;
inherent_impls
.get
()
.insert
(
base_def_id
,
implementation_list
);
}
Some
(
&
existing_implementation_list
)
=>
{
...
...
@@ -399,7 +400,8 @@ pub fn add_inherent_impl(&self,
}
}
implementation_list
.push
(
implementation
);
let
mut
implementation_list
=
implementation_list
.borrow_mut
();
implementation_list
.get
()
.push
(
implementation
);
}
pub
fn
add_trait_impl
(
&
self
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录