Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
442a4744
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,发现更多精彩内容 >>
提交
442a4744
编写于
7月 26, 2018
作者:
M
Mark Rousskov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Normalize EntryFnType variants to standard style
上级
b3267dcb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
14 addition
and
14 deletion
+14
-14
src/librustc/middle/entry.rs
src/librustc/middle/entry.rs
+4
-3
src/librustc/session/config.rs
src/librustc/session/config.rs
+2
-3
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+3
-3
src/librustc_mir/monomorphize/collector.rs
src/librustc_mir/monomorphize/collector.rs
+1
-1
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+2
-2
src/librustc_typeck/lib.rs
src/librustc_typeck/lib.rs
+2
-2
未找到文件。
src/librustc/middle/entry.rs
浏览文件 @
442a4744
...
...
@@ -12,6 +12,7 @@
use
hir
::
map
as
hir_map
;
use
hir
::
def_id
::{
CRATE_DEF_INDEX
};
use
session
::{
config
,
Session
};
use
session
::
config
::
EntryFnType
;
use
syntax
::
ast
::
NodeId
;
use
syntax
::
attr
;
use
syntax
::
entry
::
EntryPointType
;
...
...
@@ -155,11 +156,11 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
fn
configure_main
(
this
:
&
mut
EntryContext
,
crate_name
:
&
str
)
{
if
let
Some
((
node_id
,
span
))
=
this
.start_fn
{
this
.session.entry_fn
.set
(
Some
((
node_id
,
span
,
config
::
Entry
Start
)));
this
.session.entry_fn
.set
(
Some
((
node_id
,
span
,
EntryFnType
::
Start
)));
}
else
if
let
Some
((
node_id
,
span
))
=
this
.attr_main_fn
{
this
.session.entry_fn
.set
(
Some
((
node_id
,
span
,
config
::
Entry
Main
)));
this
.session.entry_fn
.set
(
Some
((
node_id
,
span
,
EntryFnType
::
Main
)));
}
else
if
let
Some
((
node_id
,
span
))
=
this
.main_fn
{
this
.session.entry_fn
.set
(
Some
((
node_id
,
span
,
config
::
Entry
Main
)));
this
.session.entry_fn
.set
(
Some
((
node_id
,
span
,
EntryFnType
::
Main
)));
}
else
{
// No main function
this
.session.entry_fn
.set
(
None
);
...
...
src/librustc/session/config.rs
浏览文件 @
442a4744
...
...
@@ -11,7 +11,6 @@
//! Contains infrastructure for configuring the compiler, including parsing
//! command line options.
pub
use
self
::
EntryFnType
::
*
;
pub
use
self
::
DebugInfoLevel
::
*
;
use
std
::
str
::
FromStr
;
...
...
@@ -662,8 +661,8 @@ pub fn will_create_output_file(&self) -> bool {
// functions
#[derive(Copy,
Clone,
PartialEq)]
pub
enum
EntryFnType
{
Entry
Main
,
Entry
Start
,
Main
,
Start
,
}
#[derive(Copy,
PartialEq,
PartialOrd,
Clone,
Ord,
Eq,
Hash,
Debug)]
...
...
src/librustc_codegen_llvm/base.rs
浏览文件 @
442a4744
...
...
@@ -46,7 +46,7 @@
use
rustc
::
middle
::
exported_symbols
;
use
rustc
::
util
::
common
::{
time
,
print_time_passes_entry
};
use
rustc
::
util
::
profiling
::
ProfileCategory
;
use
rustc
::
session
::
config
::{
self
,
NoDebugInfo
};
use
rustc
::
session
::
config
::{
self
,
NoDebugInfo
,
EntryFnType
};
use
rustc
::
session
::
Session
;
use
rustc_incremental
;
use
allocator
;
...
...
@@ -560,8 +560,8 @@ fn maybe_create_entry_wrapper(cx: &CodegenCx) {
let
et
=
cx
.sess
()
.entry_fn
.get
()
.map
(|
e
|
e
.2
);
match
et
{
Some
(
config
::
Entry
Main
)
=>
create_entry_fn
(
cx
,
span
,
main_llfn
,
main_def_id
,
true
),
Some
(
config
::
Entry
Start
)
=>
create_entry_fn
(
cx
,
span
,
main_llfn
,
main_def_id
,
false
),
Some
(
EntryFnType
::
Main
)
=>
create_entry_fn
(
cx
,
span
,
main_llfn
,
main_def_id
,
true
),
Some
(
EntryFnType
::
Start
)
=>
create_entry_fn
(
cx
,
span
,
main_llfn
,
main_def_id
,
false
),
None
=>
{}
// Do nothing.
}
...
...
src/librustc_mir/monomorphize/collector.rs
浏览文件 @
442a4744
...
...
@@ -1047,7 +1047,7 @@ fn push_if_root(&mut self, def_id: DefId) {
/// the return type of `main`. This is not needed when
/// the user writes their own `start` manually.
fn
push_extra_entry_roots
(
&
mut
self
)
{
if
self
.tcx.sess.entry_fn
.get
()
.map
(|
e
|
e
.2
)
!=
Some
(
config
::
EntryMain
)
{
if
self
.tcx.sess.entry_fn
.get
()
.map
(|
e
|
e
.2
)
!=
Some
(
config
::
Entry
FnType
::
Main
)
{
return
}
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
442a4744
...
...
@@ -1111,7 +1111,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
if
let
Some
((
id
,
_
,
entry_type
))
=
*
fcx
.tcx.sess.entry_fn
.borrow
()
{
if
id
==
fn_id
{
match
entry_type
{
config
::
EntryMain
=>
{
config
::
Entry
FnType
::
Main
=>
{
let
substs
=
fcx
.tcx
.mk_substs_trait
(
declared_ret_ty
,
&
[]);
let
trait_ref
=
ty
::
TraitRef
::
new
(
term_id
,
substs
);
let
return_ty_span
=
decl
.output
.span
();
...
...
@@ -1122,7 +1122,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
traits
::
Obligation
::
new
(
cause
,
param_env
,
trait_ref
.to_predicate
()));
},
config
::
EntryStart
=>
{},
config
::
Entry
FnType
::
Start
=>
{},
}
}
}
...
...
src/librustc_typeck/lib.rs
浏览文件 @
442a4744
...
...
@@ -318,8 +318,8 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
fn
check_for_entry_fn
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
{
if
let
Some
((
id
,
sp
,
entry_type
))
=
*
tcx
.sess.entry_fn
.borrow
()
{
match
entry_type
{
config
::
EntryMain
=>
check_main_fn_ty
(
tcx
,
id
,
sp
),
config
::
EntryStart
=>
check_start_fn_ty
(
tcx
,
id
,
sp
),
config
::
Entry
FnType
::
Main
=>
check_main_fn_ty
(
tcx
,
id
,
sp
),
config
::
Entry
FnType
::
Start
=>
check_start_fn_ty
(
tcx
,
id
,
sp
),
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录