Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f0a8b6d4
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,发现更多精彩内容 >>
提交
f0a8b6d4
编写于
8月 02, 2016
作者:
A
Andrew Cann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor fixups based on
@EddyB
's feedback
Mainly, remove mk_empty() method and replace with tcx.types.empty
上级
5096a8c5
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
30 addition
and
33 deletion
+30
-33
src/libcore/cmp.rs
src/libcore/cmp.rs
+2
-2
src/libcore/fmt/mod.rs
src/libcore/fmt/mod.rs
+2
-2
src/libcore/lib.rs
src/libcore/lib.rs
+2
-0
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+2
-2
src/librustc/ty/adjustment.rs
src/librustc/ty/adjustment.rs
+1
-1
src/librustc/ty/context.rs
src/librustc/ty/context.rs
+0
-4
src/librustc_mir/build/expr/into.rs
src/librustc_mir/build/expr/into.rs
+1
-2
src/librustc_mir/build/mod.rs
src/librustc_mir/build/mod.rs
+3
-3
src/librustc_trans/common.rs
src/librustc_trans/common.rs
+1
-1
src/librustc_trans/intrinsic.rs
src/librustc_trans/intrinsic.rs
+1
-1
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+1
-1
src/librustc_typeck/check/intrinsic.rs
src/librustc_typeck/check/intrinsic.rs
+3
-3
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+10
-10
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/check/wfcheck.rs
+1
-1
未找到文件。
src/libcore/cmp.rs
浏览文件 @
f0a8b6d4
...
...
@@ -701,7 +701,7 @@ fn cmp(&self, other: &bool) -> Ordering {
// Note: This macro is a temporary hack that can be remove once we are building with a compiler
// that supports `!`
macro_rules!
argh
{
macro_rules!
not_stage0
{
()
=>
{
#[unstable(feature
=
"bang_type"
,
issue
=
"35121"
)]
impl
PartialEq
for
!
{
...
...
@@ -730,7 +730,7 @@ fn cmp(&self, _: &!) -> Ordering {
}
#[cfg(not(stage0))]
argh
!
();
not_stage0
!
();
// & pointers
...
...
src/libcore/fmt/mod.rs
浏览文件 @
f0a8b6d4
...
...
@@ -1365,7 +1365,7 @@ fn fmt(&self, f: &mut Formatter) -> Result { $tr::fmt(&**self, f) }
// Note: This macro is a temporary hack that can be remove once we are building with a compiler
// that supports `!`
macro_rules!
argh
{
macro_rules!
not_stage0
{
()
=>
{
#[unstable(feature
=
"bang_type"
,
issue
=
"35121"
)]
impl
Debug
for
!
{
...
...
@@ -1384,7 +1384,7 @@ fn fmt(&self, _: &mut Formatter) -> Result {
}
#[cfg(not(stage0))]
argh
!
();
not_stage0
!
();
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
impl
Debug
for
bool
{
...
...
src/libcore/lib.rs
浏览文件 @
f0a8b6d4
...
...
@@ -87,6 +87,8 @@
#![feature(staged_api)]
#![feature(unboxed_closures)]
#![feature(question_mark)]
// NOTE: remove the cfg_attr next snapshot
#![cfg_attr(not(stage0),
feature(bang_type))]
#[macro_use]
...
...
src/librustc/middle/liveness.rs
浏览文件 @
f0a8b6d4
...
...
@@ -112,7 +112,7 @@
use
dep_graph
::
DepNode
;
use
hir
::
def
::
*
;
use
hir
::
pat_util
;
use
ty
::{
self
,
TyCtxt
,
ParameterEnvironment
};
use
ty
::{
self
,
Ty
,
Ty
Ctxt
,
ParameterEnvironment
};
use
traits
::{
self
,
Reveal
};
use
ty
::
subst
::
Subst
;
use
lint
;
...
...
@@ -1454,7 +1454,7 @@ fn check_fn(_v: &Liveness,
}
impl
<
'a
,
'tcx
>
Liveness
<
'a
,
'tcx
>
{
fn
fn_ret
(
&
self
,
id
:
NodeId
)
->
ty
::
Binder
<
ty
::
Ty
<
'tcx
>>
{
fn
fn_ret
(
&
self
,
id
:
NodeId
)
->
ty
::
Binder
<
Ty
<
'tcx
>>
{
let
fn_ty
=
self
.ir.tcx
.node_id_to_type
(
id
);
match
fn_ty
.sty
{
ty
::
TyClosure
(
closure_def_id
,
substs
)
=>
...
...
src/librustc/ty/adjustment.rs
浏览文件 @
f0a8b6d4
...
...
@@ -107,7 +107,7 @@ pub struct AutoDerefRef<'tcx> {
impl
<
'tcx
>
AutoAdjustment
<
'tcx
>
{
pub
fn
is_identity
(
&
self
)
->
bool
{
match
*
self
{
AdjustEmptyToAny
(
ref
ty
)
=>
match
ty
.sty
{
AdjustEmptyToAny
(
ty
)
=>
match
ty
.sty
{
TypeVariants
::
TyEmpty
=>
true
,
_
=>
false
,
},
...
...
src/librustc/ty/context.rs
浏览文件 @
f0a8b6d4
...
...
@@ -1258,10 +1258,6 @@ pub fn mk_slice(self, ty: Ty<'tcx>) -> Ty<'tcx> {
self
.mk_ty
(
TySlice
(
ty
))
}
pub
fn
mk_empty
(
&
self
)
->
Ty
<
'tcx
>
{
self
.mk_ty
(
TyEmpty
)
}
pub
fn
mk_tup
(
self
,
ts
:
Vec
<
Ty
<
'tcx
>>
)
->
Ty
<
'tcx
>
{
self
.mk_ty
(
TyTuple
(
self
.mk_type_list
(
ts
)))
}
...
...
src/librustc_mir/build/expr/into.rs
浏览文件 @
f0a8b6d4
...
...
@@ -58,8 +58,7 @@ pub fn into_expr(&mut self,
// unreachable block. Don't bother to terminate it and create a new one.
if
is_call
{
block
.unit
()
}
else
{
}
else
{
this
.cfg
.terminate
(
block
,
source_info
,
TerminatorKind
::
Unreachable
);
let
end_block
=
this
.cfg
.start_new_block
();
end_block
.unit
()
...
...
src/librustc_mir/build/mod.rs
浏览文件 @
f0a8b6d4
...
...
@@ -162,7 +162,7 @@ fn unit(self) -> BlockAnd<()> {
pub
fn
construct_fn
<
'a
,
'gcx
,
'tcx
,
A
>
(
hir
:
Cx
<
'a
,
'gcx
,
'tcx
>
,
fn_id
:
ast
::
NodeId
,
arguments
:
A
,
return_ty
:
ty
::
Ty
<
'gcx
>
,
return_ty
:
Ty
<
'gcx
>
,
ast_block
:
&
'gcx
hir
::
Block
)
->
(
Mir
<
'tcx
>
,
ScopeAuxiliaryVec
)
where
A
:
Iterator
<
Item
=
(
Ty
<
'gcx
>
,
Option
<&
'gcx
hir
::
Pat
>
)
>
...
...
@@ -287,7 +287,7 @@ fn new(hir: Cx<'a, 'gcx, 'tcx>, span: Span) -> Builder<'a, 'gcx, 'tcx> {
fn
finish
(
self
,
upvar_decls
:
Vec
<
UpvarDecl
>
,
arg_decls
:
IndexVec
<
Arg
,
ArgDecl
<
'tcx
>>
,
return_ty
:
ty
::
Ty
<
'tcx
>
)
return_ty
:
Ty
<
'tcx
>
)
->
(
Mir
<
'tcx
>
,
ScopeAuxiliaryVec
)
{
for
(
index
,
block
)
in
self
.cfg.basic_blocks
.iter
()
.enumerate
()
{
if
block
.terminator
.is_none
()
{
...
...
@@ -309,7 +309,7 @@ fn finish(self,
fn
args_and_body
<
A
>
(
&
mut
self
,
mut
block
:
BasicBlock
,
return_ty
:
ty
::
Ty
<
'tcx
>
,
return_ty
:
Ty
<
'tcx
>
,
arguments
:
A
,
argument_extent
:
CodeExtent
,
ast_block
:
&
'gcx
hir
::
Block
)
...
...
src/librustc_trans/common.rs
浏览文件 @
f0a8b6d4
...
...
@@ -558,7 +558,7 @@ pub fn eh_unwind_resume(&self) -> Callee<'tcx> {
abi
:
Abi
::
C
,
sig
:
ty
::
Binder
(
ty
::
FnSig
{
inputs
:
vec!
[
tcx
.mk_mut_ptr
(
tcx
.types.u8
)],
output
:
tcx
.
mk_empty
()
,
output
:
tcx
.
types.empty
,
variadic
:
false
}),
}));
...
...
src/librustc_trans/intrinsic.rs
浏览文件 @
f0a8b6d4
...
...
@@ -1221,7 +1221,7 @@ fn trans_gnu_try<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
fn
gen_fn
<
'a
,
'tcx
>
(
fcx
:
&
FunctionContext
<
'a
,
'tcx
>
,
name
:
&
str
,
inputs
:
Vec
<
Ty
<
'tcx
>>
,
output
:
ty
::
Ty
<
'tcx
>
,
output
:
Ty
<
'tcx
>
,
trans
:
&
mut
for
<
'b
>
FnMut
(
Block
<
'b
,
'tcx
>
))
->
ValueRef
{
let
ccx
=
fcx
.ccx
;
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
f0a8b6d4
...
...
@@ -1701,7 +1701,7 @@ pub fn ast_ty_to_ty(&self, rscope: &RegionScope, ast_ty: &hir::Ty) -> Ty<'tcx> {
tcx
.mk_ref
(
tcx
.mk_region
(
r
),
ty
::
TypeAndMut
{
ty
:
t
,
mutbl
:
mt
.mutbl
})
}
hir
::
TyEmpty
=>
{
tcx
.
mk_empty
()
tcx
.
types.empty
},
hir
::
TyTup
(
ref
fields
)
=>
{
let
flds
=
fields
.iter
()
...
...
src/librustc_typeck/check/intrinsic.rs
浏览文件 @
f0a8b6d4
...
...
@@ -30,8 +30,8 @@ fn equate_intrinsic_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
it
:
&
hir
::
ForeignItem
,
n_tps
:
usize
,
abi
:
Abi
,
inputs
:
Vec
<
ty
::
Ty
<
'tcx
>>
,
output
:
ty
::
Ty
<
'tcx
>
)
{
inputs
:
Vec
<
Ty
<
'tcx
>>
,
output
:
Ty
<
'tcx
>
)
{
let
tcx
=
ccx
.tcx
;
let
def_id
=
tcx
.map
.local_def_id
(
it
.id
);
let
i_ty
=
tcx
.lookup_item_type
(
def_id
);
...
...
@@ -106,7 +106,7 @@ fn param<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, n: u32) -> Ty<'tcx> {
};
(
n_tps
,
inputs
,
output
)
}
else
if
&
name
[
..
]
==
"abort"
||
&
name
[
..
]
==
"unreachable"
{
(
0
,
Vec
::
new
(),
tcx
.
mk_empty
()
)
(
0
,
Vec
::
new
(),
tcx
.
types.empty
)
}
else
{
let
(
n_tps
,
inputs
,
output
)
=
match
&
name
[
..
]
{
"breakpoint"
=>
(
0
,
Vec
::
new
(),
tcx
.mk_nil
()),
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
f0a8b6d4
...
...
@@ -372,7 +372,7 @@ pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
// expects the types within the function to be consistent.
err_count_on_creation
:
usize
,
ret_ty
:
ty
::
Ty
<
'tcx
>
,
ret_ty
:
Ty
<
'tcx
>
,
ps
:
RefCell
<
UnsafetyState
>
,
...
...
@@ -1457,7 +1457,7 @@ enum TupleArgumentsFlag {
impl
<
'a
,
'gcx
,
'tcx
>
FnCtxt
<
'a
,
'gcx
,
'tcx
>
{
pub
fn
new
(
inh
:
&
'a
Inherited
<
'a
,
'gcx
,
'tcx
>
,
rty
:
ty
::
Ty
<
'tcx
>
,
rty
:
Ty
<
'tcx
>
,
body_id
:
ast
::
NodeId
)
->
FnCtxt
<
'a
,
'gcx
,
'tcx
>
{
FnCtxt
{
...
...
@@ -1733,7 +1733,7 @@ pub fn write_nil(&self, node_id: ast::NodeId) {
}
pub
fn
write_empty
(
&
self
,
node_id
:
ast
::
NodeId
)
{
self
.write_ty_expr
(
node_id
,
self
.tcx
.
mk_empty
()
);
self
.write_ty_expr
(
node_id
,
self
.tcx.
types.empty
);
}
pub
fn
write_error
(
&
self
,
node_id
:
ast
::
NodeId
)
{
...
...
@@ -1977,7 +1977,7 @@ fn default_type_parameters(&self) {
if
self
.type_var_diverges
(
resolved
)
{
debug!
(
"default_type_parameters: defaulting `{:?}` to `!` because it diverges"
,
resolved
);
self
.demand_eqtype
(
syntax_pos
::
DUMMY_SP
,
*
ty
,
self
.tcx
.
mk_empty
()
);
self
.demand_eqtype
(
syntax_pos
::
DUMMY_SP
,
*
ty
,
self
.tcx.
types.empty
);
}
else
{
match
self
.type_is_unconstrained_numeric
(
resolved
)
{
UnconstrainedInt
=>
{
...
...
@@ -2051,7 +2051,7 @@ fn new_select_all_obligations_and_apply_defaults(&self) {
for
ty
in
&
unsolved_variables
{
let
resolved
=
self
.resolve_type_vars_if_possible
(
ty
);
if
self
.type_var_diverges
(
resolved
)
{
self
.demand_eqtype
(
syntax_pos
::
DUMMY_SP
,
*
ty
,
self
.tcx
.
mk_empty
()
);
self
.demand_eqtype
(
syntax_pos
::
DUMMY_SP
,
*
ty
,
self
.tcx.
types.empty
);
}
else
{
match
self
.type_is_unconstrained_numeric
(
resolved
)
{
UnconstrainedInt
|
UnconstrainedFloat
=>
{
...
...
@@ -2109,7 +2109,7 @@ fn new_select_all_obligations_and_apply_defaults(&self) {
let
_
=
self
.commit_if_ok
(|
_
:
&
infer
::
CombinedSnapshot
|
{
for
ty
in
&
unbound_tyvars
{
if
self
.type_var_diverges
(
ty
)
{
self
.demand_eqtype
(
syntax_pos
::
DUMMY_SP
,
*
ty
,
self
.tcx
.
mk_empty
()
);
self
.demand_eqtype
(
syntax_pos
::
DUMMY_SP
,
*
ty
,
self
.tcx.
types.empty
);
}
else
{
match
self
.type_is_unconstrained_numeric
(
ty
)
{
UnconstrainedInt
=>
{
...
...
@@ -2205,7 +2205,7 @@ fn find_conflicting_default(&self,
// reporting for more then one conflict.
for
ty
in
&
unbound_tyvars
{
if
self
.type_var_diverges
(
ty
)
{
self
.demand_eqtype
(
syntax_pos
::
DUMMY_SP
,
*
ty
,
self
.tcx
.
mk_empty
()
);
self
.demand_eqtype
(
syntax_pos
::
DUMMY_SP
,
*
ty
,
self
.tcx.
types.empty
);
}
else
{
match
self
.type_is_unconstrained_numeric
(
ty
)
{
UnconstrainedInt
=>
{
...
...
@@ -2409,7 +2409,7 @@ fn check_method_argument_types(&self,
args_no_rcvr
:
&
'gcx
[
P
<
hir
::
Expr
>
],
tuple_arguments
:
TupleArgumentsFlag
,
expected
:
Expectation
<
'tcx
>
)
->
ty
::
Ty
<
'tcx
>
{
->
Ty
<
'tcx
>
{
if
method_fn_ty
.references_error
()
{
let
err_inputs
=
self
.err_args
(
args_no_rcvr
.len
());
...
...
@@ -2680,7 +2680,7 @@ fn err_args(&self, len: usize) -> Vec<Ty<'tcx>> {
fn
write_call
(
&
self
,
call_expr
:
&
hir
::
Expr
,
output
:
ty
::
Ty
<
'tcx
>
)
{
output
:
Ty
<
'tcx
>
)
{
self
.write_ty_expr
(
call_expr
.id
,
output
);
}
...
...
@@ -2804,7 +2804,7 @@ pub fn impl_self_ty(&self,
fn
expected_types_for_fn_args
(
&
self
,
call_span
:
Span
,
expected_ret
:
Expectation
<
'tcx
>
,
formal_ret
:
ty
::
Ty
<
'tcx
>
,
formal_ret
:
Ty
<
'tcx
>
,
formal_args
:
&
[
Ty
<
'tcx
>
])
->
Vec
<
Ty
<
'tcx
>>
{
let
expected_args
=
expected_ret
.only_has_type
(
self
)
.and_then
(|
ret_ty
|
{
...
...
src/librustc_typeck/check/wfcheck.rs
浏览文件 @
f0a8b6d4
...
...
@@ -51,7 +51,7 @@ fn with_fcx<F>(&'tcx mut self, f: F) where
let
id
=
self
.id
;
let
span
=
self
.span
;
self
.inherited
.enter
(|
inh
|
{
let
fcx
=
FnCtxt
::
new
(
&
inh
,
inh
.ccx.tcx
.
mk_empty
()
,
id
);
let
fcx
=
FnCtxt
::
new
(
&
inh
,
inh
.ccx.tcx.
types.empty
,
id
);
let
wf_tys
=
f
(
&
fcx
,
&
mut
CheckTypeWellFormedVisitor
{
ccx
:
fcx
.ccx
,
code
:
code
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录