Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
d7b15270
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,发现更多精彩内容 >>
提交
d7b15270
编写于
12月 22, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: De-`@mut` `building_library` in the session
上级
c56bac7f
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
18 addition
and
17 deletion
+18
-17
src/librustc/driver/driver.rs
src/librustc/driver/driver.rs
+4
-4
src/librustc/driver/session.rs
src/librustc/driver/session.rs
+1
-1
src/librustc/front/std_inject.rs
src/librustc/front/std_inject.rs
+1
-1
src/librustc/front/test.rs
src/librustc/front/test.rs
+1
-1
src/librustc/middle/entry.rs
src/librustc/middle/entry.rs
+2
-2
src/librustc/middle/reachable.rs
src/librustc/middle/reachable.rs
+1
-1
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+7
-6
src/librustc/middle/typeck/mod.rs
src/librustc/middle/typeck/mod.rs
+1
-1
未找到文件。
src/librustc/driver/driver.rs
浏览文件 @
d7b15270
...
...
@@ -166,7 +166,7 @@ pub fn phase_2_configure_and_expand(sess: Session,
mut
crate
:
ast
::
Crate
)
->
ast
::
Crate
{
let
time_passes
=
sess
.time_passes
();
*
sess
.building_library
=
session
::
building_library
(
sess
.opts
,
&
crate
);
sess
.building_library
.set
(
session
::
building_library
(
sess
.opts
,
&
crate
)
);
*
sess
.outputs
=
session
::
collect_outputs
(
sess
.opts
,
crate
.attrs
);
time
(
time_passes
,
"gated feature checking"
,
(),
|
_
|
...
...
@@ -878,7 +878,7 @@ pub fn build_session_(sopts: @session::options,
entry_type
:
Cell
::
new
(
None
),
span_diagnostic
:
span_diagnostic_handler
,
filesearch
:
filesearch
,
building_library
:
@
mut
false
,
building_library
:
Cell
::
new
(
false
)
,
working_dir
:
os
::
getcwd
(),
lints
:
RefCell
::
new
(
HashMap
::
new
()),
node_id
:
Cell
::
new
(
1
),
...
...
@@ -1039,7 +1039,7 @@ pub fn build_output_filenames(input: &input,
}
}
if
*
sess
.building_library
{
if
sess
.building_library
.get
()
{
out_path
=
dirpath
.join
(
os
::
dll_filename
(
stem
));
obj_path
=
{
let
mut
p
=
dirpath
.join
(
stem
);
...
...
@@ -1060,7 +1060,7 @@ pub fn build_output_filenames(input: &input,
out_file
.with_extension
(
obj_suffix
)
};
if
*
sess
.building_library
{
if
sess
.building_library
.get
()
{
sess
.warn
(
"ignoring specified output filename for library."
);
}
...
...
src/librustc/driver/session.rs
浏览文件 @
d7b15270
...
...
@@ -210,7 +210,7 @@ pub struct Session_ {
entry_type
:
Cell
<
Option
<
EntryFnType
>>
,
span_diagnostic
:
@
mut
diagnostic
::
span_handler
,
filesearch
:
@
filesearch
::
FileSearch
,
building_library
:
@
mut
bool
,
building_library
:
Cell
<
bool
>
,
working_dir
:
Path
,
lints
:
RefCell
<
HashMap
<
ast
::
NodeId
,
~
[(
lint
::
lint
,
codemap
::
Span
,
~
str
)]
>>
,
...
...
src/librustc/front/std_inject.rs
浏览文件 @
d7b15270
...
...
@@ -69,7 +69,7 @@ fn fold_crate(&self, crate: ast::Crate) -> ast::Crate {
span
:
dummy_sp
()
}];
if
use_uv
(
&
crate
)
&&
!
*
self
.sess.building_library
{
if
use_uv
(
&
crate
)
&&
!
self
.sess.building_library
.get
()
{
vis
.push
(
ast
::
view_item
{
node
:
ast
::
view_item_extern_mod
(
self
.sess
.ident_of
(
"green"
),
None
,
...
...
src/librustc/front/test.rs
浏览文件 @
d7b15270
...
...
@@ -127,7 +127,7 @@ fn fold_mod(&self, m: &ast::_mod) -> ast::_mod {
// the one we're going to add. Only if compiling an executable.
fn
nomain
(
cx
:
@
TestCtxt
,
item
:
@
ast
::
item
)
->
@
ast
::
item
{
if
!
*
cx
.sess.building_library
{
if
!
cx
.sess.building_library
.get
()
{
@
ast
::
item
{
attrs
:
item
.attrs
.iter
()
.filter_map
(|
attr
|
{
if
"main"
!=
attr
.name
()
{
...
...
src/librustc/middle/entry.rs
浏览文件 @
d7b15270
...
...
@@ -45,7 +45,7 @@ fn visit_item(&mut self, item:@item, _:()) {
}
pub
fn
find_entry_point
(
session
:
Session
,
crate
:
&
Crate
,
ast_map
:
ast_map
::
map
)
{
if
*
session
.building_library
{
if
session
.building_library
.get
()
{
// No need to find a main function
return
;
}
...
...
@@ -131,7 +131,7 @@ fn configure_main(this: &mut EntryContext) {
this
.session.entry_fn
.set
(
this
.main_fn
);
this
.session.entry_type
.set
(
Some
(
session
::
EntryMain
));
}
else
{
if
!
*
this
.session.building_library
{
if
!
this
.session.building_library
.get
()
{
// No main function
this
.session
.err
(
"main function not found"
);
if
!
this
.non_main_fns
.is_empty
()
{
...
...
src/librustc/middle/reachable.rs
浏览文件 @
d7b15270
...
...
@@ -303,7 +303,7 @@ fn propagate(&self) {
fn
propagate_node
(
&
self
,
node
:
&
ast_map
::
ast_node
,
search_item
:
ast
::
NodeId
,
visitor
:
&
mut
MarkSymbolVisitor
)
{
if
!
*
self
.tcx.sess.building_library
{
if
!
self
.tcx.sess.building_library
.get
()
{
// If we are building an executable, then there's no need to flag
// anything as external except for `extern fn` types. These
// functions may still participate in some form of native interface,
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
d7b15270
...
...
@@ -2344,7 +2344,7 @@ fn finish_register_fn(ccx: @CrateContext, sp: Span, sym: ~str, node_id: ast::Nod
}
}
if
is_entry_fn
(
&
ccx
.sess
,
node_id
)
&&
!
*
ccx
.sess.building_library
{
if
is_entry_fn
(
&
ccx
.sess
,
node_id
)
&&
!
ccx
.sess.building_library
.get
()
{
create_entry_wrapper
(
ccx
,
sp
,
llfn
);
}
}
...
...
@@ -2678,7 +2678,7 @@ pub fn get_item_val(ccx: @CrateContext, id: ast::NodeId) -> ValueRef {
// library then we've already declared the crate map
// so use that instead.
if
attr
::
contains_name
(
ni
.attrs
,
"crate_map"
)
{
if
*
ccx
.sess.building_library
{
if
ccx
.sess.building_library
.get
()
{
let
s
=
"_rust_crate_map_toplevel"
;
let
g
=
unsafe
{
s
.with_c_str
(|
buf
|
{
...
...
@@ -3044,7 +3044,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
let
mut
n_subcrates
=
1
;
let
cstore
=
sess
.cstore
;
while
cstore
.have_crate_data
(
n_subcrates
)
{
n_subcrates
+=
1
;
}
let
is_top
=
!
*
sess
.building_library
||
sess
.gen_crate_map
();
let
is_top
=
!
sess
.building_library
.get
()
||
sess
.gen_crate_map
();
let
sym_name
=
if
is_top
{
~
"_rust_crate_map_toplevel"
}
else
{
...
...
@@ -3154,7 +3154,9 @@ pub fn crate_ctxt_to_encode_parms<'r>(cx: &'r CrateContext, ie: encoder::encode_
pub
fn
write_metadata
(
cx
:
&
CrateContext
,
crate
:
&
ast
::
Crate
)
->
~
[
u8
]
{
use
extra
::
flate
;
if
!*
cx
.sess.building_library
{
return
~
[];
}
if
!
cx
.sess.building_library
.get
()
{
return
~
[]
}
let
encode_inlined_item
:
encoder
::
encode_inlined_item
=
|
ecx
,
ebml_w
,
path
,
ii
|
...
...
@@ -3227,8 +3229,7 @@ pub fn trans_crate(sess: session::Session,
// __rust_crate_map_toplevel symbol (extra underscore) which it will
// subsequently fail to find. So to mitigate that we just introduce
// an alias from the symbol it expects to the one that actually exists.
if
ccx
.sess.targ_cfg.os
==
OsWin32
&&
!*
ccx
.sess.building_library
{
if
ccx
.sess.targ_cfg.os
==
OsWin32
&&
!
ccx
.sess.building_library
.get
()
{
let
maptype
=
val_ty
(
ccx
.crate_map
)
.to_ref
();
...
...
src/librustc/middle/typeck/mod.rs
浏览文件 @
d7b15270
...
...
@@ -438,7 +438,7 @@ fn check_start_fn_ty(ccx: &CrateCtxt,
fn
check_for_entry_fn
(
ccx
:
&
CrateCtxt
)
{
let
tcx
=
ccx
.tcx
;
if
!
*
tcx
.sess.building_library
{
if
!
tcx
.sess.building_library
.get
()
{
match
tcx
.sess.entry_fn
.get
()
{
Some
((
id
,
sp
))
=>
match
tcx
.sess.entry_type
.get
()
{
Some
(
session
::
EntryMain
)
=>
check_main_fn_ty
(
ccx
,
id
,
sp
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录