Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1b8391ca
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,发现更多精彩内容 >>
提交
1b8391ca
编写于
12月 21, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: De-`@mut` `MoveData::moves`
上级
1ded4235
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
16 deletion
+30
-16
src/librustc/middle/borrowck/move_data.rs
src/librustc/middle/borrowck/move_data.rs
+30
-16
未找到文件。
src/librustc/middle/borrowck/move_data.rs
浏览文件 @
1b8391ca
...
...
@@ -38,7 +38,7 @@ pub struct MoveData {
path_map
:
HashMap
<@
LoanPath
,
MovePathIndex
>
,
/// Each move or uninitialized variable gets an entry here.
moves
:
~
[
Move
]
,
moves
:
RefCell
<~
[
Move
]
>
,
/// Assignments to a variable, like `x = foo`. These are assigned
/// bits for dataflow, since we must track them to ensure that
...
...
@@ -167,7 +167,7 @@ pub fn new() -> MoveData {
MoveData
{
paths
:
RefCell
::
new
(
~
[]),
path_map
:
HashMap
::
new
(),
moves
:
~
[]
,
moves
:
RefCell
::
new
(
~
[])
,
path_assignments
:
~
[],
var_assignments
:
~
[],
assignee_ids
:
HashSet
::
new
(),
...
...
@@ -216,7 +216,8 @@ fn set_path_first_child(&mut self,
fn
move_next_move
(
&
self
,
index
:
MoveIndex
)
->
MoveIndex
{
//! Type safe indexing operator
self
.moves
[
*
index
]
.next_move
let
moves
=
self
.moves
.borrow
();
moves
.get
()[
*
index
]
.next_move
}
fn
is_var_path
(
&
self
,
index
:
MovePathIndex
)
->
bool
{
...
...
@@ -349,17 +350,23 @@ pub fn add_move(&mut self,
kind
);
let
path_index
=
self
.move_path
(
tcx
,
lp
);
let
move_index
=
MoveIndex
(
self
.moves
.len
());
let
move_index
=
{
let
moves
=
self
.moves
.borrow
();
MoveIndex
(
moves
.get
()
.len
())
};
let
next_move
=
self
.path_first_move
(
path_index
);
self
.set_path_first_move
(
path_index
,
move_index
);
self
.moves
.push
(
Move
{
path
:
path_index
,
id
:
id
,
kind
:
kind
,
next_move
:
next_move
});
{
let
mut
moves
=
self
.moves
.borrow_mut
();
moves
.get
()
.push
(
Move
{
path
:
path_index
,
id
:
id
,
kind
:
kind
,
next_move
:
next_move
});
}
}
pub
fn
add_assignment
(
&
mut
self
,
...
...
@@ -411,8 +418,11 @@ fn add_gen_kills(&self,
* killed by scoping. See `doc.rs` for more details.
*/
for
(
i
,
move
)
in
self
.moves
.iter
()
.enumerate
()
{
dfcx_moves
.add_gen
(
move
.id
,
i
);
{
let
moves
=
self
.moves
.borrow
();
for
(
i
,
move
)
in
moves
.get
()
.iter
()
.enumerate
()
{
dfcx_moves
.add_gen
(
move
.id
,
i
);
}
}
for
(
i
,
assignment
)
in
self
.var_assignments
.iter
()
.enumerate
()
{
...
...
@@ -523,12 +533,14 @@ pub fn new(move_data: @mut MoveData,
body
:
&
ast
::
Block
)
->
FlowedMoveData
{
let
mut
dfcx_moves
=
let
mut
dfcx_moves
=
{
let
moves
=
move_data
.moves
.borrow
();
DataFlowContext
::
new
(
tcx
,
method_map
,
MoveDataFlowOperator
,
id_range
,
move_data
.moves
.len
());
moves
.get
()
.len
())
};
let
mut
dfcx_assign
=
DataFlowContext
::
new
(
tcx
,
method_map
,
...
...
@@ -554,7 +566,8 @@ pub fn each_path_moved_by(&self,
*/
self
.dfcx_moves
.each_gen_bit_frozen
(
id
,
|
index
|
{
let
move
=
&
self
.move_data.moves
[
index
];
let
moves
=
self
.move_data.moves
.borrow
();
let
move
=
&
moves
.get
()[
index
];
let
moved_path
=
move
.path
;
f
(
move
,
self
.move_data
.path_loan_path
(
moved_path
))
})
...
...
@@ -592,7 +605,8 @@ pub fn each_move_of(&self,
let
mut
ret
=
true
;
self
.dfcx_moves
.each_bit_on_entry_frozen
(
id
,
|
index
|
{
let
move
=
&
self
.move_data.moves
[
index
];
let
moves
=
self
.move_data.moves
.borrow
();
let
move
=
&
moves
.get
()[
index
];
let
moved_path
=
move
.path
;
if
base_indices
.iter
()
.any
(|
x
|
x
==
&
moved_path
)
{
// Scenario 1 or 2: `loan_path` or some base path of
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录