Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e3c89943
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,发现更多精彩内容 >>
提交
e3c89943
编写于
12月 31, 2015
作者:
M
Michael Woerister
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Forward attributes of translated function/closure to trans_fn/trans_closure.
上级
a06bb977
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
42 addition
and
13 deletion
+42
-13
src/librustc_trans/trans/closure.rs
src/librustc_trans/trans/closure.rs
+4
-2
src/librustc_trans/trans/consts.rs
src/librustc_trans/trans/consts.rs
+7
-2
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/expr.rs
+7
-1
src/librustc_trans/trans/foreign.rs
src/librustc_trans/trans/foreign.rs
+1
-1
src/librustc_trans/trans/inline.rs
src/librustc_trans/trans/inline.rs
+1
-1
src/librustc_trans/trans/meth.rs
src/librustc_trans/trans/meth.rs
+7
-2
src/librustc_trans/trans/monomorphize.rs
src/librustc_trans/trans/monomorphize.rs
+15
-4
未找到文件。
src/librustc_trans/trans/closure.rs
浏览文件 @
e3c89943
...
...
@@ -31,6 +31,7 @@
use
syntax
::
abi
::
RustCall
;
use
syntax
::
ast
;
use
syntax
::
attr
::{
ThinAttributes
,
ThinAttributesExt
};
use
rustc_front
::
hir
;
...
...
@@ -176,7 +177,8 @@ pub fn trans_closure_expr<'a, 'tcx>(dest: Dest<'a, 'tcx>,
body
:
&
hir
::
Block
,
id
:
ast
::
NodeId
,
closure_def_id
:
DefId
,
// (*)
closure_substs
:
&
'tcx
ty
::
ClosureSubsts
<
'tcx
>
)
closure_substs
:
&
'tcx
ty
::
ClosureSubsts
<
'tcx
>
,
closure_expr_attrs
:
&
ThinAttributes
)
->
Option
<
Block
<
'a
,
'tcx
>>
{
// (*) Note that in the case of inlined functions, the `closure_def_id` will be the
...
...
@@ -218,7 +220,7 @@ pub fn trans_closure_expr<'a, 'tcx>(dest: Dest<'a, 'tcx>,
llfn
,
param_substs
,
id
,
&
[]
,
closure_expr_attrs
.as_attr_slice
()
,
sig
.output
,
function_type
.abi
,
ClosureEnv
::
Closure
(
closure_def_id
,
&
freevars
));
...
...
src/librustc_trans/trans/consts.rs
浏览文件 @
e3c89943
...
...
@@ -1019,8 +1019,13 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
hir
::
ExprClosure
(
_
,
ref
decl
,
ref
body
)
=>
{
match
ety
.sty
{
ty
::
TyClosure
(
def_id
,
ref
substs
)
=>
{
closure
::
trans_closure_expr
(
closure
::
Dest
::
Ignore
(
cx
),
decl
,
body
,
e
.id
,
def_id
,
substs
);
closure
::
trans_closure_expr
(
closure
::
Dest
::
Ignore
(
cx
),
decl
,
body
,
e
.id
,
def_id
,
substs
,
&
e
.attrs
);
}
_
=>
cx
.sess
()
.span_bug
(
...
...
src/librustc_trans/trans/expr.rs
浏览文件 @
e3c89943
...
...
@@ -1196,7 +1196,13 @@ fn make_field(field_name: &str, expr: P<hir::Expr>) -> hir::Field {
&
format!
(
"closure expr without closure type: {:?}"
,
t
)),
};
closure
::
trans_closure_expr
(
dest
,
decl
,
body
,
expr
.id
,
def_id
,
substs
)
.unwrap_or
(
bcx
)
closure
::
trans_closure_expr
(
dest
,
decl
,
body
,
expr
.id
,
def_id
,
substs
,
&
expr
.attrs
)
.unwrap_or
(
bcx
)
}
hir
::
ExprCall
(
ref
f
,
ref
args
)
=>
{
if
bcx
.tcx
()
.is_method_call
(
expr
.id
)
{
...
...
src/librustc_trans/trans/foreign.rs
浏览文件 @
e3c89943
...
...
@@ -639,7 +639,7 @@ fn build_rust_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
let
llfn
=
declare
::
define_internal_rust_fn
(
ccx
,
&
ps
,
t
);
attributes
::
from_fn_attrs
(
ccx
,
attrs
,
llfn
);
base
::
trans_fn
(
ccx
,
decl
,
body
,
llfn
,
param_substs
,
id
,
&
[]
);
base
::
trans_fn
(
ccx
,
decl
,
body
,
llfn
,
param_substs
,
id
,
attrs
);
llfn
}
...
...
src/librustc_trans/trans/inline.rs
浏览文件 @
e3c89943
...
...
@@ -165,7 +165,7 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: DefId)
llfn
,
empty_substs
,
impl_item
.id
,
&
[]
);
&
impl_item
.attrs
);
// See linkage comments on items.
if
ccx
.sess
()
.opts.cg.codegen_units
==
1
{
SetLinkage
(
llfn
,
InternalLinkage
);
...
...
src/librustc_trans/trans/meth.rs
浏览文件 @
e3c89943
...
...
@@ -74,8 +74,13 @@ pub fn trans_impl(ccx: &CrateContext,
for
(
ref
ccx
,
is_origin
)
in
ccx
.maybe_iter
(
trans_everywhere
)
{
let
llfn
=
get_item_val
(
ccx
,
impl_item
.id
);
let
empty_substs
=
tcx
.mk_substs
(
Substs
::
trans_empty
());
trans_fn
(
ccx
,
&
sig
.decl
,
body
,
llfn
,
empty_substs
,
impl_item
.id
,
&
[]);
trans_fn
(
ccx
,
&
sig
.decl
,
body
,
llfn
,
empty_substs
,
impl_item
.id
,
&
impl_item
.attrs
);
update_linkage
(
ccx
,
llfn
,
Some
(
impl_item
.id
),
...
...
src/librustc_trans/trans/monomorphize.rs
浏览文件 @
e3c89943
...
...
@@ -185,7 +185,13 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
ccx
,
&**
decl
,
&**
body
,
&
[],
d
,
psubsts
,
fn_node_id
,
Some
(
&
hash
[
..
]));
}
else
{
trans_fn
(
ccx
,
&**
decl
,
&**
body
,
d
,
psubsts
,
fn_node_id
,
&
[]);
trans_fn
(
ccx
,
&**
decl
,
&**
body
,
d
,
psubsts
,
fn_node_id
,
&
i
.attrs
);
}
}
...
...
@@ -216,7 +222,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
d
,
psubsts
,
impl_item
.id
,
&
[]
);
&
impl_item
.attrs
);
}
d
}
...
...
@@ -232,8 +238,13 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
let
d
=
mk_lldecl
(
abi
::
Rust
);
let
needs_body
=
setup_lldecl
(
d
,
&
trait_item
.attrs
);
if
needs_body
{
trans_fn
(
ccx
,
&
sig
.decl
,
body
,
d
,
psubsts
,
trait_item
.id
,
&
[]);
trans_fn
(
ccx
,
&
sig
.decl
,
body
,
d
,
psubsts
,
trait_item
.id
,
&
trait_item
.attrs
);
}
d
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录