Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6b94bc34
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,发现更多精彩内容 >>
提交
6b94bc34
编写于
2月 15, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add an arena for import directives
上级
064f17c6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
9 deletion
+18
-9
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+4
-3
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+9
-1
src/librustc_resolve/resolve_imports.rs
src/librustc_resolve/resolve_imports.rs
+5
-5
未找到文件。
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
6b94bc34
...
...
@@ -707,9 +707,10 @@ fn build_import_directive(&mut self,
}
}
module_
.unresolved_imports
.borrow_mut
()
.push
(
ImportDirective
::
new
(
module_path
,
subclass
,
span
,
id
,
is_public
,
shadowable
));
let
directive
=
ImportDirective
::
new
(
module_path
,
subclass
,
span
,
id
,
is_public
,
shadowable
);
let
directive
=
self
.resolver.arenas
.alloc_import_directive
(
directive
);
module_
.unresolved_imports
.borrow_mut
()
.push
(
directive
);
self
.unresolved_imports
+=
1
;
}
}
...
...
src/librustc_resolve/lib.rs
浏览文件 @
6b94bc34
...
...
@@ -812,7 +812,7 @@ pub struct ModuleS<'a> {
extern_crate_id
:
Option
<
NodeId
>
,
resolutions
:
RefCell
<
HashMap
<
(
Name
,
Namespace
),
NameResolution
<
'a
>>>
,
unresolved_imports
:
RefCell
<
Vec
<
ImportDirective
>>
,
unresolved_imports
:
RefCell
<
Vec
<
&
'a
ImportDirective
>>
,
// The module children of this node, including normal modules and anonymous modules.
// Anonymous children are pseudo-modules that are implicitly created around items
...
...
@@ -1167,6 +1167,13 @@ pub struct Resolver<'a, 'tcx: 'a> {
pub
struct
ResolverArenas
<
'a
>
{
modules
:
arena
::
TypedArena
<
ModuleS
<
'a
>>
,
name_bindings
:
arena
::
TypedArena
<
NameBinding
<
'a
>>
,
import_directives
:
arena
::
TypedArena
<
ImportDirective
>
,
}
impl
<
'a
>
ResolverArenas
<
'a
>
{
fn
alloc_import_directive
(
&
'a
self
,
import_directive
:
ImportDirective
)
->
&
'a
ImportDirective
{
self
.import_directives
.alloc
(
import_directive
)
}
}
#[derive(PartialEq)]
...
...
@@ -1234,6 +1241,7 @@ fn arenas() -> ResolverArenas<'a> {
ResolverArenas
{
modules
:
arena
::
TypedArena
::
new
(),
name_bindings
:
arena
::
TypedArena
::
new
(),
import_directives
:
arena
::
TypedArena
::
new
(),
}
}
...
...
src/librustc_resolve/resolve_imports.rs
浏览文件 @
6b94bc34
...
...
@@ -172,7 +172,7 @@ pub fn try_define(&mut self, binding: &'a NameBinding<'a>) -> Result<(), &'a Nam
struct
ImportResolvingError
<
'a
>
{
/// Module where the error happened
source_module
:
Module
<
'a
>
,
import_directive
:
ImportDirective
,
import_directive
:
&
'a
ImportDirective
,
span
:
Span
,
help
:
String
,
}
...
...
@@ -249,7 +249,7 @@ fn import_resolving_error(&self, e: ImportResolvingError<'b>) {
}
let
path
=
import_path_to_string
(
&
e
.import_directive.module_path
,
e
.import_directive.subclass
);
&
e
.import_directive.subclass
);
resolve_error
(
self
.resolver
,
e
.span
,
...
...
@@ -608,7 +608,7 @@ fn report_conflict(&mut self,
}
}
fn
import_path_to_string
(
names
:
&
[
Name
],
subclass
:
ImportDirectiveSubclass
)
->
String
{
fn
import_path_to_string
(
names
:
&
[
Name
],
subclass
:
&
ImportDirectiveSubclass
)
->
String
{
if
names
.is_empty
()
{
import_directive_subclass_to_string
(
subclass
)
}
else
{
...
...
@@ -619,8 +619,8 @@ fn import_path_to_string(names: &[Name], subclass: ImportDirectiveSubclass) -> S
}
}
fn
import_directive_subclass_to_string
(
subclass
:
ImportDirectiveSubclass
)
->
String
{
match
subclass
{
fn
import_directive_subclass_to_string
(
subclass
:
&
ImportDirectiveSubclass
)
->
String
{
match
*
subclass
{
SingleImport
{
source
,
..
}
=>
source
.to_string
(),
GlobImport
=>
"*"
.to_string
(),
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录