Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
74d6b850
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,发现更多精彩内容 >>
提交
74d6b850
编写于
9月 18, 2017
作者:
M
Michael Woerister
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
incr.comp.: Fix rebase fallout.
上级
d5b1fee6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
138 addition
and
31 deletion
+138
-31
src/librustc/ich/hcx.rs
src/librustc/ich/hcx.rs
+2
-2
src/librustc/infer/error_reporting/different_lifetimes.rs
src/librustc/infer/error_reporting/different_lifetimes.rs
+4
-8
src/librustc/middle/exported_symbols.rs
src/librustc/middle/exported_symbols.rs
+5
-0
src/librustc/middle/trans.rs
src/librustc/middle/trans.rs
+79
-0
src/librustc/session/config.rs
src/librustc/session/config.rs
+33
-0
src/librustc_data_structures/stable_hasher.rs
src/librustc_data_structures/stable_hasher.rs
+8
-0
src/librustc_trans/base.rs
src/librustc_trans/base.rs
+6
-19
src/librustc_trans/context.rs
src/librustc_trans/context.rs
+1
-2
未找到文件。
src/librustc/ich/hcx.rs
浏览文件 @
74d6b850
...
...
@@ -15,7 +15,7 @@
use
ich
::{
self
,
CachingCodemapView
};
use
middle
::
cstore
::
CrateStore
;
use
session
::
config
::
DebugInfoLevel
::
NoDebugInfo
;
use
ty
::{
self
,
TyCtxt
,
fast_reject
};
use
ty
::{
TyCtxt
,
fast_reject
};
use
session
::
Session
;
use
std
::
cmp
::
Ord
;
...
...
@@ -252,7 +252,7 @@ pub fn unop_can_panic_at_runtime(&self, unop: hir::UnOp) -> bool
}
}
impl
<
'a
,
'gcx
,
'lcx
>
StableHashingContextProvider
for
ty
::
TyCtxt
<
'a
,
'gcx
,
'lcx
>
{
impl
<
'a
,
'gcx
,
'lcx
>
StableHashingContextProvider
for
TyCtxt
<
'a
,
'gcx
,
'lcx
>
{
type
ContextType
=
StableHashingContext
<
'gcx
>
;
fn
create_stable_hashing_context
(
&
self
)
->
Self
::
ContextType
{
(
*
self
)
.create_stable_hashing_context
()
...
...
src/librustc/infer/error_reporting/different_lifetimes.rs
浏览文件 @
74d6b850
...
...
@@ -332,10 +332,8 @@ fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) {
(
Some
(
rl
::
Region
::
EarlyBound
(
_
,
id
)),
ty
::
BrNamed
(
def_id
,
_
))
=>
{
debug!
(
"EarlyBound self.infcx.tcx.hir.local_def_id(id)={:?}
\
def_id={:?}"
,
self
.infcx.tcx.hir
.local_def_id
(
id
),
def_id
);
if
self
.infcx.tcx.hir
.local_def_id
(
id
)
==
def_id
{
def_id={:?}"
,
id
,
def_id
);
if
id
==
def_id
{
self
.found_it
=
true
;
return
;
// we can stop visiting now
}
...
...
@@ -344,11 +342,9 @@ fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) {
(
Some
(
rl
::
Region
::
LateBound
(
debruijn_index
,
id
)),
ty
::
BrNamed
(
def_id
,
_
))
=>
{
debug!
(
"FindNestedTypeVisitor::visit_ty: LateBound depth = {:?}"
,
debruijn_index
.depth
);
debug!
(
"self.infcx.tcx.hir.local_def_id(id)={:?}"
,
self
.infcx.tcx.hir
.local_def_id
(
id
));
debug!
(
"id={:?}"
,
id
);
debug!
(
"def_id={:?}"
,
def_id
);
if
debruijn_index
.depth
==
self
.depth
&&
self
.infcx.tcx.hir
.local_def_id
(
id
)
==
def_id
{
if
debruijn_index
.depth
==
self
.depth
&&
id
==
def_id
{
self
.found_it
=
true
;
return
;
// we can stop visiting now
}
...
...
src/librustc/middle/exported_symbols.rs
浏览文件 @
74d6b850
...
...
@@ -19,6 +19,11 @@ pub enum SymbolExportLevel {
Rust
,
}
impl_stable_hash_for!
(
enum
self
::
SymbolExportLevel
{
C
,
Rust
});
impl
SymbolExportLevel
{
pub
fn
is_below_threshold
(
self
,
threshold
:
SymbolExportLevel
)
->
bool
{
if
threshold
==
SymbolExportLevel
::
Rust
{
...
...
src/librustc/middle/trans.rs
浏览文件 @
74d6b850
...
...
@@ -12,6 +12,9 @@
use
syntax
::
symbol
::
InternedString
;
use
ty
::
Instance
;
use
util
::
nodemap
::
FxHashMap
;
use
rustc_data_structures
::
stable_hasher
::{
HashStable
,
StableHasherResult
,
StableHasher
};
use
ich
::{
Fingerprint
,
StableHashingContext
,
NodeIdHashingMode
};
#[derive(PartialEq,
Eq,
Clone,
Copy,
Debug,
Hash)]
pub
enum
TransItem
<
'tcx
>
{
...
...
@@ -20,6 +23,26 @@ pub enum TransItem<'tcx> {
GlobalAsm
(
NodeId
),
}
impl
<
'tcx
>
HashStable
<
StableHashingContext
<
'tcx
>>
for
TransItem
<
'tcx
>
{
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'tcx
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
::
std
::
mem
::
discriminant
(
self
)
.hash_stable
(
hcx
,
hasher
);
match
*
self
{
TransItem
::
Fn
(
ref
instance
)
=>
{
instance
.hash_stable
(
hcx
,
hasher
);
}
TransItem
::
Static
(
node_id
)
|
TransItem
::
GlobalAsm
(
node_id
)
=>
{
hcx
.with_node_id_hashing_mode
(
NodeIdHashingMode
::
HashDefPath
,
|
hcx
|
{
node_id
.hash_stable
(
hcx
,
hasher
);
})
}
}
}
}
pub
struct
CodegenUnit
<
'tcx
>
{
/// A name for this CGU. Incremental compilation requires that
/// name be unique amongst **all** crates. Therefore, it should
...
...
@@ -44,6 +67,20 @@ pub enum Linkage {
Common
,
}
impl_stable_hash_for!
(
enum
self
::
Linkage
{
External
,
AvailableExternally
,
LinkOnceAny
,
LinkOnceODR
,
WeakAny
,
WeakODR
,
Appending
,
Internal
,
Private
,
ExternalWeak
,
Common
});
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
Debug)]
pub
enum
Visibility
{
Default
,
...
...
@@ -51,6 +88,12 @@ pub enum Visibility {
Protected
,
}
impl_stable_hash_for!
(
enum
self
::
Visibility
{
Default
,
Hidden
,
Protected
});
impl
<
'tcx
>
CodegenUnit
<
'tcx
>
{
pub
fn
new
(
name
:
InternedString
)
->
CodegenUnit
<
'tcx
>
{
CodegenUnit
{
...
...
@@ -78,6 +121,29 @@ pub fn items_mut(&mut self)
}
}
impl
<
'tcx
>
HashStable
<
StableHashingContext
<
'tcx
>>
for
CodegenUnit
<
'tcx
>
{
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
hcx
:
&
mut
StableHashingContext
<
'tcx
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
let
CodegenUnit
{
ref
items
,
name
,
}
=
*
self
;
name
.hash_stable
(
hcx
,
hasher
);
let
mut
items
:
Vec
<
(
Fingerprint
,
_
)
>
=
items
.iter
()
.map
(|(
trans_item
,
&
attrs
)|
{
let
mut
hasher
=
StableHasher
::
new
();
trans_item
.hash_stable
(
hcx
,
&
mut
hasher
);
let
trans_item_fingerprint
=
hasher
.finish
();
(
trans_item_fingerprint
,
attrs
)
})
.collect
();
items
.sort_unstable_by_key
(|
i
|
i
.0
);
items
.hash_stable
(
hcx
,
hasher
);
}
}
#[derive(Clone,
Default)]
pub
struct
Stats
{
pub
n_glues_created
:
usize
,
...
...
@@ -92,6 +158,18 @@ pub struct Stats {
pub
fn_stats
:
Vec
<
(
String
,
usize
)
>
,
}
impl_stable_hash_for!
(
struct
self
::
Stats
{
n_glues_created
,
n_null_glues
,
n_real_glues
,
n_fns
,
n_inlines
,
n_closures
,
n_llvm_insns
,
llvm_insns
,
fn_stats
});
impl
Stats
{
pub
fn
extend
(
&
mut
self
,
stats
:
Stats
)
{
self
.n_glues_created
+=
stats
.n_glues_created
;
...
...
@@ -108,3 +186,4 @@ pub fn extend(&mut self, stats: Stats) {
self
.fn_stats
.extend
(
stats
.fn_stats
);
}
}
src/librustc/session/config.rs
浏览文件 @
74d6b850
...
...
@@ -19,8 +19,10 @@
use
session
::{
early_error
,
early_warn
,
Session
};
use
session
::
search_paths
::
SearchPaths
;
use
ich
::
StableHashingContext
;
use
rustc_back
::{
LinkerFlavor
,
PanicStrategy
,
RelroLevel
};
use
rustc_back
::
target
::
Target
;
use
rustc_data_structures
::
stable_hasher
::
ToStableHashKey
;
use
lint
;
use
middle
::
cstore
;
...
...
@@ -90,6 +92,25 @@ pub enum OutputType {
DepInfo
,
}
impl_stable_hash_for!
(
enum
self
::
OutputType
{
Bitcode
,
Assembly
,
LlvmAssembly
,
Mir
,
Metadata
,
Object
,
Exe
,
DepInfo
});
impl
<
'tcx
>
ToStableHashKey
<
StableHashingContext
<
'tcx
>>
for
OutputType
{
type
KeyType
=
OutputType
;
#[inline]
fn
to_stable_hash_key
(
&
self
,
_
:
&
StableHashingContext
<
'tcx
>
)
->
Self
::
KeyType
{
*
self
}
}
impl
OutputType
{
fn
is_compatible_with_codegen_units_and_single_output_file
(
&
self
)
->
bool
{
match
*
self
{
...
...
@@ -149,6 +170,10 @@ fn default() -> ErrorOutputType {
#[derive(Clone,
Hash)]
pub
struct
OutputTypes
(
BTreeMap
<
OutputType
,
Option
<
PathBuf
>>
);
impl_stable_hash_for!
(
tuple_struct
self
::
OutputTypes
{
map
});
impl
OutputTypes
{
pub
fn
new
(
entries
:
&
[(
OutputType
,
Option
<
PathBuf
>
)])
->
OutputTypes
{
OutputTypes
(
BTreeMap
::
from_iter
(
entries
.iter
()
...
...
@@ -373,6 +398,14 @@ pub struct OutputFilenames {
pub
outputs
:
OutputTypes
,
}
impl_stable_hash_for!
(
struct
self
::
OutputFilenames
{
out_directory
,
out_filestem
,
single_output_file
,
extra
,
outputs
});
/// Codegen unit names generated by the numbered naming scheme will contain this
/// marker right before the index of the codegen unit.
pub
const
NUMBERED_CODEGEN_UNIT_MARKER
:
&
'static
str
=
".cgu-"
;
...
...
src/librustc_data_structures/stable_hasher.rs
浏览文件 @
74d6b850
...
...
@@ -386,6 +386,14 @@ fn hash_stable<W: StableHasherResult>(&self,
}
}
impl
<
HCX
>
ToStableHashKey
<
HCX
>
for
String
{
type
KeyType
=
String
;
#[inline]
fn
to_stable_hash_key
(
&
self
,
_
:
&
HCX
)
->
Self
::
KeyType
{
self
.clone
()
}
}
impl
<
CTX
>
HashStable
<
CTX
>
for
bool
{
#[inline]
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
...
...
src/librustc_trans/base.rs
浏览文件 @
74d6b850
...
...
@@ -41,7 +41,6 @@
use
rustc
::
middle
::
cstore
::{
EncodedMetadata
,
EncodedMetadataHashes
};
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
};
use
rustc
::
ty
::
maps
::
Providers
;
use
rustc
::
dep_graph
::
AssertDepGraphSafe
;
use
rustc
::
middle
::
cstore
::{
self
,
LinkMeta
,
LinkagePreference
};
use
rustc
::
hir
::
map
as
hir_map
;
use
rustc
::
util
::
common
::{
time
,
print_time_passes_entry
};
...
...
@@ -894,7 +893,7 @@ fn iter_globals(llmod: llvm::ModuleRef) -> ValueIter {
/// This list is later used by linkers to determine the set of symbols needed to
/// be exposed from a dynamic library and it's also encoded into the metadata.
pub
fn
find_exported_symbols
(
tcx
:
TyCtxt
)
->
NodeSet
{
tcx
.reachable_set
(
LOCAL_CRATE
)
.iter
()
.cloned
()
.filter
(|
&
id
|
{
tcx
.reachable_set
(
LOCAL_CRATE
)
.
0
.
iter
()
.cloned
()
.filter
(|
&
id
|
{
// Next, we want to ignore some FFI functions that are not exposed from
// this crate. Reachable FFI functions can be lumped into two
// categories:
...
...
@@ -1370,8 +1369,8 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let
dep_node
=
cgu
.work_product_dep_node
();
let
((
stats
,
module
),
_
)
=
tcx
.dep_graph
.with_task
(
dep_node
,
AssertDepGraphSafe
(
tcx
)
,
AssertDepGraphSafe
(
cgu
)
,
tcx
,
cgu
,
module_translation
);
let
time_to_translate
=
start_time
.elapsed
();
...
...
@@ -1392,14 +1391,10 @@ fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
return
stats
;
fn
module_translation
<
'a
,
'tcx
>
(
tcx
:
AssertDepGraphSafe
<
TyCtxt
<
'a
,
'tcx
,
'tcx
>
>
,
args
:
AssertDepGraphSafe
<
Arc
<
CodegenUnit
<
'tcx
>
>>
)
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
cgu
:
Arc
<
CodegenUnit
<
'tcx
>>
)
->
(
Stats
,
ModuleTranslation
)
{
// FIXME(#40304): We ought to be using the id as a key and some queries, I think.
let
AssertDepGraphSafe
(
tcx
)
=
tcx
;
let
AssertDepGraphSafe
(
cgu
)
=
args
;
let
cgu_name
=
cgu
.name
()
.to_string
();
let
cgu_id
=
cgu
.work_product_id
();
let
symbol_name_hash
=
cgu
.compute_symbol_name_hash
(
tcx
);
...
...
@@ -1564,6 +1559,7 @@ pub fn visibility_to_llvm(linkage: Visibility) -> llvm::Visibility {
Visibility
::
Default
=>
llvm
::
Visibility
::
Default
,
Visibility
::
Hidden
=>
llvm
::
Visibility
::
Hidden
,
Visibility
::
Protected
=>
llvm
::
Visibility
::
Protected
,
}
}
// FIXME(mw): Anything that is produced via DepGraph::with_task() must implement
...
...
@@ -1577,17 +1573,8 @@ pub fn visibility_to_llvm(linkage: Visibility) -> llvm::Visibility {
mod
temp_stable_hash_impls
{
use
rustc_data_structures
::
stable_hasher
::{
StableHasherResult
,
StableHasher
,
HashStable
};
use
context
::
Stats
;
use
ModuleTranslation
;
impl
<
HCX
>
HashStable
<
HCX
>
for
Stats
{
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
_
:
&
mut
HCX
,
_
:
&
mut
StableHasher
<
W
>
)
{
// do nothing
}
}
impl
<
HCX
>
HashStable
<
HCX
>
for
ModuleTranslation
{
fn
hash_stable
<
W
:
StableHasherResult
>
(
&
self
,
_
:
&
mut
HCX
,
...
...
src/librustc_trans/context.rs
浏览文件 @
74d6b850
...
...
@@ -27,9 +27,8 @@
use
rustc_data_structures
::
base_n
;
use
rustc
::
middle
::
trans
::
Stats
;
use
rustc_data_structures
::
stable_hasher
::
StableHashingContextProvider
;
use
rustc
::
session
::
config
::{
self
,
NoDebugInfo
,
OutputFilenames
};
use
rustc
::
session
::
Session
;
use
rustc
::
session
::
config
::{
self
,
NoDebugInfo
};
use
rustc
::
session
::
Session
;
use
rustc
::
ty
::
layout
::{
LayoutCx
,
LayoutError
,
LayoutTyper
,
TyLayout
};
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
};
use
rustc
::
util
::
nodemap
::
FxHashMap
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录