Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
08d6774f
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
08d6774f
编写于
11月 04, 2014
作者:
N
Niko Matsakis
提交者:
Jakub Bukaj
11月 16, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Try to remove ty_nil, some kind of error in exhaustiveness checking
上级
0c7a3d6c
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
76 addition
and
114 deletion
+76
-114
src/librustc/lint/builtin.rs
src/librustc/lint/builtin.rs
+1
-1
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tydecode.rs
+0
-1
src/librustc/metadata/tyencode.rs
src/librustc/metadata/tyencode.rs
+0
-1
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+3
-3
src/librustc/middle/traits/coherence.rs
src/librustc/middle/traits/coherence.rs
+0
-1
src/librustc/middle/traits/select.rs
src/librustc/middle/traits/select.rs
+0
-1
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/_match.rs
+1
-1
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+6
-16
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/callee.rs
+1
-3
src/librustc/middle/trans/context.rs
src/librustc/middle/trans/context.rs
+3
-3
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/debuginfo.rs
+4
-5
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/foreign.rs
+1
-1
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/glue.rs
+7
-6
src/librustc/middle/trans/meth.rs
src/librustc/middle/trans/meth.rs
+0
-1
src/librustc/middle/trans/type_of.rs
src/librustc/middle/trans/type_of.rs
+5
-3
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+16
-24
src/librustc/middle/ty_fold.rs
src/librustc/middle/ty_fold.rs
+1
-1
src/librustc/middle/typeck/astconv.rs
src/librustc/middle/typeck/astconv.rs
+2
-2
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/method.rs
+1
-1
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+19
-30
src/librustc/middle/typeck/check/regionmanip.rs
src/librustc/middle/typeck/check/regionmanip.rs
+0
-1
src/librustc/middle/typeck/coherence/mod.rs
src/librustc/middle/typeck/coherence/mod.rs
+2
-2
src/librustc/middle/typeck/infer/combine.rs
src/librustc/middle/typeck/infer/combine.rs
+0
-1
src/librustc/middle/typeck/infer/skolemize.rs
src/librustc/middle/typeck/infer/skolemize.rs
+0
-1
src/librustc/middle/typeck/mod.rs
src/librustc/middle/typeck/mod.rs
+1
-1
src/librustc/middle/typeck/variance.rs
src/librustc/middle/typeck/variance.rs
+1
-1
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+1
-2
未找到文件。
src/librustc/lint/builtin.rs
浏览文件 @
08d6774f
...
...
@@ -735,7 +735,7 @@ fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) {
let
t
=
ty
::
expr_ty
(
cx
.tcx
,
expr
);
let
mut
warned
=
false
;
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_
nil
|
ty
::
ty_
bool
=>
return
,
ty
::
ty_bool
=>
return
,
ty
::
ty_struct
(
did
,
_
)
|
ty
::
ty_enum
(
did
,
_
)
=>
{
if
ast_util
::
is_local
(
did
)
{
...
...
src/librustc/metadata/tydecode.rs
浏览文件 @
08d6774f
...
...
@@ -360,7 +360,6 @@ fn parse_trait_ref(st: &mut PState, conv: conv_did) -> ty::TraitRef {
fn
parse_ty
(
st
:
&
mut
PState
,
conv
:
conv_did
)
->
ty
::
t
{
match
next
(
st
)
{
'n'
=>
return
ty
::
mk_nil
(),
'b'
=>
return
ty
::
mk_bool
(),
'i'
=>
return
ty
::
mk_int
(),
'u'
=>
return
ty
::
mk_uint
(),
...
...
src/librustc/metadata/tyencode.rs
浏览文件 @
08d6774f
...
...
@@ -199,7 +199,6 @@ pub fn enc_trait_store(w: &mut SeekableMemWriter, cx: &ctxt, s: ty::TraitStore)
fn
enc_sty
(
w
:
&
mut
SeekableMemWriter
,
cx
:
&
ctxt
,
st
:
&
ty
::
sty
)
{
match
*
st
{
ty
::
ty_nil
=>
mywrite!
(
w
,
"n"
),
ty
::
ty_bool
=>
mywrite!
(
w
,
"b"
),
ty
::
ty_char
=>
mywrite!
(
w
,
"c"
),
ty
::
ty_int
(
t
)
=>
{
...
...
src/librustc/middle/check_match.rs
浏览文件 @
08d6774f
...
...
@@ -402,7 +402,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
let
pats_len
=
pats
.len
();
let
mut
pats
=
pats
.into_iter
()
.map
(|
p
|
P
((
*
p
)
.clone
()));
let
pat
=
match
ty
::
get
(
left_ty
)
.sty
{
ty
::
ty_tup
(
_
)
=>
PatTup
(
pats
.collect
()),
ty
::
ty_tup
(
ref
tys
)
if
!
tys
.is_empty
(
)
=>
PatTup
(
pats
.collect
()),
ty
::
ty_enum
(
cid
,
_
)
|
ty
::
ty_struct
(
cid
,
_
)
=>
{
let
(
vid
,
is_structure
)
=
match
ctor
{
...
...
@@ -497,7 +497,7 @@ fn all_constructors(cx: &MatchCheckCtxt, left_ty: ty::t,
ty
::
ty_bool
=>
[
true
,
false
]
.iter
()
.map
(|
b
|
ConstantValue
(
const_bool
(
*
b
)))
.collect
(),
ty
::
ty_
nil
=>
ty
::
ty_
tup
(
ref
tys
)
if
tys
.is_empty
()
=>
vec!
(
ConstantValue
(
const_nil
)),
ty
::
ty_rptr
(
_
,
ty
::
mt
{
ty
,
..
})
=>
match
ty
::
get
(
ty
)
.sty
{
...
...
@@ -552,7 +552,7 @@ fn is_useful(cx: &MatchCheckCtxt,
None
=>
v
[
0
]
};
let
left_ty
=
if
real_pat
.id
==
DUMMY_NODE_ID
{
ty
::
mk_nil
()
ty
::
mk_nil
(
cx
.tcx
)
}
else
{
ty
::
pat_ty
(
cx
.tcx
,
&*
real_pat
)
};
...
...
src/librustc/middle/traits/coherence.rs
浏览文件 @
08d6774f
...
...
@@ -79,7 +79,6 @@ pub fn ty_is_local(tcx: &ty::ctxt,
debug!
(
"ty_is_local({})"
,
ty
.repr
(
tcx
));
match
ty
::
get
(
ty
)
.sty
{
ty
::
ty_nil
|
ty
::
ty_bool
|
ty
::
ty_char
|
ty
::
ty_int
(
..
)
|
...
...
src/librustc/middle/traits/select.rs
浏览文件 @
08d6774f
...
...
@@ -1227,7 +1227,6 @@ fn builtin_bound(&mut self,
ty
::
ty_infer
(
ty
::
FloatVar
(
_
))
|
ty
::
ty_uint
(
_
)
|
ty
::
ty_int
(
_
)
|
ty
::
ty_nil
|
ty
::
ty_bool
|
ty
::
ty_float
(
_
)
|
ty
::
ty_bare_fn
(
_
)
|
...
...
src/librustc/middle/trans/_match.rs
浏览文件 @
08d6774f
...
...
@@ -1012,7 +1012,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
.unwrap_or
(
DUMMY_NODE_ID
);
let
left_ty
=
if
pat_id
==
DUMMY_NODE_ID
{
ty
::
mk_nil
()
ty
::
mk_nil
(
tcx
)
}
else
{
node_id_type
(
bcx
,
pat_id
)
};
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
08d6774f
...
...
@@ -47,7 +47,7 @@
use
middle
::
trans
::
callee
;
use
middle
::
trans
::
cleanup
::{
CleanupMethods
,
ScopeId
};
use
middle
::
trans
::
cleanup
;
use
middle
::
trans
::
common
::{
Block
,
C_bool
,
C_bytes_in_context
,
C_i32
,
C_integral
,
C_nil
};
use
middle
::
trans
::
common
::{
Block
,
C_bool
,
C_bytes_in_context
,
C_i32
,
C_integral
};
use
middle
::
trans
::
common
::{
C_null
,
C_struct_in_context
,
C_u64
,
C_u8
,
C_uint
,
C_undef
};
use
middle
::
trans
::
common
::{
CrateContext
,
ExternMap
,
FunctionContext
};
use
middle
::
trans
::
common
::{
NodeInfo
,
Result
,
SubstP
};
...
...
@@ -517,7 +517,7 @@ pub fn get_res_dtor(ccx: &CrateContext,
let
class_ty
=
ty
::
lookup_item_type
(
tcx
,
parent_id
)
.ty
.subst
(
tcx
,
substs
);
let
llty
=
type_of_dtor
(
ccx
,
class_ty
);
let
dtor_ty
=
ty
::
mk_ctor_fn
(
ccx
.tcx
(),
ast
::
DUMMY_NODE_ID
,
[
glue
::
get_drop_glue_type
(
ccx
,
t
)],
ty
::
mk_nil
());
[
glue
::
get_drop_glue_type
(
ccx
,
t
)],
ty
::
mk_nil
(
ccx
.tcx
()
));
get_extern_fn
(
ccx
,
&
mut
*
ccx
.externs
()
.borrow_mut
(),
name
.as_slice
(),
...
...
@@ -551,7 +551,7 @@ pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
let
f
=
|
a
|
Result
::
new
(
cx
,
compare_scalar_values
(
cx
,
lhs
,
rhs
,
a
,
op
));
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_
nil
=>
f
(
nil_type
),
ty
::
ty_
tup
(
ref
tys
)
if
tys
.is_empty
()
=>
f
(
nil_type
),
ty
::
ty_bool
|
ty
::
ty_uint
(
_
)
|
ty
::
ty_char
=>
f
(
unsigned_int
),
ty
::
ty_ptr
(
mt
)
if
ty
::
type_is_sized
(
cx
.tcx
(),
mt
.ty
)
=>
f
(
unsigned_int
),
ty
::
ty_int
(
_
)
=>
f
(
signed_int
),
...
...
@@ -1578,12 +1578,6 @@ fn create_datums_for_fn_args_under_call_abi(
"argtuple"
));
result
.push
(
tuple
);
}
ty
::
ty_nil
=>
{
let
mode
=
datum
::
Rvalue
::
new
(
datum
::
ByValue
);
result
.push
(
datum
::
Datum
::
new
(
C_nil
(
bcx
.ccx
()),
ty
::
mk_nil
(),
mode
))
}
_
=>
{
bcx
.tcx
()
.sess
.bug
(
"last argument of a function with
\
`rust-call` ABI isn't a tuple?!"
)
...
...
@@ -1647,10 +1641,8 @@ fn copy_unboxed_closure_args_to_allocas<'blk, 'tcx>(
arg_datum
.to_lvalue_datum_in_scope
(
bcx
,
"argtuple"
,
arg_scope_id
));
let
empty
=
Vec
::
new
();
let
untupled_arg_types
=
match
ty
::
get
(
monomorphized_arg_types
[
0
])
.sty
{
ty
::
ty_tup
(
ref
types
)
=>
types
.as_slice
(),
ty
::
ty_nil
=>
empty
.as_slice
(),
_
=>
{
bcx
.tcx
()
.sess
.span_bug
(
args
[
0
]
.pat.span
,
"first arg to `rust-call` ABI function
\
...
...
@@ -1824,7 +1816,7 @@ pub fn trans_closure(ccx: &CrateContext,
NotUnboxedClosure
=>
monomorphized_arg_types
,
// Tuple up closure argument types for the "rust-call" ABI.
IsUnboxedClosure
=>
vec!
[
ty
::
mk_tup
_or_nil
(
ccx
.tcx
(),
monomorphized_arg_types
)]
IsUnboxedClosure
=>
vec!
[
ty
::
mk_tup
(
ccx
.tcx
(),
monomorphized_arg_types
)]
};
for
monomorphized_arg_type
in
monomorphized_arg_types
.iter
()
{
debug!
(
"trans_closure: monomorphized_arg_type: {}"
,
...
...
@@ -2380,7 +2372,6 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t)
assert
!
(
abi
==
RustCall
);
match
ty
::
get
(
fn_sig
.inputs
[
0
])
.sty
{
ty
::
ty_nil
=>
Vec
::
new
(),
ty
::
ty_tup
(
ref
inputs
)
=>
inputs
.clone
(),
_
=>
ccx
.sess
()
.bug
(
"expected tuple'd inputs"
)
}
...
...
@@ -2389,7 +2380,6 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t)
let
mut
inputs
=
vec!
[
fn_sig
.inputs
[
0
]];
match
ty
::
get
(
fn_sig
.inputs
[
1
])
.sty
{
ty
::
ty_nil
=>
inputs
,
ty
::
ty_tup
(
ref
t_in
)
=>
{
inputs
.push_all
(
t_in
.as_slice
());
inputs
...
...
@@ -2532,7 +2522,7 @@ pub fn register_fn_llvmty(ccx: &CrateContext,
llfty
:
Type
)
->
ValueRef
{
debug!
(
"register_fn_llvmty id={} sym={}"
,
node_id
,
sym
);
let
llfn
=
decl_fn
(
ccx
,
sym
.as_slice
(),
cc
,
llfty
,
ty
::
FnConverging
(
ty
::
mk_nil
()));
let
llfn
=
decl_fn
(
ccx
,
sym
.as_slice
(),
cc
,
llfty
,
ty
::
FnConverging
(
ty
::
mk_nil
(
ccx
.tcx
()
)));
finish_register_fn
(
ccx
,
sp
,
sym
,
node_id
,
llfn
);
llfn
}
...
...
@@ -2564,7 +2554,7 @@ fn create_entry_fn(ccx: &CrateContext,
let
llfty
=
Type
::
func
([
ccx
.int_type
(),
Type
::
i8p
(
ccx
)
.ptr_to
()],
&
ccx
.int_type
());
let
llfn
=
decl_cdecl_fn
(
ccx
,
"main"
,
llfty
,
ty
::
mk_nil
());
let
llfn
=
decl_cdecl_fn
(
ccx
,
"main"
,
llfty
,
ty
::
mk_nil
(
ccx
.tcx
()
));
// FIXME: #16581: Marking a symbol in the executable with `dllexport`
// linkage forces MinGW's linker to output a `.reloc` section for ASLR
...
...
src/librustc/middle/trans/callee.rs
浏览文件 @
08d6774f
...
...
@@ -764,7 +764,7 @@ pub fn trans_call_inner<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
expr
::
Ignore
=>
{
let
ret_ty
=
match
ret_ty
{
ty
::
FnConverging
(
ret_ty
)
=>
ret_ty
,
ty
::
FnDiverging
=>
ty
::
mk_nil
()
ty
::
FnDiverging
=>
ty
::
mk_nil
(
ccx
.tcx
()
)
};
if
!
is_rust_fn
||
type_of
::
return_uses_outptr
(
ccx
,
ret_ty
)
||
...
...
@@ -957,7 +957,6 @@ fn trans_args_under_call_abi<'blk, 'tcx>(
llargs
.push
(
arg_datum
.add_clean
(
bcx
.fcx
,
arg_cleanup_scope
));
}
}
ty
::
ty_nil
=>
{}
_
=>
{
bcx
.sess
()
.span_bug
(
tuple_expr
.span
,
"argument to `.call()` wasn't a tuple?!"
)
...
...
@@ -1004,7 +1003,6 @@ fn trans_overloaded_call_args<'blk, 'tcx>(
}))
}
}
ty
::
ty_nil
=>
{}
_
=>
{
bcx
.sess
()
.span_bug
(
arg_exprs
[
0
]
.span
,
"argument to `.call()` wasn't a tuple?!"
)
...
...
src/librustc/middle/trans/context.rs
浏览文件 @
08d6774f
...
...
@@ -718,7 +718,7 @@ fn declare_intrinsic(ccx: &CrateContext, key: & &'static str) -> Option<ValueRef
macro_rules!
ifn
(
(
$name:expr
fn
()
->
$ret:expr
)
=>
(
if
*
key
==
$name
{
let
f
=
base
::
decl_cdecl_fn
(
ccx
,
$name
,
Type
::
func
([],
&
$ret
),
ty
::
mk_nil
());
let
f
=
base
::
decl_cdecl_fn
(
ccx
,
$name
,
Type
::
func
([],
&
$ret
),
ty
::
mk_nil
(
ccx
.tcx
()
));
ccx
.intrinsics
()
.borrow_mut
()
.insert
(
$name
,
f
.clone
());
return
Some
(
f
);
}
...
...
@@ -726,7 +726,7 @@ fn declare_intrinsic(ccx: &CrateContext, key: & &'static str) -> Option<ValueRef
(
$name:expr
fn
(
$
(
$arg:expr
),
*
)
->
$ret:expr
)
=>
(
if
*
key
==
$name
{
let
f
=
base
::
decl_cdecl_fn
(
ccx
,
$name
,
Type
::
func
([
$
(
$arg
),
*
],
&
$ret
),
ty
::
mk_nil
());
Type
::
func
([
$
(
$arg
),
*
],
&
$ret
),
ty
::
mk_nil
(
ccx
.tcx
()
));
ccx
.intrinsics
()
.borrow_mut
()
.insert
(
$name
,
f
.clone
());
return
Some
(
f
);
}
...
...
@@ -863,7 +863,7 @@ fn declare_intrinsic(ccx: &CrateContext, key: & &'static str) -> Option<ValueRef
}
else
if
*
key
==
$name
{
let
f
=
base
::
decl_cdecl_fn
(
ccx
,
stringify!
(
$cname
),
Type
::
func
([
$
(
$arg
),
*
],
&
$ret
),
ty
::
mk_nil
());
ty
::
mk_nil
(
ccx
.tcx
()
));
ccx
.intrinsics
()
.borrow_mut
()
.insert
(
$name
,
f
.clone
());
return
Some
(
f
);
}
...
...
src/librustc/middle/trans/debuginfo.rs
浏览文件 @
08d6774f
...
...
@@ -350,7 +350,6 @@ fn get_unique_type_id_of_type(&mut self, cx: &CrateContext, type_: ty::t) -> Uni
unique_type_id
.push
(
'{'
);
match
ty
::
get
(
type_
)
.sty
{
ty
::
ty_nil
|
ty
::
ty_bool
|
ty
::
ty_char
|
ty
::
ty_str
|
...
...
@@ -367,6 +366,9 @@ fn get_unique_type_id_of_type(&mut self, cx: &CrateContext, type_: ty::t) -> Uni
unique_type_id
.push_str
(
"struct "
);
from_def_id_and_substs
(
self
,
cx
,
def_id
,
substs
,
&
mut
unique_type_id
);
},
ty
::
ty_tup
(
ref
component_types
)
if
component_types
.is_empty
()
=>
{
push_debuginfo_type_name
(
cx
,
type_
,
false
,
&
mut
unique_type_id
);
},
ty
::
ty_tup
(
ref
component_types
)
=>
{
unique_type_id
.push_str
(
"tuple "
);
for
&
component_type
in
component_types
.iter
()
{
...
...
@@ -1736,7 +1738,6 @@ fn basic_type_metadata(cx: &CrateContext, t: ty::t) -> DIType {
debug!
(
"basic_type_metadata: {}"
,
ty
::
get
(
t
));
let
(
name
,
encoding
)
=
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_nil
=>
(
"()"
.to_string
(),
DW_ATE_unsigned
),
ty
::
ty_bool
=>
(
"bool"
.to_string
(),
DW_ATE_boolean
),
ty
::
ty_char
=>
(
"char"
.to_string
(),
DW_ATE_unsigned_char
),
ty
::
ty_int
(
int_ty
)
=>
match
int_ty
{
...
...
@@ -2773,7 +2774,7 @@ fn subroutine_type_metadata(cx: &CrateContext,
// return type
signature_metadata
.push
(
match
signature
.output
{
ty
::
FnConverging
(
ret_ty
)
=>
match
ty
::
get
(
ret_ty
)
.sty
{
ty
::
ty_
nil
=>
ptr
::
null_mut
(),
ty
::
ty_
tup
(
ref
tys
)
if
tys
.is_empty
()
=>
ptr
::
null_mut
(),
_
=>
type_metadata
(
cx
,
ret_ty
,
span
)
},
ty
::
FnDiverging
=>
diverging_type_metadata
(
cx
)
...
...
@@ -2880,7 +2881,6 @@ fn type_metadata(cx: &CrateContext,
let
sty
=
&
ty
::
get
(
t
)
.sty
;
let
MetadataCreationResult
{
metadata
,
already_stored_in_typemap
}
=
match
*
sty
{
ty
::
ty_nil
|
ty
::
ty_bool
|
ty
::
ty_char
|
ty
::
ty_int
(
_
)
|
...
...
@@ -3671,7 +3671,6 @@ fn push_debuginfo_type_name(cx: &CrateContext,
qualified
:
bool
,
output
:
&
mut
String
)
{
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_nil
=>
output
.push_str
(
"()"
),
ty
::
ty_bool
=>
output
.push_str
(
"bool"
),
ty
::
ty_char
=>
output
.push_str
(
"char"
),
ty
::
ty_str
=>
output
.push_str
(
"str"
),
...
...
src/librustc/middle/trans/foreign.rs
浏览文件 @
08d6774f
...
...
@@ -520,7 +520,7 @@ pub fn decl_rust_fn_with_foreign_abi(ccx: &CrateContext,
}
_
=>
panic!
(
"expected bare fn in decl_rust_fn_with_foreign_abi"
)
};
let
llfn
=
base
::
decl_fn
(
ccx
,
name
,
cconv
,
llfn_ty
,
ty
::
FnConverging
(
ty
::
mk_nil
()));
let
llfn
=
base
::
decl_fn
(
ccx
,
name
,
cconv
,
llfn_ty
,
ty
::
FnConverging
(
ty
::
mk_nil
(
ccx
.tcx
()
)));
add_argument_attributes
(
&
tys
,
llfn
);
debug!
(
"decl_rust_fn_with_foreign_abi(llfn_ty={}, llfn={})"
,
ccx
.tn
()
.type_to_string
(
llfn_ty
),
ccx
.tn
()
.val_to_string
(
llfn
));
...
...
src/librustc/middle/trans/glue.rs
浏览文件 @
08d6774f
...
...
@@ -159,7 +159,7 @@ pub fn get_drop_glue(ccx: &CrateContext, t: ty::t) -> ValueRef {
let
(
glue
,
new_sym
)
=
match
ccx
.available_drop_glues
()
.borrow
()
.get
(
&
t
)
{
Some
(
old_sym
)
=>
{
let
glue
=
decl_cdecl_fn
(
ccx
,
old_sym
.as_slice
(),
llfnty
,
ty
::
mk_nil
());
let
glue
=
decl_cdecl_fn
(
ccx
,
old_sym
.as_slice
(),
llfnty
,
ty
::
mk_nil
(
ccx
.tcx
()
));
(
glue
,
None
)
},
None
=>
{
...
...
@@ -288,7 +288,7 @@ fn trans_struct_drop<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
}
let
dtor_ty
=
ty
::
mk_ctor_fn
(
variant_cx
.tcx
(),
ast
::
DUMMY_NODE_ID
,
[
get_drop_glue_type
(
bcx
.ccx
(),
t
)],
ty
::
mk_nil
());
[
get_drop_glue_type
(
bcx
.ccx
(),
t
)],
ty
::
mk_nil
(
bcx
.tcx
()
));
let
(
_
,
variant_cx
)
=
invoke
(
variant_cx
,
dtor_addr
,
args
,
dtor_ty
,
None
,
false
);
variant_cx
.fcx
.pop_and_trans_custom_cleanup_scope
(
variant_cx
,
field_scope
);
...
...
@@ -520,7 +520,7 @@ fn declare_generic_glue(ccx: &CrateContext, t: ty::t, llfnty: Type,
ccx
,
t
,
format!
(
"glue_{}"
,
name
)
.as_slice
());
let
llfn
=
decl_cdecl_fn
(
ccx
,
fn_nm
.as_slice
(),
llfnty
,
ty
::
mk_nil
());
let
llfn
=
decl_cdecl_fn
(
ccx
,
fn_nm
.as_slice
(),
llfnty
,
ty
::
mk_nil
(
ccx
.tcx
()
));
note_unique_llvm_symbol
(
ccx
,
fn_nm
.clone
());
return
(
fn_nm
,
llfn
);
}
...
...
@@ -538,10 +538,11 @@ fn make_generic_glue(ccx: &CrateContext,
let
arena
=
TypedArena
::
new
();
let
empty_param_substs
=
param_substs
::
empty
();
let
fcx
=
new_fn_ctxt
(
ccx
,
llfn
,
ast
::
DUMMY_NODE_ID
,
false
,
ty
::
FnConverging
(
ty
::
mk_nil
()),
let
fcx
=
new_fn_ctxt
(
ccx
,
llfn
,
ast
::
DUMMY_NODE_ID
,
false
,
ty
::
FnConverging
(
ty
::
mk_nil
(
ccx
.tcx
())),
&
empty_param_substs
,
None
,
&
arena
);
let
bcx
=
init_function
(
&
fcx
,
false
,
ty
::
FnConverging
(
ty
::
mk_nil
()));
let
bcx
=
init_function
(
&
fcx
,
false
,
ty
::
FnConverging
(
ty
::
mk_nil
(
ccx
.tcx
()
)));
update_linkage
(
ccx
,
llfn
,
None
,
OriginalTranslation
);
...
...
@@ -556,7 +557,7 @@ fn make_generic_glue(ccx: &CrateContext,
let
llrawptr0
=
get_param
(
llfn
,
fcx
.arg_pos
(
0
)
as
c_uint
);
let
bcx
=
helper
(
bcx
,
llrawptr0
,
t
);
finish_fn
(
&
fcx
,
bcx
,
ty
::
FnConverging
(
ty
::
mk_nil
()));
finish_fn
(
&
fcx
,
bcx
,
ty
::
FnConverging
(
ty
::
mk_nil
(
ccx
.tcx
()
)));
llfn
}
...
...
src/librustc/middle/trans/meth.rs
浏览文件 @
08d6774f
...
...
@@ -594,7 +594,6 @@ pub fn get_vtable(bcx: Block,
new_inputs
.push
(
element
.subst
(
bcx
.tcx
(),
substs
));
}
}
ty
::
ty_nil
=>
{}
_
=>
{
bcx
.tcx
()
.sess
.bug
(
"get_vtable(): closure
\
type wasn't a tuple"
)
...
...
src/librustc/middle/trans/type_of.rs
浏览文件 @
08d6774f
...
...
@@ -83,7 +83,6 @@ pub fn untuple_arguments_if_necessary(ccx: &CrateContext,
result
.push
(
tupled_argument
);
}
}
ty
::
ty_nil
=>
{}
_
=>
{
ccx
.tcx
()
.sess
.bug
(
"argument to function with
\"
rust-call
\"
ABI
\
is neither a tuple nor unit"
)
...
...
@@ -186,7 +185,6 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
ppaux
::
ty_to_string
(
cx
.tcx
(),
t
))
.as_slice
())
}
ty
::
ty_nil
=>
Type
::
nil
(
cx
),
ty
::
ty_bool
=>
Type
::
bool
(
cx
),
ty
::
ty_char
=>
Type
::
char
(
cx
),
ty
::
ty_int
(
t
)
=>
Type
::
int_from_ty
(
cx
,
t
),
...
...
@@ -211,6 +209,10 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
Type
::
array
(
&
llty
,
size
)
}
ty
::
ty_tup
(
ref
tys
)
if
tys
.is_empty
()
=>
{
Type
::
nil
(
cx
)
}
ty
::
ty_tup
(
..
)
|
ty
::
ty_enum
(
..
)
|
ty
::
ty_unboxed_closure
(
..
)
=>
{
let
repr
=
adt
::
represent_type
(
cx
,
t
);
adt
::
sizing_type_of
(
cx
,
&*
repr
,
false
)
...
...
@@ -298,7 +300,6 @@ fn type_of_unsize_info(cx: &CrateContext, t: ty::t) -> Type {
}
let
mut
llty
=
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_nil
=>
Type
::
nil
(
cx
),
ty
::
ty_bool
=>
Type
::
bool
(
cx
),
ty
::
ty_char
=>
Type
::
char
(
cx
),
ty
::
ty_int
(
t
)
=>
Type
::
int_from_ty
(
cx
,
t
),
...
...
@@ -365,6 +366,7 @@ fn type_of_unsize_info(cx: &CrateContext, t: ty::t) -> Type {
let
fn_ty
=
type_of_fn_from_ty
(
cx
,
t
)
.ptr_to
();
Type
::
struct_
(
cx
,
[
fn_ty
,
Type
::
i8p
(
cx
)],
false
)
}
ty
::
ty_tup
(
ref
tys
)
if
tys
.is_empty
()
=>
Type
::
nil
(
cx
),
ty
::
ty_tup
(
..
)
=>
{
let
repr
=
adt
::
represent_type
(
cx
,
t
);
adt
::
type_of
(
cx
,
&*
repr
)
...
...
src/librustc/middle/ty.rs
浏览文件 @
08d6774f
...
...
@@ -906,7 +906,6 @@ mod primitives {
)
)
def_prim_ty!
(
TY_NIL
,
super
::
ty_nil
)
def_prim_ty!
(
TY_BOOL
,
super
::
ty_bool
)
def_prim_ty!
(
TY_CHAR
,
super
::
ty_char
)
def_prim_ty!
(
TY_INT
,
super
::
ty_int
(
ast
::
TyI
))
...
...
@@ -932,7 +931,6 @@ mod primitives {
// AST structure in libsyntax/ast.rs as well.
#[deriving(Clone,
PartialEq,
Eq,
Hash,
Show)]
pub
enum
sty
{
ty_nil
,
ty_bool
,
ty_char
,
ty_int
(
ast
::
IntTy
),
...
...
@@ -1557,7 +1555,6 @@ pub fn mk_ctxt<'tcx>(s: Session,
pub
fn
mk_t
(
cx
:
&
ctxt
,
st
:
sty
)
->
t
{
// Check for primitive types.
match
st
{
ty_nil
=>
return
mk_nil
(),
ty_err
=>
return
mk_err
(),
ty_bool
=>
return
mk_bool
(),
ty_int
(
i
)
=>
return
mk_mach_int
(
i
),
...
...
@@ -1603,7 +1600,7 @@ fn flags_for_bounds(bounds: &ExistentialBounds) -> TypeFlags {
rflags
(
bounds
.region_bound
)
}
match
&
st
{
&
ty_
nil
|
&
ty_
bool
|
&
ty_char
|
&
ty_int
(
_
)
|
&
ty_float
(
_
)
|
&
ty_uint
(
_
)
|
&
ty_bool
|
&
ty_char
|
&
ty_int
(
_
)
|
&
ty_float
(
_
)
|
&
ty_uint
(
_
)
|
&
ty_str
=>
{}
// You might think that we could just return ty_err for
// any type containing ty_err as a component, and get
...
...
@@ -1689,9 +1686,6 @@ pub fn mk_prim_t(primitive: &'static t_box_) -> t {
}
}
#[inline]
pub
fn
mk_nil
()
->
t
{
mk_prim_t
(
&
primitives
::
TY_NIL
)
}
#[inline]
pub
fn
mk_err
()
->
t
{
mk_prim_t
(
&
primitives
::
TY_ERR
)
}
...
...
@@ -1803,7 +1797,7 @@ pub fn mk_imm_ptr(cx: &ctxt, ty: t) -> t {
}
pub
fn
mk_nil_ptr
(
cx
:
&
ctxt
)
->
t
{
mk_ptr
(
cx
,
mt
{
ty
:
mk_nil
(),
mutbl
:
ast
::
MutImmutable
})
mk_ptr
(
cx
,
mt
{
ty
:
mk_nil
(
cx
),
mutbl
:
ast
::
MutImmutable
})
}
pub
fn
mk_vec
(
cx
:
&
ctxt
,
t
:
t
,
sz
:
Option
<
uint
>
)
->
t
{
...
...
@@ -1818,14 +1812,12 @@ pub fn mk_slice(cx: &ctxt, r: Region, tm: mt) -> t {
})
}
pub
fn
mk_tup
(
cx
:
&
ctxt
,
ts
:
Vec
<
t
>
)
->
t
{
mk_t
(
cx
,
ty_tup
(
ts
))
}
pub
fn
mk_tup
(
cx
:
&
ctxt
,
ts
:
Vec
<
t
>
)
->
t
{
mk_t
(
cx
,
ty_tup
(
ts
))
}
pub
fn
mk_tup_or_nil
(
cx
:
&
ctxt
,
ts
:
Vec
<
t
>
)
->
t
{
if
ts
.len
()
==
0
{
ty
::
mk_nil
()
}
else
{
mk_t
(
cx
,
ty_tup
(
ts
))
}
pub
fn
mk_nil
(
cx
:
&
ctxt
)
->
t
{
mk_tup
(
cx
,
Vec
::
new
())
}
pub
fn
mk_closure
(
cx
:
&
ctxt
,
fty
:
ClosureTy
)
->
t
{
...
...
@@ -1908,7 +1900,7 @@ pub fn maybe_walk_ty(ty: t, f: |t| -> bool) {
return
;
}
match
get
(
ty
)
.sty
{
ty_
nil
|
ty_
bool
|
ty_char
|
ty_int
(
_
)
|
ty_uint
(
_
)
|
ty_float
(
_
)
|
ty_bool
|
ty_char
|
ty_int
(
_
)
|
ty_uint
(
_
)
|
ty_float
(
_
)
|
ty_str
|
ty_infer
(
_
)
|
ty_param
(
_
)
|
ty_err
=>
{}
ty_uniq
(
ty
)
|
ty_vec
(
ty
,
_
)
|
ty_open
(
ty
)
=>
maybe_walk_ty
(
ty
,
f
),
ty_ptr
(
ref
tm
)
|
ty_rptr
(
_
,
ref
tm
)
=>
{
...
...
@@ -1996,7 +1988,10 @@ pub fn empty() -> ParamBounds {
// Type utilities
pub
fn
type_is_nil
(
ty
:
t
)
->
bool
{
get
(
ty
)
.sty
==
ty_nil
match
get
(
ty
)
.sty
{
ty_tup
(
ref
tys
)
=>
tys
.is_empty
(),
_
=>
false
}
}
pub
fn
type_is_error
(
ty
:
t
)
->
bool
{
...
...
@@ -2133,7 +2128,7 @@ pub fn type_is_fat_ptr(cx: &ctxt, ty: t) -> bool {
*/
pub
fn
type_is_scalar
(
ty
:
t
)
->
bool
{
match
get
(
ty
)
.sty
{
ty_
nil
|
ty_
bool
|
ty_char
|
ty_int
(
_
)
|
ty_float
(
_
)
|
ty_uint
(
_
)
|
ty_bool
|
ty_char
|
ty_int
(
_
)
|
ty_float
(
_
)
|
ty_uint
(
_
)
|
ty_infer
(
IntVar
(
_
))
|
ty_infer
(
FloatVar
(
_
))
|
ty_bare_fn
(
..
)
|
ty_ptr
(
_
)
=>
true
,
_
=>
false
...
...
@@ -2170,7 +2165,7 @@ fn type_needs_unwind_cleanup_(cx: &ctxt, ty: t, tycache: &mut FnvHashSet<t>) ->
let
mut
needs_unwind_cleanup
=
false
;
maybe_walk_ty
(
ty
,
|
ty
|
{
needs_unwind_cleanup
|
=
match
get
(
ty
)
.sty
{
ty_
nil
|
ty_
bool
|
ty_int
(
_
)
|
ty_uint
(
_
)
|
ty_bool
|
ty_int
(
_
)
|
ty_uint
(
_
)
|
ty_float
(
_
)
|
ty_tup
(
_
)
|
ty_ptr
(
_
)
=>
false
,
ty_enum
(
did
,
ref
substs
)
=>
...
...
@@ -2429,7 +2424,7 @@ fn tc_ty(cx: &ctxt,
// Scalar and unique types are sendable, and durable
ty_infer
(
ty
::
SkolemizedIntTy
(
_
))
|
ty_
nil
|
ty_
bool
|
ty_int
(
_
)
|
ty_uint
(
_
)
|
ty_float
(
_
)
|
ty_bool
|
ty_int
(
_
)
|
ty_uint
(
_
)
|
ty_float
(
_
)
|
ty_bare_fn
(
_
)
|
ty
::
ty_char
=>
{
TC
::
None
}
...
...
@@ -2740,7 +2735,6 @@ fn subtypes_require(cx: &ctxt, seen: &mut Vec<DefId>,
ty_vec
(
_
,
Some
(
0
))
=>
false
,
// don't need no contents
ty_vec
(
ty
,
Some
(
_
))
=>
type_requires
(
cx
,
seen
,
r_ty
,
ty
),
ty_nil
|
ty_bool
|
ty_char
|
ty_int
(
_
)
|
...
...
@@ -3779,7 +3773,7 @@ pub fn impl_or_trait_item_idx(id: ast::Name, trait_items: &[ImplOrTraitItem])
pub
fn
ty_sort_string
(
cx
:
&
ctxt
,
t
:
t
)
->
String
{
match
get
(
t
)
.sty
{
ty_
nil
|
ty_
bool
|
ty_char
|
ty_int
(
_
)
|
ty_bool
|
ty_char
|
ty_int
(
_
)
|
ty_uint
(
_
)
|
ty_float
(
_
)
|
ty_str
=>
{
::
util
::
ppaux
::
ty_to_string
(
cx
,
t
)
}
...
...
@@ -5141,7 +5135,6 @@ pub fn hash_crate_independent(tcx: &ctxt, t: t, svh: &Svh) -> u64 {
};
ty
::
walk_ty
(
t
,
|
t
|
{
match
ty
::
get
(
t
)
.sty
{
ty_nil
=>
byte!
(
0
),
ty_bool
=>
byte!
(
2
),
ty_char
=>
byte!
(
3
),
ty_int
(
i
)
=>
{
...
...
@@ -5512,7 +5505,6 @@ pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec<ty::Region>,
accumulator
.push
(
*
region
);
accum_substs
(
accumulator
,
substs
);
}
ty_nil
|
ty_bool
|
ty_char
|
ty_int
(
_
)
|
...
...
src/librustc/middle/ty_fold.rs
浏览文件 @
08d6774f
...
...
@@ -554,7 +554,7 @@ pub fn super_fold_sty<'tcx, T: TypeFolder<'tcx>>(this: &mut T,
ty
::
ty_unboxed_closure
(
did
,
ref
region
,
ref
substs
)
=>
{
ty
::
ty_unboxed_closure
(
did
,
region
.fold_with
(
this
),
substs
.fold_with
(
this
))
}
ty
::
ty_
nil
|
ty
::
ty_
bool
|
ty
::
ty_char
|
ty
::
ty_str
|
ty
::
ty_bool
|
ty
::
ty_char
|
ty
::
ty_str
|
ty
::
ty_int
(
_
)
|
ty
::
ty_uint
(
_
)
|
ty
::
ty_float
(
_
)
|
ty
::
ty_err
|
ty
::
ty_infer
(
_
)
|
ty
::
ty_param
(
..
)
=>
{
...
...
src/librustc/middle/typeck/astconv.rs
浏览文件 @
08d6774f
...
...
@@ -389,7 +389,7 @@ fn parenthesized_parameters<'tcx,AC>(this: &AC,
let
output
=
match
data
.output
{
Some
(
ref
output_ty
)
=>
ast_ty_to_ty
(
this
,
&
binding_rscope
,
&**
output_ty
),
None
=>
ty
::
mk_nil
()
None
=>
ty
::
mk_nil
(
this
.tcx
()
)
};
(
Vec
::
new
(),
vec!
[
input_ty
,
output
])
...
...
@@ -824,7 +824,7 @@ pub fn ast_ty_to_ty<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
let
typ
=
ast_ty_to_builtin_ty
(
this
,
rscope
,
ast_ty
)
.unwrap_or_else
(||
{
match
ast_ty
.node
{
ast
::
TyNil
=>
ty
::
mk_nil
(),
ast
::
TyNil
=>
ty
::
mk_nil
(
this
.tcx
()
),
ast
::
TyBot
=>
unreachable!
(),
ast
::
TyUniq
(
ref
ty
)
=>
{
mk_pointer
(
this
,
rscope
,
ast
::
MutImmutable
,
&**
ty
,
Uniq
,
...
...
src/librustc/middle/typeck/check/method.rs
浏览文件 @
08d6774f
...
...
@@ -1214,7 +1214,7 @@ fn search_for_autoptrd_method(&self, self_ty: ty::t, autoderefs: uint)
ty_bare_fn
(
..
)
|
ty_uniq
(
..
)
|
ty_rptr
(
..
)
|
ty_infer
(
IntVar
(
_
))
|
ty_infer
(
FloatVar
(
_
))
|
ty_param
(
..
)
|
ty_
nil
|
ty_
bool
|
ty_param
(
..
)
|
ty_bool
|
ty_char
|
ty_int
(
..
)
|
ty_uint
(
..
)
|
ty_float
(
..
)
|
ty_enum
(
..
)
|
ty_ptr
(
..
)
|
ty_struct
(
..
)
|
ty_unboxed_closure
(
..
)
|
ty_tup
(
..
)
|
ty_open
(
..
)
|
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
08d6774f
...
...
@@ -1569,7 +1569,7 @@ pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> ty::t {
pub
fn
default_diverging_type_variables_to_nil
(
&
self
)
{
for
(
_
,
&
ref
ty
)
in
self
.inh.node_types
.borrow_mut
()
.iter_mut
()
{
if
self
.infcx
()
.type_var_diverges
(
self
.infcx
()
.resolve_type_vars_if_possible
(
*
ty
))
{
demand
::
eqtype
(
self
,
codemap
::
DUMMY_SP
,
*
ty
,
ty
::
mk_nil
());
demand
::
eqtype
(
self
,
codemap
::
DUMMY_SP
,
*
ty
,
ty
::
mk_nil
(
self
.tcx
()
));
}
}
}
...
...
@@ -1741,7 +1741,7 @@ pub fn instantiate_item_type(&self,
}
pub
fn
write_nil
(
&
self
,
node_id
:
ast
::
NodeId
)
{
self
.write_ty
(
node_id
,
ty
::
mk_nil
());
self
.write_ty
(
node_id
,
ty
::
mk_nil
(
self
.tcx
()
));
}
pub
fn
write_error
(
&
self
,
node_id
:
ast
::
NodeId
)
{
self
.write_ty
(
node_id
,
ty
::
mk_err
());
...
...
@@ -2664,17 +2664,6 @@ fn check_argument_types<'a>(fcx: &FnCtxt,
(
*
arg_types
)
.clone
()
}
}
ty
::
ty_nil
=>
{
if
args
.len
()
!=
0
{
span_err!
(
tcx
.sess
,
sp
,
E0058
,
"this function takes 0 parameters but {} parameter{} supplied"
,
args
.len
(),
if
args
.len
()
==
1
{
" was"
}
else
{
"s were"
});
err_args
(
args
.len
())
}
else
{
vec!
[]
}
}
_
=>
{
span_err!
(
tcx
.sess
,
sp
,
E0059
,
"cannot use call notation; the first type parameter
\
...
...
@@ -2865,7 +2854,7 @@ fn check_lit(fcx: &FnCtxt,
opt_ty
.unwrap_or_else
(
||
ty
::
mk_float_var
(
tcx
,
fcx
.infcx
()
.next_float_var_id
()))
}
ast
::
LitNil
=>
ty
::
mk_nil
(),
ast
::
LitNil
=>
ty
::
mk_nil
(
tcx
),
ast
::
LitBool
(
_
)
=>
ty
::
mk_bool
()
}
}
...
...
@@ -3179,7 +3168,7 @@ fn check_then_else(fcx: &FnCtxt,
infer
::
IfExpressionWithNoElse
(
sp
),
false
,
then_ty
,
ty
::
mk_nil
())
ty
::
mk_nil
(
fcx
.tcx
()
))
}
};
...
...
@@ -3480,7 +3469,7 @@ fn check_unboxed_closure(fcx: &FnCtxt,
// Tuple up the arguments and insert the resulting function type into
// the `unboxed_closures` table.
fn_ty
.sig.inputs
=
vec!
[
ty
::
mk_tup
_or_nil
(
fcx
.tcx
(),
fn_ty
.sig.inputs
)];
fn_ty
.sig.inputs
=
vec!
[
ty
::
mk_tup
(
fcx
.tcx
(),
fn_ty
.sig.inputs
)];
let
kind
=
match
kind
{
ast
::
FnUnboxedClosureKind
=>
ty
::
FnUnboxedClosureKind
,
...
...
@@ -4148,7 +4137,7 @@ fn check_struct_fields_on_error(fcx: &FnCtxt,
match
*
expr_opt
{
None
=>
if
let
Err
(
_
)
=
fcx
.mk_eqty
(
false
,
infer
::
Misc
(
expr
.span
),
result_type
,
ty
::
mk_nil
())
{
result_type
,
ty
::
mk_nil
(
fcx
.tcx
()
))
{
span_err!
(
tcx
.sess
,
expr
.span
,
E0069
,
"`return;` in function returning non-nil"
);
},
...
...
@@ -4743,7 +4732,7 @@ pub fn check_stmt(fcx: &FnCtxt, stmt: &ast::Stmt) {
ast
::
StmtExpr
(
ref
expr
,
id
)
=>
{
node_id
=
id
;
// Check with expected type of ()
check_expr_has_type
(
fcx
,
&**
expr
,
ty
::
mk_nil
());
check_expr_has_type
(
fcx
,
&**
expr
,
ty
::
mk_nil
(
fcx
.tcx
()
));
let
expr_ty
=
fcx
.expr_ty
(
&**
expr
);
saw_bot
=
saw_bot
||
fcx
.infcx
()
.type_var_diverges
(
expr_ty
);
saw_err
=
saw_err
||
ty
::
type_is_error
(
expr_ty
);
...
...
@@ -4769,12 +4758,12 @@ pub fn check_stmt(fcx: &FnCtxt, stmt: &ast::Stmt) {
}
pub
fn
check_block_no_value
(
fcx
:
&
FnCtxt
,
blk
:
&
ast
::
Block
)
{
check_block_with_expected
(
fcx
,
blk
,
ExpectHasType
(
ty
::
mk_nil
()));
check_block_with_expected
(
fcx
,
blk
,
ExpectHasType
(
ty
::
mk_nil
(
fcx
.tcx
()
)));
let
blkty
=
fcx
.node_ty
(
blk
.id
);
if
ty
::
type_is_error
(
blkty
)
{
fcx
.write_error
(
blk
.id
);
}
else
{
let
nilty
=
ty
::
mk_nil
();
let
nilty
=
ty
::
mk_nil
(
fcx
.tcx
()
);
demand
::
suptype
(
fcx
,
blk
.span
,
nilty
,
blkty
);
}
}
...
...
@@ -5507,7 +5496,7 @@ fn push_explicit_parenthesized_parameters_from_segment_to_substs(
data
.output
.as_ref
()
.map
(|
ty
|
fcx
.to_ty
(
&**
ty
));
let
output_ty
=
output_ty
.unwrap_or
(
ty
::
mk_nil
());
output_ty
.unwrap_or
(
ty
::
mk_nil
(
fcx
.tcx
()
));
if
type_count
>=
2
{
substs
.types
.push
(
space
,
output_ty
);
...
...
@@ -5727,7 +5716,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
"load"
=>
(
1
,
vec!
(
ty
::
mk_imm_ptr
(
tcx
,
param
(
ccx
,
0
))),
param
(
ccx
,
0
)),
"store"
=>
(
1
,
vec!
(
ty
::
mk_mut_ptr
(
tcx
,
param
(
ccx
,
0
)),
param
(
ccx
,
0
)),
ty
::
mk_nil
()),
ty
::
mk_nil
(
tcx
)),
"xchg"
|
"xadd"
|
"xsub"
|
"and"
|
"nand"
|
"or"
|
"xor"
|
"max"
|
"min"
|
"umax"
|
"umin"
=>
{
...
...
@@ -5735,7 +5724,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
param
(
ccx
,
0
))
}
"fence"
=>
{
(
0
,
Vec
::
new
(),
ty
::
mk_nil
())
(
0
,
Vec
::
new
(),
ty
::
mk_nil
(
tcx
))
}
op
=>
{
span_err!
(
tcx
.sess
,
it
.span
,
E0092
,
...
...
@@ -5748,12 +5737,12 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
(
0
,
Vec
::
new
(),
ty
::
FnDiverging
)
}
else
{
let
(
n_tps
,
inputs
,
output
)
=
match
name
.get
()
{
"breakpoint"
=>
(
0
,
Vec
::
new
(),
ty
::
mk_nil
()),
"breakpoint"
=>
(
0
,
Vec
::
new
(),
ty
::
mk_nil
(
tcx
)),
"size_of"
|
"pref_align_of"
|
"min_align_of"
=>
(
1u
,
Vec
::
new
(),
ty
::
mk_uint
()),
"init"
=>
(
1u
,
Vec
::
new
(),
param
(
ccx
,
0u
)),
"uninit"
=>
(
1u
,
Vec
::
new
(),
param
(
ccx
,
0u
)),
"forget"
=>
(
1u
,
vec!
(
param
(
ccx
,
0
)
),
ty
::
mk_nil
()),
"forget"
=>
(
1u
,
vec!
(
param
(
ccx
,
0
)
),
ty
::
mk_nil
(
tcx
)),
"transmute"
=>
(
2
,
vec!
(
param
(
ccx
,
0
)
),
param
(
ccx
,
1
)),
"move_val_init"
=>
{
(
1u
,
...
...
@@ -5761,7 +5750,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
ty
::
mk_mut_rptr
(
tcx
,
ty
::
ReLateBound
(
it
.id
,
ty
::
BrAnon
(
0
)),
param
(
ccx
,
0
)),
param
(
ccx
,
0u
)
),
ty
::
mk_nil
())
ty
::
mk_nil
(
tcx
))
}
"needs_drop"
=>
(
1u
,
Vec
::
new
(),
ty
::
mk_bool
()),
"owns_managed"
=>
(
1u
,
Vec
::
new
(),
ty
::
mk_bool
()),
...
...
@@ -5817,7 +5806,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
}),
ty
::
mk_uint
()
),
ty
::
mk_nil
())
ty
::
mk_nil
(
tcx
))
}
"set_memory"
|
"volatile_set_memory"
=>
{
(
1
,
...
...
@@ -5829,7 +5818,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
ty
::
mk_u8
(),
ty
::
mk_uint
()
),
ty
::
mk_nil
())
ty
::
mk_nil
(
tcx
))
}
"sqrtf32"
=>
(
0
,
vec!
(
ty
::
mk_f32
()
),
ty
::
mk_f32
()),
"sqrtf64"
=>
(
0
,
vec!
(
ty
::
mk_f64
()
),
ty
::
mk_f64
()),
...
...
@@ -5912,7 +5901,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
"volatile_load"
=>
(
1
,
vec!
(
ty
::
mk_imm_ptr
(
tcx
,
param
(
ccx
,
0
))
),
param
(
ccx
,
0
)),
"volatile_store"
=>
(
1
,
vec!
(
ty
::
mk_mut_ptr
(
tcx
,
param
(
ccx
,
0
)),
param
(
ccx
,
0
)
),
ty
::
mk_nil
()),
(
1
,
vec!
(
ty
::
mk_mut_ptr
(
tcx
,
param
(
ccx
,
0
)),
param
(
ccx
,
0
)
),
ty
::
mk_nil
(
tcx
)),
"i8_add_with_overflow"
|
"i8_sub_with_overflow"
|
"i8_mul_with_overflow"
=>
(
0
,
vec!
(
ty
::
mk_i8
(),
ty
::
mk_i8
()),
...
...
@@ -5948,7 +5937,7 @@ fn param(ccx: &CrateCtxt, n: uint) -> ty::t {
"return_address"
=>
(
0
,
vec!
[],
ty
::
mk_imm_ptr
(
tcx
,
ty
::
mk_u8
())),
"assume"
=>
(
0
,
vec!
[
ty
::
mk_bool
()],
ty
::
mk_nil
()),
"assume"
=>
(
0
,
vec!
[
ty
::
mk_bool
()],
ty
::
mk_nil
(
tcx
)),
ref
other
=>
{
span_err!
(
tcx
.sess
,
it
.span
,
E0093
,
...
...
src/librustc/middle/typeck/check/regionmanip.rs
浏览文件 @
08d6774f
...
...
@@ -91,7 +91,6 @@ fn accumulate_from_ty(&mut self, ty: ty::t) {
ty
.repr
(
self
.tcx
));
match
ty
::
get
(
ty
)
.sty
{
ty
::
ty_nil
|
ty
::
ty_bool
|
ty
::
ty_char
|
ty
::
ty_int
(
..
)
|
...
...
src/librustc/middle/typeck/coherence/mod.rs
浏览文件 @
08d6774f
...
...
@@ -24,7 +24,7 @@
use
middle
::
ty
::{
ImplContainer
,
ImplOrTraitItemId
,
MethodTraitItemId
};
use
middle
::
ty
::{
TypeTraitItemId
,
lookup_item_type
};
use
middle
::
ty
::{
t
,
ty_bool
,
ty_char
,
ty_enum
,
ty_err
};
use
middle
::
ty
::{
ty_str
,
ty_vec
,
ty_float
,
ty_infer
,
ty_int
,
ty_
nil
,
ty_
open
};
use
middle
::
ty
::{
ty_str
,
ty_vec
,
ty_float
,
ty_infer
,
ty_int
,
ty_open
};
use
middle
::
ty
::{
ty_param
,
Polytype
,
ty_ptr
};
use
middle
::
ty
::{
ty_rptr
,
ty_struct
,
ty_trait
,
ty_tup
};
use
middle
::
ty
::{
ty_uint
,
ty_unboxed_closure
,
ty_uniq
,
ty_bare_fn
};
...
...
@@ -82,7 +82,7 @@ fn get_base_type(inference_context: &InferCtxt,
Some
(
resolved_type
)
}
ty_
nil
|
ty_
bool
|
ty_char
|
ty_int
(
..
)
|
ty_uint
(
..
)
|
ty_float
(
..
)
|
ty_bool
|
ty_char
|
ty_int
(
..
)
|
ty_uint
(
..
)
|
ty_float
(
..
)
|
ty_str
(
..
)
|
ty_vec
(
..
)
|
ty_bare_fn
(
..
)
|
ty_closure
(
..
)
|
ty_tup
(
..
)
|
ty_infer
(
..
)
|
ty_param
(
..
)
|
ty_err
|
ty_open
(
..
)
|
ty_uniq
(
_
)
|
ty_ptr
(
_
)
|
ty_rptr
(
_
,
_
)
=>
{
...
...
src/librustc/middle/typeck/infer/combine.rs
浏览文件 @
08d6774f
...
...
@@ -433,7 +433,6 @@ pub fn super_tys<'tcx, C: Combine<'tcx>>(this: &C, a: ty::t, b: ty::t) -> cres<t
}
(
&
ty
::
ty_char
,
_
)
|
(
&
ty
::
ty_nil
,
_
)
|
(
&
ty
::
ty_bool
,
_
)
|
(
&
ty
::
ty_int
(
_
),
_
)
|
(
&
ty
::
ty_uint
(
_
),
_
)
|
...
...
src/librustc/middle/typeck/infer/skolemize.rs
浏览文件 @
08d6774f
...
...
@@ -148,7 +148,6 @@ fn fold_ty(&mut self, t: ty::t) -> ty::t {
self
.tcx
()
.sess
.bug
(
"Cannot skolemize an open existential type"
);
}
ty
::
ty_nil
|
ty
::
ty_bool
|
ty
::
ty_char
|
ty
::
ty_int
(
..
)
|
...
...
src/librustc/middle/typeck/mod.rs
浏览文件 @
08d6774f
...
...
@@ -382,7 +382,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
sig
:
ty
::
FnSig
{
binder_id
:
main_id
,
inputs
:
Vec
::
new
(),
output
:
ty
::
FnConverging
(
ty
::
mk_nil
()),
output
:
ty
::
FnConverging
(
ty
::
mk_nil
(
tcx
)),
variadic
:
false
}
});
...
...
src/librustc/middle/typeck/variance.rs
浏览文件 @
08d6774f
...
...
@@ -728,7 +728,7 @@ fn add_constraints_from_ty(&mut self,
debug!
(
"add_constraints_from_ty(ty={})"
,
ty
.repr
(
self
.tcx
()));
match
ty
::
get
(
ty
)
.sty
{
ty
::
ty_
nil
|
ty
::
ty_
bool
|
ty
::
ty_bool
|
ty
::
ty_char
|
ty
::
ty_int
(
_
)
|
ty
::
ty_uint
(
_
)
|
ty
::
ty_float
(
_
)
|
ty
::
ty_str
=>
{
/* leaf type -- noop */
...
...
src/librustc/util/ppaux.rs
浏览文件 @
08d6774f
...
...
@@ -19,7 +19,7 @@
use
middle
::
ty
::{
mt
,
t
,
ParamTy
};
use
middle
::
ty
::{
ty_bool
,
ty_char
,
ty_struct
,
ty_enum
};
use
middle
::
ty
::{
ty_err
,
ty_str
,
ty_vec
,
ty_float
,
ty_bare_fn
,
ty_closure
};
use
middle
::
ty
::{
ty_
nil
,
ty_
param
,
ty_ptr
,
ty_rptr
,
ty_tup
,
ty_open
};
use
middle
::
ty
::{
ty_param
,
ty_ptr
,
ty_rptr
,
ty_tup
,
ty_open
};
use
middle
::
ty
::{
ty_unboxed_closure
};
use
middle
::
ty
::{
ty_uniq
,
ty_trait
,
ty_int
,
ty_uint
,
ty_infer
};
use
middle
::
ty
;
...
...
@@ -384,7 +384,6 @@ fn infer_ty_to_string(cx: &ctxt, ty: ty::InferTy) -> String {
// pretty print the structural type representation:
match
ty
::
get
(
typ
)
.sty
{
ty_nil
=>
"()"
.to_string
(),
ty_bool
=>
"bool"
.to_string
(),
ty_char
=>
"char"
.to_string
(),
ty_int
(
t
)
=>
ast_util
::
int_ty_to_string
(
t
,
None
)
.to_string
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录