Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a9093a4d
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,发现更多精彩内容 >>
提交
a9093a4d
编写于
7月 26, 2018
作者:
M
Mark Rousskov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move share_generics getter onto options directly
上级
5fcef251
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
25 addition
and
25 deletion
+25
-25
src/librustc/session/config.rs
src/librustc/session/config.rs
+18
-0
src/librustc/ty/context.rs
src/librustc/ty/context.rs
+2
-20
src/librustc_codegen_llvm/back/symbol_export.rs
src/librustc_codegen_llvm/back/symbol_export.rs
+1
-1
src/librustc_codegen_llvm/callee.rs
src/librustc_codegen_llvm/callee.rs
+1
-1
src/librustc_codegen_utils/symbol_names.rs
src/librustc_codegen_utils/symbol_names.rs
+1
-1
src/librustc_mir/monomorphize/collector.rs
src/librustc_mir/monomorphize/collector.rs
+1
-1
src/librustc_mir/monomorphize/partitioning.rs
src/librustc_mir/monomorphize/partitioning.rs
+1
-1
未找到文件。
src/librustc/session/config.rs
浏览文件 @
a9093a4d
...
...
@@ -653,6 +653,24 @@ pub fn will_create_output_file(&self) -> bool {
!
self
.debugging_opts.parse_only
&&
// The file is just being parsed
!
self
.debugging_opts.ls
// The file is just being queried
}
#[inline]
pub
fn
share_generics
(
&
self
)
->
bool
{
match
self
.debugging_opts.share_generics
{
Some
(
setting
)
=>
setting
,
None
=>
{
self
.incremental
.is_some
()
||
match
self
.optimize
{
OptLevel
::
No
|
OptLevel
::
Less
|
OptLevel
::
Size
|
OptLevel
::
SizeMin
=>
true
,
OptLevel
::
Default
|
OptLevel
::
Aggressive
=>
false
,
}
}
}
}
}
// The type of entry function, so
...
...
src/librustc/ty/context.rs
浏览文件 @
a9093a4d
...
...
@@ -14,7 +14,7 @@
use
dep_graph
::{
DepNode
,
DepConstructor
};
use
errors
::
DiagnosticBuilder
;
use
session
::
Session
;
use
session
::
config
::{
BorrowckMode
,
OutputFilenames
,
OptLevel
};
use
session
::
config
::{
BorrowckMode
,
OutputFilenames
};
use
session
::
config
::
CrateType
;
use
middle
;
use
hir
::{
TraitCandidate
,
HirId
,
ItemLocalId
};
...
...
@@ -1469,27 +1469,9 @@ pub fn emit_end_regions(self) -> bool {
self
.use_mir_borrowck
()
}
#[inline]
pub
fn
share_generics
(
self
)
->
bool
{
match
self
.sess.opts.debugging_opts.share_generics
{
Some
(
setting
)
=>
setting
,
None
=>
{
self
.sess.opts.incremental
.is_some
()
||
match
self
.sess.opts.optimize
{
OptLevel
::
No
|
OptLevel
::
Less
|
OptLevel
::
Size
|
OptLevel
::
SizeMin
=>
true
,
OptLevel
::
Default
|
OptLevel
::
Aggressive
=>
false
,
}
}
}
}
#[inline]
pub
fn
local_crate_exports_generics
(
self
)
->
bool
{
debug_assert!
(
self
.share_generics
());
debug_assert!
(
self
.s
ess.opts
.s
hare_generics
());
self
.sess.crate_types
.borrow
()
.iter
()
.any
(|
crate_type
|
{
match
crate_type
{
...
...
src/librustc_codegen_llvm/back/symbol_export.rs
浏览文件 @
a9093a4d
...
...
@@ -242,7 +242,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
symbols
.push
((
exported_symbol
,
SymbolExportLevel
::
Rust
));
}
if
tcx
.share_generics
()
&&
tcx
.local_crate_exports_generics
()
{
if
tcx
.s
ess.opts
.s
hare_generics
()
&&
tcx
.local_crate_exports_generics
()
{
use
rustc
::
mir
::
mono
::{
Linkage
,
Visibility
,
MonoItem
};
use
rustc
::
ty
::
InstanceDef
;
...
...
src/librustc_codegen_llvm/callee.rs
浏览文件 @
a9093a4d
...
...
@@ -133,7 +133,7 @@ pub fn get_fn(
// This is a monomorphization. Its expected visibility depends
// on whether we are in share-generics mode.
if
cx
.tcx
.share_generics
()
{
if
cx
.tcx.s
ess.opts
.s
hare_generics
()
{
// We are in share_generics mode.
if
instance_def_id
.is_local
()
{
...
...
src/librustc_codegen_utils/symbol_names.rs
浏览文件 @
a9093a4d
...
...
@@ -201,7 +201,7 @@ fn get_symbol_hash<'a, 'tcx>(
if
avoid_cross_crate_conflicts
{
let
instantiating_crate
=
if
is_generic
{
if
!
def_id
.is_local
()
&&
tcx
.share_generics
()
{
if
!
def_id
.is_local
()
&&
tcx
.s
ess.opts
.s
hare_generics
()
{
// If we are re-using a monomorphization from another crate,
// we have to compute the symbol hash accordingly.
let
upstream_monomorphizations
=
tcx
.upstream_monomorphizations_for
(
def_id
);
...
...
src/librustc_mir/monomorphize/collector.rs
浏览文件 @
a9093a4d
...
...
@@ -770,7 +770,7 @@ fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// If we are not in share generics mode, we don't link to upstream
// monomorphizations but always instantiate our own internal versions
// instead.
if
!
tcx
.share_generics
()
{
if
!
tcx
.s
ess.opts
.s
hare_generics
()
{
return
false
}
...
...
src/librustc_mir/monomorphize/partitioning.rs
浏览文件 @
a9093a4d
...
...
@@ -304,7 +304,7 @@ fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// available to downstream crates. This depends on whether we are in
// share-generics mode and whether the current crate can even have
// downstream crates.
let
export_generics
=
tcx
.share_generics
()
&&
let
export_generics
=
tcx
.s
ess.opts
.s
hare_generics
()
&&
tcx
.local_crate_exports_generics
();
for
mono_item
in
mono_items
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录