Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f5ab4d4c
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,发现更多精彩内容 >>
提交
f5ab4d4c
编写于
3月 05, 2018
作者:
M
Michael Woerister
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't show crate metadata symbol as exported symbol to downstream crates.
上级
9f6d5546
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
13 deletion
+29
-13
src/librustc/middle/exported_symbols.rs
src/librustc/middle/exported_symbols.rs
+7
-1
src/librustc_metadata/encoder.rs
src/librustc_metadata/encoder.rs
+19
-3
src/librustc_trans/back/symbol_export.rs
src/librustc_trans/back/symbol_export.rs
+1
-7
src/librustc_trans/base.rs
src/librustc_trans/base.rs
+2
-2
未找到文件。
src/librustc/middle/exported_symbols.rs
浏览文件 @
f5ab4d4c
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
hir
::
def_id
::
DefId
;
use
hir
::
def_id
::
{
DefId
,
LOCAL_CRATE
}
;
use
std
::
cmp
;
use
ty
;
...
...
@@ -87,3 +87,9 @@ pub fn compare_stable(&self, tcx: ty::TyCtxt, other: &ExportedSymbol) -> cmp::Or
NonGeneric
(
def_id
),
NoDefId
(
symbol_name
)
});
pub
fn
metadata_symbol_name
(
tcx
:
ty
::
TyCtxt
)
->
String
{
format!
(
"rust_metadata_{}_{}"
,
tcx
.original_crate_name
(
LOCAL_CRATE
),
tcx
.crate_disambiguator
(
LOCAL_CRATE
)
.to_fingerprint
()
.to_hex
())
}
src/librustc_metadata/encoder.rs
浏览文件 @
f5ab4d4c
...
...
@@ -20,11 +20,12 @@
use
rustc
::
hir
::
map
::
definitions
::
DefPathTable
;
use
rustc
::
ich
::
Fingerprint
;
use
rustc
::
middle
::
dependency_format
::
Linkage
;
use
rustc
::
middle
::
exported_symbols
::{
ExportedSymbol
,
SymbolExportLevel
};
use
rustc
::
middle
::
exported_symbols
::{
ExportedSymbol
,
SymbolExportLevel
,
metadata_symbol_name
};
use
rustc
::
middle
::
lang_items
;
use
rustc
::
mir
;
use
rustc
::
traits
::
specialization_graph
;
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
,
ReprOptions
};
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
,
ReprOptions
,
SymbolName
};
use
rustc
::
ty
::
codec
::{
self
as
ty_codec
,
TyEncoder
};
use
rustc
::
session
::
config
::{
self
,
CrateTypeProcMacro
};
...
...
@@ -1392,7 +1393,22 @@ fn encode_impls(&mut self, _: ()) -> LazySeq<TraitImpls> {
fn
encode_exported_symbols
(
&
mut
self
,
exported_symbols
:
&
[(
ExportedSymbol
,
SymbolExportLevel
)])
->
LazySeq
<
(
ExportedSymbol
,
SymbolExportLevel
)
>
{
self
.lazy_seq
(
exported_symbols
.iter
()
.cloned
())
// The metadata symbol name is special. It should not show up in
// downstream crates.
let
metadata_symbol_name
=
SymbolName
::
new
(
&
metadata_symbol_name
(
self
.tcx
));
self
.lazy_seq
(
exported_symbols
.iter
()
.filter
(|
&&
(
ref
exported_symbol
,
_
)|
{
match
*
exported_symbol
{
ExportedSymbol
::
NoDefId
(
symbol_name
)
=>
{
symbol_name
!=
metadata_symbol_name
},
_
=>
true
,
}
})
.cloned
())
}
fn
encode_dylib_dependency_formats
(
&
mut
self
,
_
:
())
->
LazySeq
<
Option
<
LinkagePreference
>>
{
...
...
src/librustc_trans/back/symbol_export.rs
浏览文件 @
f5ab4d4c
...
...
@@ -15,7 +15,7 @@
use
rustc
::
hir
;
use
rustc
::
hir
::
def_id
::
CrateNum
;
use
rustc
::
hir
::
def_id
::{
DefId
,
LOCAL_CRATE
};
use
rustc
::
middle
::
exported_symbols
::{
SymbolExportLevel
,
ExportedSymbol
};
use
rustc
::
middle
::
exported_symbols
::{
SymbolExportLevel
,
ExportedSymbol
,
metadata_symbol_name
};
use
rustc
::
session
::
config
;
use
rustc
::
ty
::{
TyCtxt
,
SymbolName
};
use
rustc
::
ty
::
maps
::
Providers
;
...
...
@@ -32,12 +32,6 @@ pub fn threshold(tcx: TyCtxt) -> SymbolExportLevel {
crates_export_threshold
(
&
tcx
.sess.crate_types
.borrow
())
}
pub
fn
metadata_symbol_name
(
tcx
:
TyCtxt
)
->
String
{
format!
(
"rust_metadata_{}_{}"
,
tcx
.crate_name
(
LOCAL_CRATE
),
tcx
.crate_disambiguator
(
LOCAL_CRATE
)
.to_fingerprint
()
.to_hex
())
}
fn
crate_export_threshold
(
crate_type
:
config
::
CrateType
)
->
SymbolExportLevel
{
match
crate_type
{
config
::
CrateTypeExecutable
|
...
...
src/librustc_trans/base.rs
浏览文件 @
f5ab4d4c
...
...
@@ -30,7 +30,6 @@
use
abi
;
use
back
::
link
;
use
back
::
symbol_export
;
use
back
::
write
::{
self
,
OngoingCrateTranslation
,
create_target_machine
};
use
llvm
::{
ContextRef
,
ModuleRef
,
ValueRef
,
Vector
,
get_param
};
use
llvm
;
...
...
@@ -45,6 +44,7 @@
use
rustc
::
dep_graph
::{
DepNode
,
DepConstructor
};
use
rustc
::
ty
::
subst
::
Kind
;
use
rustc
::
middle
::
cstore
::{
self
,
LinkMeta
,
LinkagePreference
};
use
rustc
::
middle
::
exported_symbols
;
use
rustc
::
util
::
common
::{
time
,
print_time_passes_entry
};
use
rustc
::
session
::
config
::{
self
,
NoDebugInfo
};
use
rustc
::
session
::
Session
;
...
...
@@ -654,7 +654,7 @@ enum MetadataKind {
let
llmeta
=
C_bytes_in_context
(
metadata_llcx
,
&
compressed
);
let
llconst
=
C_struct_in_context
(
metadata_llcx
,
&
[
llmeta
],
false
);
let
name
=
symbol_export
::
metadata_symbol_name
(
tcx
);
let
name
=
exported_symbols
::
metadata_symbol_name
(
tcx
);
let
buf
=
CString
::
new
(
name
)
.unwrap
();
let
llglobal
=
unsafe
{
llvm
::
LLVMAddGlobal
(
metadata_llmod
,
val_ty
(
llconst
)
.to_ref
(),
buf
.as_ptr
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录