Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5d4a25da
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,发现更多精彩内容 >>
未验证
提交
5d4a25da
编写于
8月 21, 2018
作者:
K
kennytm
浏览文件
操作
浏览文件
下载
差异文件
Rollup merge of #53465 - bjorn3:remove_link_meta_struct, r=varkor
Remove LinkMeta struct Fixes #53291
上级
c980ba75
d52047fa
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
25 addition
and
53 deletion
+25
-53
src/librustc/middle/cstore.rs
src/librustc/middle/cstore.rs
+1
-7
src/librustc/ty/context.rs
src/librustc/ty/context.rs
+3
-3
src/librustc_codegen_llvm/back/link.rs
src/librustc_codegen_llvm/back/link.rs
+1
-2
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/back/write.rs
+6
-5
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+4
-10
src/librustc_codegen_llvm/lib.rs
src/librustc_codegen_llvm/lib.rs
+3
-2
src/librustc_codegen_utils/codegen_backend.rs
src/librustc_codegen_utils/codegen_backend.rs
+2
-3
src/librustc_codegen_utils/link.rs
src/librustc_codegen_utils/link.rs
+0
-10
src/librustc_metadata/cstore_impl.rs
src/librustc_metadata/cstore_impl.rs
+2
-4
src/librustc_metadata/encoder.rs
src/librustc_metadata/encoder.rs
+3
-7
未找到文件。
src/librustc/middle/cstore.rs
浏览文件 @
5d4a25da
...
...
@@ -42,11 +42,6 @@
// lonely orphan structs and enums looking for a better home
#[derive(Clone,
Debug,
Copy)]
pub
struct
LinkMeta
{
pub
crate_hash
:
Svh
,
}
/// Where a crate came from on the local filesystem. One of these three options
/// must be non-None.
#[derive(PartialEq,
Clone,
Debug)]
...
...
@@ -233,8 +228,7 @@ pub trait CrateStore {
// utility functions
fn
encode_metadata
<
'a
,
'tcx
>
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
link_meta
:
&
LinkMeta
)
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
->
EncodedMetadata
;
fn
metadata_encoding_version
(
&
self
)
->
&
[
u8
];
}
...
...
src/librustc/ty/context.rs
浏览文件 @
5d4a25da
...
...
@@ -26,7 +26,7 @@
use
ich
::{
StableHashingContext
,
NodeIdHashingMode
};
use
infer
::
canonical
::{
CanonicalVarInfo
,
CanonicalVarInfos
};
use
infer
::
outlives
::
free_region_map
::
FreeRegionMap
;
use
middle
::
cstore
::
{
CrateStoreDyn
,
LinkMeta
}
;
use
middle
::
cstore
::
CrateStoreDyn
;
use
middle
::
cstore
::
EncodedMetadata
;
use
middle
::
lang_items
;
use
middle
::
resolve_lifetime
::{
self
,
ObjectLifetimeDefault
};
...
...
@@ -1490,10 +1490,10 @@ pub fn local_crate_exports_generics(self) -> bool {
}
impl
<
'a
,
'tcx
>
TyCtxt
<
'a
,
'tcx
,
'tcx
>
{
pub
fn
encode_metadata
(
self
,
link_meta
:
&
LinkMeta
)
pub
fn
encode_metadata
(
self
)
->
EncodedMetadata
{
self
.cstore
.encode_metadata
(
self
,
link_meta
)
self
.cstore
.encode_metadata
(
self
)
}
}
...
...
src/librustc_codegen_llvm/back/link.rs
浏览文件 @
5d4a25da
...
...
@@ -47,8 +47,7 @@
use
syntax
::
attr
;
pub
use
rustc_codegen_utils
::
link
::{
find_crate_name
,
filename_for_input
,
default_output_for_target
,
invalid_output_for_target
,
build_link_meta
,
out_filename
,
check_file_is_writeable
};
invalid_output_for_target
,
out_filename
,
check_file_is_writeable
};
// The third parameter is for env vars, used on windows to set up the
// path for MSVC to find its DLLs, and gcc to find its bundled
...
...
src/librustc_codegen_llvm/back/write.rs
浏览文件 @
5d4a25da
...
...
@@ -19,7 +19,7 @@
use
consts
;
use
rustc_incremental
::{
copy_cgu_workproducts_to_incr_comp_cache_dir
,
in_incr_comp_dir
};
use
rustc
::
dep_graph
::{
WorkProduct
,
WorkProductId
,
WorkProductFileKind
};
use
rustc
::
middle
::
cstore
::
{
LinkMeta
,
EncodedMetadata
}
;
use
rustc
::
middle
::
cstore
::
EncodedMetadata
;
use
rustc
::
session
::
config
::{
self
,
OutputFilenames
,
OutputType
,
Passes
,
Sanitizer
,
Lto
};
use
rustc
::
session
::
Session
;
use
rustc
::
util
::
nodemap
::
FxHashMap
;
...
...
@@ -32,6 +32,7 @@
use
rustc
::
util
::
common
::{
time_ext
,
time_depth
,
set_time_depth
,
print_time_passes_entry
};
use
rustc_fs_util
::{
path2cstr
,
link_or_copy
};
use
rustc_data_structures
::
small_c_str
::
SmallCStr
;
use
rustc_data_structures
::
svh
::
Svh
;
use
errors
::{
self
,
Handler
,
Level
,
DiagnosticBuilder
,
FatalError
,
DiagnosticId
};
use
errors
::
emitter
::{
Emitter
};
use
syntax
::
attr
;
...
...
@@ -912,13 +913,13 @@ fn need_crate_bitcode_for_rlib(sess: &Session) -> bool {
pub
fn
start_async_codegen
(
tcx
:
TyCtxt
,
time_graph
:
Option
<
TimeGraph
>
,
link
:
LinkMeta
,
metadata
:
EncodedMetadata
,
coordinator_receive
:
Receiver
<
Box
<
dyn
Any
+
Send
>>
,
total_cgus
:
usize
)
->
OngoingCodegen
{
let
sess
=
tcx
.sess
;
let
crate_name
=
tcx
.crate_name
(
LOCAL_CRATE
);
let
crate_hash
=
tcx
.crate_hash
(
LOCAL_CRATE
);
let
no_builtins
=
attr
::
contains_name
(
&
tcx
.hir
.krate
()
.attrs
,
"no_builtins"
);
let
subsystem
=
attr
::
first_attr_value_str_by_name
(
&
tcx
.hir
.krate
()
.attrs
,
"windows_subsystem"
);
...
...
@@ -1037,7 +1038,7 @@ pub fn start_async_codegen(tcx: TyCtxt,
OngoingCodegen
{
crate_name
,
link
,
crate_hash
,
metadata
,
windows_subsystem
,
linker_info
,
...
...
@@ -2270,7 +2271,7 @@ pub fn check(&self, sess: &Session, blocking: bool) {
pub
struct
OngoingCodegen
{
crate_name
:
Symbol
,
link
:
LinkMeta
,
crate_hash
:
Svh
,
metadata
:
EncodedMetadata
,
windows_subsystem
:
Option
<
String
>
,
linker_info
:
LinkerInfo
,
...
...
@@ -2321,7 +2322,7 @@ pub(crate) fn join(
(
CodegenResults
{
crate_name
:
self
.crate_name
,
link
:
self
.link
,
crate_hash
:
self
.crate_hash
,
metadata
:
self
.metadata
,
windows_subsystem
:
self
.windows_subsystem
,
linker_info
:
self
.linker_info
,
...
...
src/librustc_codegen_llvm/base.rs
浏览文件 @
5d4a25da
...
...
@@ -29,7 +29,6 @@
use
super
::
ModuleKind
;
use
abi
;
use
back
::
link
;
use
back
::
write
::{
self
,
OngoingCodegen
};
use
llvm
::{
self
,
TypeKind
,
get_param
};
use
metadata
;
...
...
@@ -42,7 +41,7 @@
use
rustc
::
ty
::
layout
::{
self
,
Align
,
TyLayout
,
LayoutOf
};
use
rustc
::
ty
::
query
::
Providers
;
use
rustc
::
dep_graph
::{
DepNode
,
DepConstructor
};
use
rustc
::
middle
::
cstore
::{
self
,
Link
Meta
,
Link
agePreference
};
use
rustc
::
middle
::
cstore
::{
self
,
LinkagePreference
};
use
rustc
::
middle
::
exported_symbols
;
use
rustc
::
util
::
common
::{
time
,
print_time_passes_entry
};
use
rustc
::
util
::
profiling
::
ProfileCategory
;
...
...
@@ -608,8 +607,7 @@ fn create_entry_fn(
}
fn
write_metadata
<
'a
,
'gcx
>
(
tcx
:
TyCtxt
<
'a
,
'gcx
,
'gcx
>
,
llvm_module
:
&
ModuleLlvm
,
link_meta
:
&
LinkMeta
)
llvm_module
:
&
ModuleLlvm
)
->
EncodedMetadata
{
use
std
::
io
::
Write
;
use
flate2
::
Compression
;
...
...
@@ -641,7 +639,7 @@ enum MetadataKind {
return
EncodedMetadata
::
new
();
}
let
metadata
=
tcx
.encode_metadata
(
link_meta
);
let
metadata
=
tcx
.encode_metadata
();
if
kind
==
MetadataKind
::
Uncompressed
{
return
metadata
;
}
...
...
@@ -719,8 +717,6 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
tcx
.sess
.fatal
(
"this compiler's LLVM does not support PGO"
);
}
let
crate_hash
=
tcx
.crate_hash
(
LOCAL_CRATE
);
let
link_meta
=
link
::
build_link_meta
(
crate_hash
);
let
cgu_name_builder
=
&
mut
CodegenUnitNameBuilder
::
new
(
tcx
);
// Codegen the metadata.
...
...
@@ -732,7 +728,7 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
.to_string
();
let
metadata_llvm_module
=
ModuleLlvm
::
new
(
tcx
.sess
,
&
metadata_cgu_name
);
let
metadata
=
time
(
tcx
.sess
,
"write metadata"
,
||
{
write_metadata
(
tcx
,
&
metadata_llvm_module
,
&
link_meta
)
write_metadata
(
tcx
,
&
metadata_llvm_module
)
});
tcx
.sess
.profiler
(|
p
|
p
.end_activity
(
ProfileCategory
::
Codegen
));
...
...
@@ -754,7 +750,6 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let
ongoing_codegen
=
write
::
start_async_codegen
(
tcx
,
time_graph
.clone
(),
link_meta
,
metadata
,
rx
,
1
);
...
...
@@ -789,7 +784,6 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let
ongoing_codegen
=
write
::
start_async_codegen
(
tcx
,
time_graph
.clone
(),
link_meta
,
metadata
,
rx
,
codegen_units
.len
());
...
...
src/librustc_codegen_llvm/lib.rs
浏览文件 @
5d4a25da
...
...
@@ -88,6 +88,7 @@
use
rustc
::
util
::
profiling
::
ProfileCategory
;
use
rustc_mir
::
monomorphize
;
use
rustc_codegen_utils
::
codegen_backend
::
CodegenBackend
;
use
rustc_data_structures
::
svh
::
Svh
;
mod
diagnostics
;
...
...
@@ -251,7 +252,7 @@ fn join_codegen_and_link(
// Now that we won't touch anything in the incremental compilation directory
// any more, we can finalize it (which involves renaming it)
rustc_incremental
::
finalize_session_directory
(
sess
,
ongoing_codegen
.
link.
crate_hash
);
rustc_incremental
::
finalize_session_directory
(
sess
,
ongoing_codegen
.crate_hash
);
Ok
(())
}
...
...
@@ -389,7 +390,7 @@ struct CodegenResults {
modules
:
Vec
<
CompiledModule
>
,
allocator_module
:
Option
<
CompiledModule
>
,
metadata_module
:
CompiledModule
,
link
:
rustc
::
middle
::
cstore
::
LinkMeta
,
crate_hash
:
Svh
,
metadata
:
rustc
::
middle
::
cstore
::
EncodedMetadata
,
windows_subsystem
:
Option
<
String
>
,
linker_info
:
back
::
linker
::
LinkerInfo
,
...
...
src/librustc_codegen_utils/codegen_backend.rs
浏览文件 @
5d4a25da
...
...
@@ -44,7 +44,7 @@
use
rustc_target
::
spec
::
Target
;
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_mir
::
monomorphize
::
collector
;
use
link
::
{
build_link_meta
,
out_filename
}
;
use
link
::
out_filename
;
pub
use
rustc_data_structures
::
sync
::
MetadataRef
;
...
...
@@ -180,8 +180,7 @@ fn codegen_crate<'a, 'tcx>(
}
tcx
.sess
.abort_if_errors
();
let
link_meta
=
build_link_meta
(
tcx
.crate_hash
(
LOCAL_CRATE
));
let
metadata
=
tcx
.encode_metadata
(
&
link_meta
);
let
metadata
=
tcx
.encode_metadata
();
box
OngoingCodegen
{
metadata
:
metadata
,
...
...
src/librustc_codegen_utils/link.rs
浏览文件 @
5d4a25da
...
...
@@ -10,8 +10,6 @@
use
rustc
::
session
::
config
::{
self
,
OutputFilenames
,
Input
,
OutputType
};
use
rustc
::
session
::
Session
;
use
rustc
::
middle
::
cstore
::
LinkMeta
;
use
rustc_data_structures
::
svh
::
Svh
;
use
std
::
path
::{
Path
,
PathBuf
};
use
syntax
::{
ast
,
attr
};
use
syntax_pos
::
Span
;
...
...
@@ -50,14 +48,6 @@ fn is_writeable(p: &Path) -> bool {
}
}
pub
fn
build_link_meta
(
crate_hash
:
Svh
)
->
LinkMeta
{
let
r
=
LinkMeta
{
crate_hash
,
};
info!
(
"{:?}"
,
r
);
return
r
;
}
pub
fn
find_crate_name
(
sess
:
Option
<&
Session
>
,
attrs
:
&
[
ast
::
Attribute
],
input
:
&
Input
)
->
String
{
...
...
src/librustc_metadata/cstore_impl.rs
浏览文件 @
5d4a25da
...
...
@@ -17,7 +17,6 @@
use
rustc
::
ty
::
query
::
QueryConfig
;
use
rustc
::
middle
::
cstore
::{
CrateStore
,
DepKind
,
LinkMeta
,
EncodedMetadata
,
NativeLibraryKind
};
use
rustc
::
middle
::
exported_symbols
::
ExportedSymbol
;
use
rustc
::
middle
::
stability
::
DeprecationEntry
;
...
...
@@ -567,11 +566,10 @@ fn postorder_cnums_untracked(&self) -> Vec<CrateNum> {
}
fn
encode_metadata
<
'a
,
'tcx
>
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
link_meta
:
&
LinkMeta
)
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
->
EncodedMetadata
{
encoder
::
encode_metadata
(
tcx
,
link_meta
)
encoder
::
encode_metadata
(
tcx
)
}
fn
metadata_encoding_version
(
&
self
)
->
&
[
u8
]
...
...
src/librustc_metadata/encoder.rs
浏览文件 @
5d4a25da
...
...
@@ -13,7 +13,7 @@
use
isolated_encoder
::
IsolatedEncoder
;
use
schema
::
*
;
use
rustc
::
middle
::
cstore
::{
Link
Meta
,
Link
agePreference
,
NativeLibrary
,
use
rustc
::
middle
::
cstore
::{
LinkagePreference
,
NativeLibrary
,
EncodedMetadata
,
ForeignModule
};
use
rustc
::
hir
::
def
::
CtorKind
;
use
rustc
::
hir
::
def_id
::{
CrateNum
,
CRATE_DEF_INDEX
,
DefIndex
,
DefId
,
LocalDefId
,
LOCAL_CRATE
};
...
...
@@ -52,7 +52,6 @@
pub
struct
EncodeContext
<
'a
,
'tcx
:
'a
>
{
opaque
:
opaque
::
Encoder
,
pub
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
link_meta
:
&
'a
LinkMeta
,
lazy_state
:
LazyState
,
type_shorthands
:
FxHashMap
<
Ty
<
'tcx
>
,
usize
>
,
...
...
@@ -482,7 +481,6 @@ fn encode_crate_root(&mut self) -> Lazy<CrateRoot> {
let
index_bytes
=
self
.position
()
-
i
;
let
attrs
=
tcx
.hir
.krate_attrs
();
let
link_meta
=
self
.link_meta
;
let
is_proc_macro
=
tcx
.sess.crate_types
.borrow
()
.contains
(
&
CrateType
::
ProcMacro
);
let
has_default_lib_allocator
=
attr
::
contains_name
(
&
attrs
,
"default_lib_allocator"
);
let
has_global_allocator
=
*
tcx
.sess.has_global_allocator
.get
();
...
...
@@ -491,7 +489,7 @@ fn encode_crate_root(&mut self) -> Lazy<CrateRoot> {
name
:
tcx
.crate_name
(
LOCAL_CRATE
),
extra_filename
:
tcx
.sess.opts.cg.extra_filename
.clone
(),
triple
:
tcx
.sess.opts.target_triple
.clone
(),
hash
:
link_meta
.crate_hash
,
hash
:
tcx
.crate_hash
(
LOCAL_CRATE
)
,
disambiguator
:
tcx
.sess
.local_crate_disambiguator
(),
panic_strategy
:
tcx
.sess
.panic_strategy
(),
edition
:
hygiene
::
default_edition
(),
...
...
@@ -1824,8 +1822,7 @@ fn visit_impl_item(&mut self, _impl_item: &'v hir::ImplItem) {
// will allow us to slice the metadata to the precise length that we just
// generated regardless of trailing bytes that end up in it.
pub
fn
encode_metadata
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
link_meta
:
&
LinkMeta
)
pub
fn
encode_metadata
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
->
EncodedMetadata
{
let
mut
encoder
=
opaque
::
Encoder
::
new
(
vec!
[]);
...
...
@@ -1838,7 +1835,6 @@ pub fn encode_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let
mut
ecx
=
EncodeContext
{
opaque
:
encoder
,
tcx
,
link_meta
,
lazy_state
:
LazyState
::
NoNode
,
type_shorthands
:
Default
::
default
(),
predicate_shorthands
:
Default
::
default
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录