Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fb2129e0
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,发现更多精彩内容 >>
提交
fb2129e0
编写于
11月 03, 2015
作者:
J
Jonathan S
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove the RefCell around freevars and freevars_seen in librustc_resolve
上级
c340ea1d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
13 deletion
+12
-13
src/librustc/middle/ty/context.rs
src/librustc/middle/ty/context.rs
+2
-2
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+10
-11
未找到文件。
src/librustc/middle/ty/context.rs
浏览文件 @
fb2129e0
...
...
@@ -448,7 +448,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
def_map
:
DefMap
,
named_region_map
:
resolve_lifetime
::
NamedRegionMap
,
map
:
ast_map
::
Map
<
'tcx
>
,
freevars
:
RefCell
<
FreevarMap
>
,
freevars
:
FreevarMap
,
region_maps
:
RegionMaps
,
lang_items
:
middle
::
lang_items
::
LanguageItems
,
stability
:
stability
::
Index
<
'tcx
>
,
...
...
@@ -481,7 +481,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
super_predicates
:
RefCell
::
new
(
DefIdMap
()),
fulfilled_predicates
:
RefCell
::
new
(
traits
::
FulfilledPredicates
::
new
()),
map
:
map
,
freevars
:
freevars
,
freevars
:
RefCell
::
new
(
freevars
)
,
tcache
:
RefCell
::
new
(
DefIdMap
()),
rcache
:
RefCell
::
new
(
FnvHashMap
()),
tc_cache
:
RefCell
::
new
(
FnvHashMap
()),
...
...
src/librustc_resolve/lib.rs
浏览文件 @
fb2129e0
...
...
@@ -1151,8 +1151,8 @@ pub struct Resolver<'a, 'tcx:'a> {
primitive_type_table
:
PrimitiveTypeTable
,
def_map
:
DefMap
,
freevars
:
RefCell
<
FreevarMap
>
,
freevars_seen
:
RefCell
<
NodeMap
<
NodeMap
<
usize
>
>>
,
freevars
:
FreevarMap
,
freevars_seen
:
NodeMap
<
NodeMap
<
usize
>>
,
export_map
:
ExportMap
,
trait_map
:
TraitMap
,
external_exports
:
ExternalExports
,
...
...
@@ -1227,8 +1227,8 @@ fn new(session: &'a Session,
primitive_type_table
:
PrimitiveTypeTable
::
new
(),
def_map
:
RefCell
::
new
(
NodeMap
()),
freevars
:
RefCell
::
new
(
NodeMap
()
),
freevars_seen
:
RefCell
::
new
(
NodeMap
()
),
freevars
:
NodeMap
(
),
freevars_seen
:
NodeMap
(
),
export_map
:
NodeMap
(),
trait_map
:
NodeMap
(),
used_imports
:
HashSet
::
new
(),
...
...
@@ -3081,7 +3081,7 @@ fn resolve_identifier(&mut self,
}
// Resolve a local definition, potentially adjusting for closures.
fn
adjust_local_def
(
&
self
,
local_def
:
LocalDef
,
span
:
Span
)
->
Option
<
Def
>
{
fn
adjust_local_def
(
&
mut
self
,
local_def
:
LocalDef
,
span
:
Span
)
->
Option
<
Def
>
{
let
ribs
=
match
local_def
.ribs
{
Some
((
TypeNS
,
i
))
=>
&
self
.type_ribs
[
i
+
1
..
],
Some
((
ValueNS
,
i
))
=>
&
self
.value_ribs
[
i
+
1
..
],
...
...
@@ -3103,15 +3103,14 @@ fn adjust_local_def(&self, local_def: LocalDef, span: Span) -> Option<Def> {
let
prev_def
=
def
;
let
node_def_id
=
self
.ast_map
.local_def_id
(
node_id
);
let
mut
seen
=
self
.freevars_seen
.borrow_mut
();
let
seen
=
seen
.entry
(
function_id
)
.or_insert_with
(||
NodeMap
());
let
seen
=
self
.freevars_seen
.entry
(
function_id
)
.or_insert_with
(||
NodeMap
());
if
let
Some
(
&
index
)
=
seen
.get
(
&
node_id
)
{
def
=
DefUpvar
(
node_def_id
,
node_id
,
index
,
function_id
);
continue
;
}
let
mut
freevars
=
self
.freevars
.borrow_mut
();
let
vec
=
freevars
.entry
(
function_id
)
.or_insert_with
(||
vec!
[]);
let
vec
=
self
.freevars
.entry
(
function_id
)
.or_insert_with
(||
vec!
[]);
let
depth
=
vec
.len
();
vec
.push
(
Freevar
{
def
:
prev_def
,
span
:
span
});
...
...
@@ -4028,7 +4027,7 @@ fn collect_mod(names: &mut Vec<ast::Name>, module: &Module) {
pub
struct
CrateMap
{
pub
def_map
:
DefMap
,
pub
freevars
:
RefCell
<
FreevarMap
>
,
pub
freevars
:
FreevarMap
,
pub
export_map
:
ExportMap
,
pub
trait_map
:
TraitMap
,
pub
external_exports
:
ExternalExports
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录