Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fb1d6f24
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,发现更多精彩内容 >>
提交
fb1d6f24
编写于
12月 18, 2014
作者:
E
Eduard Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
middle: resolve: fix inconsistencies around ExportMap and remove the 2 suffix.
上级
53382220
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
43 addition
and
43 deletion
+43
-43
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+9
-9
src/librustc/middle/privacy.rs
src/librustc/middle/privacy.rs
+6
-6
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+14
-14
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+1
-1
src/librustc_driver/driver.rs
src/librustc_driver/driver.rs
+3
-3
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/base.rs
+3
-3
src/librustc_trans/trans/context.rs
src/librustc_trans/trans/context.rs
+7
-7
未找到文件。
src/librustc/metadata/encoder.rs
浏览文件 @
fb1d6f24
...
...
@@ -66,7 +66,7 @@ pub enum InlinedItemRef<'a> {
pub
struct
EncodeParams
<
'a
,
'tcx
:
'a
>
{
pub
diag
:
&
'a
SpanHandler
,
pub
tcx
:
&
'a
ty
::
ctxt
<
'tcx
>
,
pub
reexports
2
:
&
'a
middle
::
resolve
::
ExportMap2
,
pub
reexports
:
&
'a
middle
::
resolve
::
ExportMap
,
pub
item_symbols
:
&
'a
RefCell
<
NodeMap
<
String
>>
,
pub
link_meta
:
&
'a
LinkMeta
,
pub
cstore
:
&
'a
cstore
::
CStore
,
...
...
@@ -77,7 +77,7 @@ pub struct EncodeParams<'a, 'tcx: 'a> {
pub
struct
EncodeContext
<
'a
,
'tcx
:
'a
>
{
pub
diag
:
&
'a
SpanHandler
,
pub
tcx
:
&
'a
ty
::
ctxt
<
'tcx
>
,
pub
reexports
2
:
&
'a
middle
::
resolve
::
ExportMap2
,
pub
reexports
:
&
'a
middle
::
resolve
::
ExportMap
,
pub
item_symbols
:
&
'a
RefCell
<
NodeMap
<
String
>>
,
pub
link_meta
:
&
'a
LinkMeta
,
pub
cstore
:
&
'a
cstore
::
CStore
,
...
...
@@ -379,7 +379,7 @@ fn encode_path<PI: Iterator<PathElem>>(rbml_w: &mut Encoder, path: PI) {
}
fn
encode_reexported_static_method
(
rbml_w
:
&
mut
Encoder
,
exp
:
&
middle
::
resolve
::
Export
2
,
exp
:
&
middle
::
resolve
::
Export
,
method_def_id
:
DefId
,
method_name
:
ast
::
Name
)
{
debug!
(
"(encode reexported static method) {}::{}"
,
...
...
@@ -398,7 +398,7 @@ fn encode_reexported_static_method(rbml_w: &mut Encoder,
fn
encode_reexported_static_base_methods
(
ecx
:
&
EncodeContext
,
rbml_w
:
&
mut
Encoder
,
exp
:
&
middle
::
resolve
::
Export
2
)
exp
:
&
middle
::
resolve
::
Export
)
->
bool
{
let
impl_items
=
ecx
.tcx.impl_items
.borrow
();
match
ecx
.tcx.inherent_impls
.borrow
()
.get
(
&
exp
.def_id
)
{
...
...
@@ -428,7 +428,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext,
fn
encode_reexported_static_trait_methods
(
ecx
:
&
EncodeContext
,
rbml_w
:
&
mut
Encoder
,
exp
:
&
middle
::
resolve
::
Export
2
)
exp
:
&
middle
::
resolve
::
Export
)
->
bool
{
match
ecx
.tcx.trait_items_cache
.borrow
()
.get
(
&
exp
.def_id
)
{
Some
(
trait_items
)
=>
{
...
...
@@ -449,7 +449,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext,
fn
encode_reexported_static_methods
(
ecx
:
&
EncodeContext
,
rbml_w
:
&
mut
Encoder
,
mod_path
:
PathElems
,
exp
:
&
middle
::
resolve
::
Export
2
)
{
exp
:
&
middle
::
resolve
::
Export
)
{
if
let
Some
(
ast_map
::
NodeItem
(
item
))
=
ecx
.tcx.map
.find
(
exp
.def_id.node
)
{
let
original_name
=
token
::
get_ident
(
item
.ident
);
...
...
@@ -519,7 +519,7 @@ fn encode_reexports(ecx: &EncodeContext,
id
:
NodeId
,
path
:
PathElems
)
{
debug!
(
"(encoding info for module) encoding reexports for {}"
,
id
);
match
ecx
.reexports
2
.get
(
&
id
)
{
match
ecx
.reexports
.get
(
&
id
)
{
Some
(
ref
exports
)
=>
{
debug!
(
"(encoding info for module) found reexports for {}"
,
id
);
for
exp
in
exports
.iter
()
{
...
...
@@ -2071,7 +2071,7 @@ struct Stats {
item_symbols
,
diag
,
tcx
,
reexports
2
,
reexports
,
cstore
,
encode_inlined_item
,
link_meta
,
...
...
@@ -2081,7 +2081,7 @@ struct Stats {
let
ecx
=
EncodeContext
{
diag
:
diag
,
tcx
:
tcx
,
reexports
2
:
reexports2
,
reexports
:
reexports
,
item_symbols
:
item_symbols
,
link_meta
:
link_meta
,
cstore
:
cstore
,
...
...
src/librustc/middle/privacy.rs
浏览文件 @
fb1d6f24
...
...
@@ -29,7 +29,7 @@
use
syntax
::
parse
::
token
;
use
syntax
::
visit
::{
mod
,
Visitor
};
type
Context
<
'a
,
'tcx
>
=
(
&
'a
MethodMap
<
'tcx
>
,
&
'a
resolve
::
ExportMap
2
);
type
Context
<
'a
,
'tcx
>
=
(
&
'a
MethodMap
<
'tcx
>
,
&
'a
resolve
::
ExportMap
);
/// A set of AST nodes exported by the crate.
pub
type
ExportedItems
=
NodeSet
;
...
...
@@ -136,7 +136,7 @@ fn visit_struct_def(&mut self, s: &ast::StructDef, _: ast::Ident,
struct
EmbargoVisitor
<
'a
,
'tcx
:
'a
>
{
tcx
:
&
'a
ty
::
ctxt
<
'tcx
>
,
exp
_map2
:
&
'a
resolve
::
ExportMap2
,
exp
ort_map
:
&
'a
resolve
::
ExportMap
,
// This flag is an indicator of whether the previous item in the
// hierarchical chain was exported or not. This is the indicator of whether
...
...
@@ -342,8 +342,8 @@ fn visit_mod(&mut self, m: &ast::Mod, _sp: Span, id: ast::NodeId) {
// This code is here instead of in visit_item so that the
// crate module gets processed as well.
if
self
.prev_exported
{
assert
!
(
self
.exp
_map2
.contains_key
(
&
id
),
"wut {}"
,
id
);
for
export
in
self
.exp
_map2
[
id
]
.iter
()
{
assert
!
(
self
.exp
ort_map
.contains_key
(
&
id
),
"wut {}"
,
id
);
for
export
in
self
.exp
ort_map
[
id
]
.iter
()
{
if
is_local
(
export
.def_id
)
{
self
.reexports
.insert
(
export
.def_id.node
);
}
...
...
@@ -1520,7 +1520,7 @@ fn visit_expr(&mut self, _: &ast::Expr) {}
}
pub
fn
check_crate
(
tcx
:
&
ty
::
ctxt
,
exp
_map2
:
&
resolve
::
ExportMap2
,
exp
ort_map
:
&
resolve
::
ExportMap
,
external_exports
:
resolve
::
ExternalExports
,
last_private_map
:
resolve
::
LastPrivateMap
)
->
(
ExportedItems
,
PublicItems
)
{
...
...
@@ -1561,7 +1561,7 @@ pub fn check_crate(tcx: &ty::ctxt,
exported_items
:
NodeSet
::
new
(),
public_items
:
NodeSet
::
new
(),
reexports
:
NodeSet
::
new
(),
exp
_map2
:
exp_map2
,
exp
ort_map
:
export_map
,
prev_exported
:
true
,
prev_public
:
true
,
};
...
...
src/librustc/middle/resolve.rs
浏览文件 @
fb1d6f24
...
...
@@ -97,13 +97,13 @@ struct BindingInfo {
type
BindingMap
=
HashMap
<
Name
,
BindingInfo
>
;
// Trait method resolution
pub
type
TraitMap
=
NodeMap
<
Vec
<
DefId
>
>
;
pub
type
TraitMap
=
NodeMap
<
Vec
<
DefId
>>
;
// This is the replacement export map. It maps a module to all of the exports
// within.
pub
type
ExportMap
2
=
NodeMap
<
Vec
<
Export2
>>
;
pub
type
ExportMap
=
NodeMap
<
Vec
<
Export
>>
;
pub
struct
Export
2
{
pub
struct
Export
{
pub
name
:
String
,
// The name of the target.
pub
def_id
:
DefId
,
// The definition of the target.
}
...
...
@@ -946,7 +946,7 @@ struct Resolver<'a> {
freevars
:
RefCell
<
FreevarMap
>
,
freevars_seen
:
RefCell
<
NodeMap
<
NodeSet
>>
,
capture_mode_map
:
CaptureModeMap
,
export_map
2
:
ExportMap2
,
export_map
:
ExportMap
,
trait_map
:
TraitMap
,
external_exports
:
ExternalExports
,
last_private
:
LastPrivateMap
,
...
...
@@ -1061,7 +1061,7 @@ fn new(session: &'a Session, crate_span: Span) -> Resolver<'a> {
freevars
:
RefCell
::
new
(
NodeMap
::
new
()),
freevars_seen
:
RefCell
::
new
(
NodeMap
::
new
()),
capture_mode_map
:
NodeMap
::
new
(),
export_map
2
:
NodeMap
::
new
(),
export_map
:
NodeMap
::
new
(),
trait_map
:
NodeMap
::
new
(),
used_imports
:
HashSet
::
new
(),
used_crates
:
HashSet
::
new
(),
...
...
@@ -3859,12 +3859,12 @@ fn record_exports_for_module_subtree(&mut self,
}
fn
record_exports_for_module
(
&
mut
self
,
module_
:
&
Module
)
{
let
mut
exports
2
=
Vec
::
new
();
let
mut
exports
=
Vec
::
new
();
self
.add_exports_for_module
(
&
mut
exports
2
,
module_
);
self
.add_exports_for_module
(
&
mut
exports
,
module_
);
match
module_
.def_id
.get
()
{
Some
(
def_id
)
=>
{
self
.export_map
2
.insert
(
def_id
.node
,
exports2
);
self
.export_map
.insert
(
def_id
.node
,
exports
);
debug!
(
"(computing exports) writing exports for {} (some)"
,
def_id
.node
);
}
...
...
@@ -3873,7 +3873,7 @@ fn record_exports_for_module(&mut self, module_: &Module) {
}
fn
add_exports_of_namebindings
(
&
mut
self
,
exports
2
:
&
mut
Vec
<
Export2
>
,
exports
:
&
mut
Vec
<
Export
>
,
name
:
Name
,
namebindings
:
&
NameBindings
,
ns
:
Namespace
)
{
...
...
@@ -3882,7 +3882,7 @@ fn add_exports_of_namebindings(&mut self,
let
name
=
token
::
get_name
(
name
);
debug!
(
"(computing exports) YES: export '{}' => {}"
,
name
,
d
.def_id
());
exports
2
.push
(
Export2
{
exports
.push
(
Export
{
name
:
name
.get
()
.to_string
(),
def_id
:
d
.def_id
()
});
...
...
@@ -3894,7 +3894,7 @@ fn add_exports_of_namebindings(&mut self,
}
fn
add_exports_for_module
(
&
mut
self
,
exports
2
:
&
mut
Vec
<
Export2
>
,
exports
:
&
mut
Vec
<
Export
>
,
module_
:
&
Module
)
{
for
(
name
,
importresolution
)
in
module_
.import_resolutions
.borrow
()
.iter
()
{
if
!
importresolution
.is_public
{
...
...
@@ -3906,7 +3906,7 @@ fn add_exports_for_module(&mut self,
Some
(
target
)
=>
{
debug!
(
"(computing exports) maybe export '{}'"
,
token
::
get_name
(
*
name
));
self
.add_exports_of_namebindings
(
exports
2
,
self
.add_exports_of_namebindings
(
exports
,
*
name
,
&*
target
.bindings
,
ns
)
...
...
@@ -6322,7 +6322,7 @@ pub struct CrateMap {
pub
def_map
:
DefMap
,
pub
freevars
:
RefCell
<
FreevarMap
>
,
pub
capture_mode_map
:
RefCell
<
CaptureModeMap
>
,
pub
exp
_map2
:
ExportMap2
,
pub
exp
ort_map
:
ExportMap
,
pub
trait_map
:
TraitMap
,
pub
external_exports
:
ExternalExports
,
pub
last_private_map
:
LastPrivateMap
,
...
...
@@ -6339,7 +6339,7 @@ pub fn resolve_crate(session: &Session,
def_map
:
resolver
.def_map
,
freevars
:
resolver
.freevars
,
capture_mode_map
:
RefCell
::
new
(
resolver
.capture_mode_map
),
exp
_map2
:
resolver
.export_map2
,
exp
ort_map
:
resolver
.export_map
,
trait_map
:
resolver
.trait_map
,
external_exports
:
resolver
.external_exports
,
last_private_map
:
resolver
.last_private
,
...
...
src/librustc/middle/ty.rs
浏览文件 @
fb1d6f24
...
...
@@ -99,7 +99,7 @@
/// The complete set of all analyses described in this module. This is
/// produced by the driver and fed to trans and later passes.
pub
struct
CrateAnalysis
<
'tcx
>
{
pub
exp
_map2
:
middle
::
resolve
::
ExportMap2
,
pub
exp
ort_map
:
middle
::
resolve
::
ExportMap
,
pub
exported_items
:
middle
::
privacy
::
ExportedItems
,
pub
public_items
:
middle
::
privacy
::
PublicItems
,
pub
ty_cx
:
ty
::
ctxt
<
'tcx
>
,
...
...
src/librustc_driver/driver.rs
浏览文件 @
fb1d6f24
...
...
@@ -345,7 +345,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
def_map
,
freevars
,
capture_mode_map
,
exp
_map2
,
exp
ort_map
,
trait_map
,
external_exports
,
last_private_map
...
...
@@ -406,7 +406,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
let
maps
=
(
external_exports
,
last_private_map
);
let
(
exported_items
,
public_items
)
=
time
(
time_passes
,
"privacy checking"
,
maps
,
|(
a
,
b
)|
middle
::
privacy
::
check_crate
(
&
ty_cx
,
&
exp
_map2
,
a
,
b
));
middle
::
privacy
::
check_crate
(
&
ty_cx
,
&
exp
ort_map
,
a
,
b
));
time
(
time_passes
,
"intrinsic checking"
,
(),
|
_
|
middle
::
intrinsicck
::
check_crate
(
&
ty_cx
));
...
...
@@ -447,7 +447,7 @@ pub fn phase_3_run_analysis_passes<'tcx>(sess: Session,
lint
::
check_crate
(
&
ty_cx
,
&
exported_items
));
ty
::
CrateAnalysis
{
exp
_map2
:
exp_map2
,
exp
ort_map
:
export_map
,
ty_cx
:
ty_cx
,
exported_items
:
exported_items
,
public_items
:
public_items
,
...
...
src/librustc_trans/trans/base.rs
浏览文件 @
fb1d6f24
...
...
@@ -2938,7 +2938,7 @@ pub fn crate_ctxt_to_encode_parms<'a, 'tcx>(cx: &'a SharedCrateContext<'tcx>,
encoder
::
EncodeParams
{
diag
:
cx
.sess
()
.diagnostic
(),
tcx
:
cx
.tcx
(),
reexports
2
:
cx
.exp_map2
(),
reexports
:
cx
.export_map
(),
item_symbols
:
cx
.item_symbols
(),
link_meta
:
cx
.link_meta
(),
cstore
:
&
cx
.sess
()
.cstore
,
...
...
@@ -3071,7 +3071,7 @@ fn next(&mut self) -> Option<ValueRef> {
pub
fn
trans_crate
<
'tcx
>
(
analysis
:
ty
::
CrateAnalysis
<
'tcx
>
)
->
(
ty
::
ctxt
<
'tcx
>
,
CrateTranslation
)
{
let
ty
::
CrateAnalysis
{
ty_cx
:
tcx
,
exp
_map2
,
reachable
,
name
,
..
}
=
analysis
;
let
ty
::
CrateAnalysis
{
ty_cx
:
tcx
,
exp
ort_map
,
reachable
,
name
,
..
}
=
analysis
;
let
krate
=
tcx
.map
.krate
();
// Before we touch LLVM, make sure that multithreading is enabled.
...
...
@@ -3098,7 +3098,7 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
let
shared_ccx
=
SharedCrateContext
::
new
(
link_meta
.crate_name
.as_slice
(),
codegen_units
,
tcx
,
exp
_map2
,
exp
ort_map
,
Sha256
::
new
(),
link_meta
.clone
(),
reachable
);
...
...
src/librustc_trans/trans/context.rs
浏览文件 @
fb1d6f24
...
...
@@ -61,7 +61,7 @@ pub struct SharedCrateContext<'tcx> {
metadata_llmod
:
ModuleRef
,
metadata_llcx
:
ContextRef
,
exp
_map2
:
resolve
::
ExportMap2
,
exp
ort_map
:
resolve
::
ExportMap
,
reachable
:
NodeSet
,
item_symbols
:
RefCell
<
NodeMap
<
String
>>
,
link_meta
:
LinkMeta
,
...
...
@@ -238,7 +238,7 @@ impl<'tcx> SharedCrateContext<'tcx> {
pub
fn
new
(
crate_name
:
&
str
,
local_count
:
uint
,
tcx
:
ty
::
ctxt
<
'tcx
>
,
e
map2
:
resolve
::
ExportMap2
,
e
xport_map
:
resolve
::
ExportMap
,
symbol_hasher
:
Sha256
,
link_meta
:
LinkMeta
,
reachable
:
NodeSet
)
...
...
@@ -251,7 +251,7 @@ pub fn new(crate_name: &str,
local_ccxs
:
Vec
::
with_capacity
(
local_count
),
metadata_llmod
:
metadata_llmod
,
metadata_llcx
:
metadata_llcx
,
exp
_map2
:
emap2
,
exp
ort_map
:
export_map
,
reachable
:
reachable
,
item_symbols
:
RefCell
::
new
(
NodeMap
::
new
()),
link_meta
:
link_meta
,
...
...
@@ -329,8 +329,8 @@ pub fn metadata_llcx(&self) -> ContextRef {
self
.metadata_llcx
}
pub
fn
exp
_map2
<
'a
>
(
&
'a
self
)
->
&
'a
resolve
::
ExportMap2
{
&
self
.exp
_map2
pub
fn
exp
ort_map
<
'a
>
(
&
'a
self
)
->
&
'a
resolve
::
ExportMap
{
&
self
.exp
ort_map
}
pub
fn
reachable
<
'a
>
(
&
'a
self
)
->
&
'a
NodeSet
{
...
...
@@ -553,8 +553,8 @@ pub fn item_vals<'a>(&'a self) -> &'a RefCell<NodeMap<ValueRef>> {
&
self
.local.item_vals
}
pub
fn
exp
_map2
<
'a
>
(
&
'a
self
)
->
&
'a
resolve
::
ExportMap2
{
&
self
.shared.exp
_map2
pub
fn
exp
ort_map
<
'a
>
(
&
'a
self
)
->
&
'a
resolve
::
ExportMap
{
&
self
.shared.exp
ort_map
}
pub
fn
reachable
<
'a
>
(
&
'a
self
)
->
&
'a
NodeSet
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录