Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ea473502
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
ea473502
编写于
7月 11, 2018
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deny bare trait objects in in src/librustc_codegen_llvm
上级
ae5b629e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
34 addition
and
33 deletion
+34
-33
src/librustc_codegen_llvm/back/archive.rs
src/librustc_codegen_llvm/back/archive.rs
+1
-1
src/librustc_codegen_llvm/back/link.rs
src/librustc_codegen_llvm/back/link.rs
+8
-8
src/librustc_codegen_llvm/back/linker.rs
src/librustc_codegen_llvm/back/linker.rs
+6
-6
src/librustc_codegen_llvm/back/rpath.rs
src/librustc_codegen_llvm/back/rpath.rs
+1
-1
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/back/write.rs
+8
-8
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+1
-1
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/intrinsic.rs
+2
-2
src/librustc_codegen_llvm/lib.rs
src/librustc_codegen_llvm/lib.rs
+7
-6
未找到文件。
src/librustc_codegen_llvm/back/archive.rs
浏览文件 @
ea473502
...
...
@@ -48,7 +48,7 @@ enum Addition {
},
Archive
{
archive
:
ArchiveRO
,
skip
:
Box
<
FnMut
(
&
str
)
->
bool
>
,
skip
:
Box
<
dyn
FnMut
(
&
str
)
->
bool
>
,
},
}
...
...
src/librustc_codegen_llvm/back/link.rs
浏览文件 @
ea473502
...
...
@@ -251,7 +251,7 @@ fn filename_for_metadata(sess: &Session, crate_name: &str, outputs: &OutputFilen
pub
(
crate
)
fn
each_linked_rlib
(
sess
:
&
Session
,
info
:
&
CrateInfo
,
f
:
&
mut
FnMut
(
CrateNum
,
&
Path
))
->
Result
<
(),
String
>
{
f
:
&
mut
dyn
FnMut
(
CrateNum
,
&
Path
))
->
Result
<
(),
String
>
{
let
crates
=
info
.used_crates_static
.iter
();
let
fmts
=
sess
.dependency_formats
.borrow
();
let
fmts
=
fmts
.get
(
&
config
::
CrateTypeExecutable
)
...
...
@@ -984,7 +984,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
}
}
fn
link_args
(
cmd
:
&
mut
Linker
,
fn
link_args
(
cmd
:
&
mut
dyn
Linker
,
sess
:
&
Session
,
crate_type
:
config
::
CrateType
,
tmpdir
:
&
Path
,
...
...
@@ -1195,7 +1195,7 @@ fn link_args(cmd: &mut Linker,
// Also note that the native libraries linked here are only the ones located
// in the current crate. Upstream crates with native library dependencies
// may have their native library pulled in above.
fn
add_local_native_libraries
(
cmd
:
&
mut
Linker
,
fn
add_local_native_libraries
(
cmd
:
&
mut
dyn
Linker
,
sess
:
&
Session
,
codegen_results
:
&
CodegenResults
)
{
sess
.target_filesearch
(
PathKind
::
All
)
.for_each_lib_search_path
(|
path
,
k
|
{
...
...
@@ -1226,7 +1226,7 @@ fn add_local_native_libraries(cmd: &mut Linker,
// Rust crates are not considered at all when creating an rlib output. All
// dependencies will be linked when producing the final output (instead of
// the intermediate rlib version)
fn
add_upstream_rust_crates
(
cmd
:
&
mut
Linker
,
fn
add_upstream_rust_crates
(
cmd
:
&
mut
dyn
Linker
,
sess
:
&
Session
,
codegen_results
:
&
CodegenResults
,
crate_type
:
config
::
CrateType
,
...
...
@@ -1350,7 +1350,7 @@ fn unlib<'a>(config: &config::Config, stem: &'a str) -> &'a str {
// it's packed in a .rlib, it contains stuff that are not objects that will
// make the linker error. So we must remove those bits from the .rlib before
// linking it.
fn
link_sanitizer_runtime
(
cmd
:
&
mut
Linker
,
fn
link_sanitizer_runtime
(
cmd
:
&
mut
dyn
Linker
,
sess
:
&
Session
,
codegen_results
:
&
CodegenResults
,
tmpdir
:
&
Path
,
...
...
@@ -1419,7 +1419,7 @@ fn link_sanitizer_runtime(cmd: &mut Linker,
// (aka we're making an executable), we can just pass the rlib blindly to
// the linker (fast) because it's fine if it's not actually included as
// we're at the end of the dependency chain.
fn
add_static_crate
(
cmd
:
&
mut
Linker
,
fn
add_static_crate
(
cmd
:
&
mut
dyn
Linker
,
sess
:
&
Session
,
codegen_results
:
&
CodegenResults
,
tmpdir
:
&
Path
,
...
...
@@ -1524,7 +1524,7 @@ fn looks_like_rust(s: &str) -> bool {
}
// Same thing as above, but for dynamic crates instead of static crates.
fn
add_dynamic_crate
(
cmd
:
&
mut
Linker
,
sess
:
&
Session
,
cratepath
:
&
Path
)
{
fn
add_dynamic_crate
(
cmd
:
&
mut
dyn
Linker
,
sess
:
&
Session
,
cratepath
:
&
Path
)
{
// If we're performing LTO, then it should have been previously required
// that all upstream rust dependencies were available in an rlib format.
assert
!
(
!
is_full_lto_enabled
(
sess
));
...
...
@@ -1559,7 +1559,7 @@ fn add_dynamic_crate(cmd: &mut Linker, sess: &Session, cratepath: &Path) {
// generic function calls a native function, then the generic function must
// be instantiated in the target crate, meaning that the native symbol must
// also be resolved in the target crate.
fn
add_upstream_native_libraries
(
cmd
:
&
mut
Linker
,
fn
add_upstream_native_libraries
(
cmd
:
&
mut
dyn
Linker
,
sess
:
&
Session
,
codegen_results
:
&
CodegenResults
,
crate_type
:
config
::
CrateType
)
{
...
...
src/librustc_codegen_llvm/back/linker.rs
浏览文件 @
ea473502
...
...
@@ -44,7 +44,7 @@ pub fn new(tcx: TyCtxt) -> LinkerInfo {
pub
fn
to_linker
<
'a
>
(
&
'a
self
,
cmd
:
Command
,
sess
:
&
'a
Session
)
->
Box
<
Linker
+
'a
>
{
sess
:
&
'a
Session
)
->
Box
<
dyn
Linker
+
'a
>
{
match
sess
.linker_flavor
()
{
LinkerFlavor
::
Lld
(
LldFlavor
::
Link
)
|
LinkerFlavor
::
Msvc
=>
{
...
...
@@ -52,14 +52,14 @@ pub fn to_linker<'a>(&'a self,
cmd
,
sess
,
info
:
self
})
as
Box
<
Linker
>
})
as
Box
<
dyn
Linker
>
}
LinkerFlavor
::
Em
=>
{
Box
::
new
(
EmLinker
{
cmd
,
sess
,
info
:
self
})
as
Box
<
Linker
>
})
as
Box
<
dyn
Linker
>
}
LinkerFlavor
::
Gcc
=>
{
Box
::
new
(
GccLinker
{
...
...
@@ -68,7 +68,7 @@ pub fn to_linker<'a>(&'a self,
info
:
self
,
hinted_static
:
false
,
is_ld
:
false
,
})
as
Box
<
Linker
>
})
as
Box
<
dyn
Linker
>
}
LinkerFlavor
::
Lld
(
LldFlavor
::
Ld
)
|
...
...
@@ -80,14 +80,14 @@ pub fn to_linker<'a>(&'a self,
info
:
self
,
hinted_static
:
false
,
is_ld
:
true
,
})
as
Box
<
Linker
>
})
as
Box
<
dyn
Linker
>
}
LinkerFlavor
::
Lld
(
LldFlavor
::
Wasm
)
=>
{
Box
::
new
(
WasmLd
{
cmd
,
sess
,
})
as
Box
<
Linker
>
})
as
Box
<
dyn
Linker
>
}
}
}
...
...
src/librustc_codegen_llvm/back/rpath.rs
浏览文件 @
ea473502
...
...
@@ -22,7 +22,7 @@ pub struct RPathConfig<'a> {
pub
is_like_osx
:
bool
,
pub
has_rpath
:
bool
,
pub
linker_is_gnu
:
bool
,
pub
get_install_prefix_lib_path
:
&
'a
mut
FnMut
()
->
PathBuf
,
pub
get_install_prefix_lib_path
:
&
'a
mut
dyn
FnMut
()
->
PathBuf
,
}
pub
fn
get_rpath_flags
(
config
:
&
mut
RPathConfig
)
->
Vec
<
String
>
{
...
...
src/librustc_codegen_llvm/back/write.rs
浏览文件 @
ea473502
...
...
@@ -140,7 +140,7 @@ pub fn create_target_machine(sess: &Session, find_features: bool) -> TargetMachi
// that `is_pie_binary` is false. When we discover LLVM target features
// `sess.crate_types` is uninitialized so we cannot access it.
pub
fn
target_machine_factory
(
sess
:
&
Session
,
find_features
:
bool
)
->
Arc
<
Fn
()
->
Result
<
TargetMachineRef
,
String
>
+
Send
+
Sync
>
->
Arc
<
dyn
Fn
()
->
Result
<
TargetMachineRef
,
String
>
+
Send
+
Sync
>
{
let
reloc_model
=
get_reloc_model
(
sess
);
...
...
@@ -343,7 +343,7 @@ pub struct CodegenContext {
regular_module_config
:
Arc
<
ModuleConfig
>
,
metadata_module_config
:
Arc
<
ModuleConfig
>
,
allocator_module_config
:
Arc
<
ModuleConfig
>
,
pub
tm_factory
:
Arc
<
Fn
()
->
Result
<
TargetMachineRef
,
String
>
+
Send
+
Sync
>
,
pub
tm_factory
:
Arc
<
dyn
Fn
()
->
Result
<
TargetMachineRef
,
String
>
+
Send
+
Sync
>
,
pub
msvc_imps_needed
:
bool
,
pub
target_pointer_width
:
String
,
debuginfo
:
config
::
DebugInfoLevel
,
...
...
@@ -362,7 +362,7 @@ pub struct CodegenContext {
// compiling incrementally
pub
incr_comp_session_dir
:
Option
<
PathBuf
>
,
// Channel back to the main control thread to send messages to
coordinator_send
:
Sender
<
Box
<
Any
+
Send
>>
,
coordinator_send
:
Sender
<
Box
<
dyn
Any
+
Send
>>
,
// A reference to the TimeGraph so we can register timings. None means that
// measuring is disabled.
time_graph
:
Option
<
TimeGraph
>
,
...
...
@@ -884,7 +884,7 @@ pub fn start_async_codegen(tcx: TyCtxt,
time_graph
:
Option
<
TimeGraph
>
,
link
:
LinkMeta
,
metadata
:
EncodedMetadata
,
coordinator_receive
:
Receiver
<
Box
<
Any
+
Send
>>
,
coordinator_receive
:
Receiver
<
Box
<
dyn
Any
+
Send
>>
,
total_cgus
:
usize
)
->
OngoingCodegen
{
let
sess
=
tcx
.sess
;
...
...
@@ -1412,7 +1412,7 @@ fn start_executing_work(tcx: TyCtxt,
crate_info
:
&
CrateInfo
,
shared_emitter
:
SharedEmitter
,
codegen_worker_send
:
Sender
<
Message
>
,
coordinator_receive
:
Receiver
<
Box
<
Any
+
Send
>>
,
coordinator_receive
:
Receiver
<
Box
<
dyn
Any
+
Send
>>
,
total_cgus
:
usize
,
jobserver
:
Client
,
time_graph
:
Option
<
TimeGraph
>
,
...
...
@@ -1976,7 +1976,7 @@ fn spawn_work(cgcx: CodegenContext, work: WorkItem) {
// Set up a destructor which will fire off a message that we're done as
// we exit.
struct
Bomb
{
coordinator_send
:
Sender
<
Box
<
Any
+
Send
>>
,
coordinator_send
:
Sender
<
Box
<
dyn
Any
+
Send
>>
,
result
:
Option
<
WorkItemResult
>
,
worker_id
:
usize
,
}
...
...
@@ -2056,7 +2056,7 @@ pub unsafe fn with_llvm_pmb(llmod: ModuleRef,
config
:
&
ModuleConfig
,
opt_level
:
llvm
::
CodeGenOptLevel
,
prepare_for_thin_lto
:
bool
,
f
:
&
mut
FnMut
(
llvm
::
PassManagerBuilderRef
))
{
f
:
&
mut
dyn
FnMut
(
llvm
::
PassManagerBuilderRef
))
{
use
std
::
ptr
;
// Create the PassManagerBuilder for LLVM. We configure it with
...
...
@@ -2243,7 +2243,7 @@ pub struct OngoingCodegen {
linker_info
:
LinkerInfo
,
crate_info
:
CrateInfo
,
time_graph
:
Option
<
TimeGraph
>
,
coordinator_send
:
Sender
<
Box
<
Any
+
Send
>>
,
coordinator_send
:
Sender
<
Box
<
dyn
Any
+
Send
>>
,
codegen_worker_receive
:
Receiver
<
Message
>
,
shared_emitter_main
:
SharedEmitterMain
,
future
:
thread
::
JoinHandle
<
Result
<
CompiledModules
,
()
>>
,
...
...
src/librustc_codegen_llvm/base.rs
浏览文件 @
ea473502
...
...
@@ -717,7 +717,7 @@ pub fn iter_globals(llmod: llvm::ModuleRef) -> ValueIter {
}
pub
fn
codegen_crate
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
rx
:
mpsc
::
Receiver
<
Box
<
Any
+
Send
>>
)
rx
:
mpsc
::
Receiver
<
Box
<
dyn
Any
+
Send
>>
)
->
OngoingCodegen
{
check_for_rustc_errors_attr
(
tcx
);
...
...
src/librustc_codegen_llvm/intrinsic.rs
浏览文件 @
ea473502
...
...
@@ -916,7 +916,7 @@ fn gen_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
name
:
&
str
,
inputs
:
Vec
<
Ty
<
'tcx
>>
,
output
:
Ty
<
'tcx
>
,
codegen
:
&
mut
for
<
'b
>
FnMut
(
Builder
<
'b
,
'tcx
>
))
codegen
:
&
mut
dyn
for
<
'b
>
FnMut
(
Builder
<
'b
,
'tcx
>
))
->
ValueRef
{
let
rust_fn_ty
=
cx
.tcx
.mk_fn_ptr
(
ty
::
Binder
::
bind
(
cx
.tcx
.mk_fn_sig
(
inputs
.into_iter
(),
...
...
@@ -936,7 +936,7 @@ fn gen_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
//
// This function is only generated once and is then cached.
fn
get_rust_try_fn
<
'a
,
'tcx
>
(
cx
:
&
CodegenCx
<
'a
,
'tcx
>
,
codegen
:
&
mut
for
<
'b
>
FnMut
(
Builder
<
'b
,
'tcx
>
))
codegen
:
&
mut
dyn
for
<
'b
>
FnMut
(
Builder
<
'b
,
'tcx
>
))
->
ValueRef
{
if
let
Some
(
llfn
)
=
cx
.rust_try_fn
.get
()
{
return
llfn
;
...
...
src/librustc_codegen_llvm/lib.rs
浏览文件 @
ea473502
...
...
@@ -23,6 +23,7 @@
#![feature(custom_attribute)]
#![feature(fs_read_write)]
#![allow(unused_attributes)]
#![deny(bare_trait_objects)]
#![feature(libc)]
#![feature(quote)]
#![feature(range_contains)]
...
...
@@ -125,7 +126,7 @@ impl !Send for LlvmCodegenBackend {} // Llvm is on a per-thread basis
impl
!
Sync
for
LlvmCodegenBackend
{}
impl
LlvmCodegenBackend
{
pub
fn
new
()
->
Box
<
CodegenBackend
>
{
pub
fn
new
()
->
Box
<
dyn
CodegenBackend
>
{
box
LlvmCodegenBackend
(())
}
}
...
...
@@ -178,7 +179,7 @@ fn target_features(&self, sess: &Session) -> Vec<Symbol> {
target_features
(
sess
)
}
fn
metadata_loader
(
&
self
)
->
Box
<
MetadataLoader
+
Sync
>
{
fn
metadata_loader
(
&
self
)
->
Box
<
dyn
MetadataLoader
+
Sync
>
{
box
metadata
::
LlvmMetadataLoader
}
...
...
@@ -198,14 +199,14 @@ fn provide_extern(&self, providers: &mut ty::query::Providers) {
fn
codegen_crate
<
'a
,
'tcx
>
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
rx
:
mpsc
::
Receiver
<
Box
<
Any
+
Send
>>
)
->
Box
<
Any
>
{
rx
:
mpsc
::
Receiver
<
Box
<
dyn
Any
+
Send
>>
)
->
Box
<
dyn
Any
>
{
box
base
::
codegen_crate
(
tcx
,
rx
)
}
fn
join_codegen_and_link
(
&
self
,
ongoing_codegen
:
Box
<
Any
>
,
ongoing_codegen
:
Box
<
dyn
Any
>
,
sess
:
&
Session
,
dep_graph
:
&
DepGraph
,
outputs
:
&
OutputFilenames
,
...
...
@@ -247,7 +248,7 @@ fn join_codegen_and_link(
/// This is the entrypoint for a hot plugged rustc_codegen_llvm
#[no_mangle]
pub
fn
__
rustc_codegen_backend
()
->
Box
<
CodegenBackend
>
{
pub
fn
__
rustc_codegen_backend
()
->
Box
<
dyn
CodegenBackend
>
{
LlvmCodegenBackend
::
new
()
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录