Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
cf0b7bdd
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,发现更多精彩内容 >>
提交
cf0b7bdd
编写于
9月 20, 2016
作者:
J
Jonas Schievink
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Call arrays "arrays" instead of "vecs" internally
上级
69c3d0ad
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
74 addition
and
76 deletion
+74
-76
src/librustc/cfg/construct.rs
src/librustc/cfg/construct.rs
+2
-2
src/librustc/hir/intravisit.rs
src/librustc/hir/intravisit.rs
+4
-4
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+4
-4
src/librustc/hir/map/def_collector.rs
src/librustc/hir/map/def_collector.rs
+1
-1
src/librustc/hir/mod.rs
src/librustc/hir/mod.rs
+7
-7
src/librustc/hir/pat_util.rs
src/librustc/hir/pat_util.rs
+1
-1
src/librustc/hir/print.rs
src/librustc/hir/print.rs
+4
-4
src/librustc/infer/error_reporting.rs
src/librustc/infer/error_reporting.rs
+5
-5
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/expr_use_visitor.rs
+1
-1
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+3
-3
src/librustc/middle/mem_categorization.rs
src/librustc/middle/mem_categorization.rs
+2
-2
src/librustc/middle/region.rs
src/librustc/middle/region.rs
+2
-2
src/librustc/mir/repr.rs
src/librustc/mir/repr.rs
+5
-7
src/librustc/mir/tcx.rs
src/librustc/mir/tcx.rs
+1
-1
src/librustc/mir/visit.rs
src/librustc/mir/visit.rs
+1
-1
src/librustc/ty/fast_reject.rs
src/librustc/ty/fast_reject.rs
+2
-2
src/librustc/ty/mod.rs
src/librustc/ty/mod.rs
+1
-1
src/librustc_const_eval/check_match.rs
src/librustc_const_eval/check_match.rs
+5
-5
src/librustc_const_eval/eval.rs
src/librustc_const_eval/eval.rs
+4
-4
src/librustc_incremental/calculate_svh/svh_visitor.rs
src/librustc_incremental/calculate_svh/svh_visitor.rs
+2
-2
src/librustc_mir/build/expr/as_rvalue.rs
src/librustc_mir/build/expr/as_rvalue.rs
+1
-1
src/librustc_mir/hair/cx/expr.rs
src/librustc_mir/hair/cx/expr.rs
+1
-1
src/librustc_mir/hair/cx/pattern.rs
src/librustc_mir/hair/cx/pattern.rs
+1
-1
src/librustc_mir/mir_map.rs
src/librustc_mir/mir_map.rs
+1
-1
src/librustc_passes/consts.rs
src/librustc_passes/consts.rs
+1
-1
src/librustc_trans/mir/constant.rs
src/librustc_trans/mir/constant.rs
+1
-1
src/librustc_typeck/astconv.rs
src/librustc_typeck/astconv.rs
+2
-2
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/_match.rs
+1
-1
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+4
-4
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/check/writeback.rs
+1
-1
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+3
-3
未找到文件。
src/librustc/cfg/construct.rs
浏览文件 @
cf0b7bdd
...
...
@@ -126,7 +126,7 @@ fn pat(&mut self, pat: &hir::Pat, pred: CFGIndex) -> CFGIndex {
self
.add_ast_node
(
pat
.id
,
&
[
pats_exit
])
}
PatKind
::
Vec
(
ref
pre
,
ref
vec
,
ref
post
)
=>
{
PatKind
::
Slice
(
ref
pre
,
ref
vec
,
ref
post
)
=>
{
let
pre_exit
=
self
.pats_all
(
pre
.iter
(),
pred
);
let
vec_exit
=
self
.pats_all
(
vec
.iter
(),
pre_exit
);
let
post_exit
=
self
.pats_all
(
post
.iter
(),
vec_exit
);
...
...
@@ -298,7 +298,7 @@ fn expr(&mut self, expr: &hir::Expr, pred: CFGIndex) -> CFGIndex {
self
.add_unreachable_node
()
}
hir
::
Expr
Vec
(
ref
elems
)
=>
{
hir
::
Expr
Array
(
ref
elems
)
=>
{
self
.straightline
(
expr
,
pred
,
elems
.iter
()
.map
(|
e
|
&**
e
))
}
...
...
src/librustc/hir/intravisit.rs
浏览文件 @
cf0b7bdd
...
...
@@ -394,7 +394,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
visitor
.visit_id
(
typ
.id
);
match
typ
.node
{
Ty
Vec
(
ref
ty
)
=>
{
Ty
Slice
(
ref
ty
)
=>
{
visitor
.visit_ty
(
ty
)
}
TyPtr
(
ref
mutable_type
)
=>
{
...
...
@@ -422,7 +422,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
visitor
.visit_ty
(
ty
);
walk_list!
(
visitor
,
visit_ty_param_bound
,
bounds
);
}
Ty
FixedLengthVec
(
ref
ty
,
ref
expression
)
=>
{
Ty
Array
(
ref
ty
,
ref
expression
)
=>
{
visitor
.visit_ty
(
ty
);
visitor
.visit_expr
(
expression
)
}
...
...
@@ -520,7 +520,7 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) {
visitor
.visit_expr
(
upper_bound
)
}
PatKind
::
Wild
=>
(),
PatKind
::
Vec
(
ref
prepatterns
,
ref
slice_pattern
,
ref
postpatterns
)
=>
{
PatKind
::
Slice
(
ref
prepatterns
,
ref
slice_pattern
,
ref
postpatterns
)
=>
{
walk_list!
(
visitor
,
visit_pat
,
prepatterns
);
walk_list!
(
visitor
,
visit_pat
,
slice_pattern
);
walk_list!
(
visitor
,
visit_pat
,
postpatterns
);
...
...
@@ -749,7 +749,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
ExprBox
(
ref
subexpression
)
=>
{
visitor
.visit_expr
(
subexpression
)
}
Expr
Vec
(
ref
subexpressions
)
=>
{
Expr
Array
(
ref
subexpressions
)
=>
{
walk_list!
(
visitor
,
visit_expr
,
subexpressions
);
}
ExprRepeat
(
ref
element
,
ref
count
)
=>
{
...
...
src/librustc/hir/lowering.rs
浏览文件 @
cf0b7bdd
...
...
@@ -227,7 +227,7 @@ fn lower_ty(&mut self, t: &Ty) -> P<hir::Ty> {
id
:
t
.id
,
node
:
match
t
.node
{
Infer
|
ImplicitSelf
=>
hir
::
TyInfer
,
Vec
(
ref
ty
)
=>
hir
::
Ty
Vec
(
self
.lower_ty
(
ty
)),
Vec
(
ref
ty
)
=>
hir
::
Ty
Slice
(
self
.lower_ty
(
ty
)),
Ptr
(
ref
mt
)
=>
hir
::
TyPtr
(
self
.lower_mt
(
mt
)),
Rptr
(
ref
region
,
ref
mt
)
=>
{
hir
::
TyRptr
(
self
.lower_opt_lifetime
(
region
),
self
.lower_mt
(
mt
))
...
...
@@ -258,7 +258,7 @@ fn lower_ty(&mut self, t: &Ty) -> P<hir::Ty> {
hir
::
TyObjectSum
(
self
.lower_ty
(
ty
),
self
.lower_bounds
(
bounds
))
}
FixedLengthVec
(
ref
ty
,
ref
e
)
=>
{
hir
::
Ty
FixedLengthVec
(
self
.lower_ty
(
ty
),
self
.lower_expr
(
e
))
hir
::
Ty
Array
(
self
.lower_ty
(
ty
),
self
.lower_expr
(
e
))
}
Typeof
(
ref
expr
)
=>
{
hir
::
TyTypeof
(
self
.lower_expr
(
expr
))
...
...
@@ -892,7 +892,7 @@ fn lower_pat(&mut self, p: &Pat) -> P<hir::Pat> {
hir
::
PatKind
::
Range
(
self
.lower_expr
(
e1
),
self
.lower_expr
(
e2
))
}
PatKind
::
Vec
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
hir
::
PatKind
::
Vec
(
before
.iter
()
.map
(|
x
|
self
.lower_pat
(
x
))
.collect
(),
hir
::
PatKind
::
Slice
(
before
.iter
()
.map
(|
x
|
self
.lower_pat
(
x
))
.collect
(),
slice
.as_ref
()
.map
(|
x
|
self
.lower_pat
(
x
)),
after
.iter
()
.map
(|
x
|
self
.lower_pat
(
x
))
.collect
())
}
...
...
@@ -1031,7 +1031,7 @@ fn lower_expr(&mut self, e: &Expr) -> P<hir::Expr> {
}
ExprKind
::
Vec
(
ref
exprs
)
=>
{
hir
::
Expr
Vec
(
exprs
.iter
()
.map
(|
x
|
self
.lower_expr
(
x
))
.collect
())
hir
::
Expr
Array
(
exprs
.iter
()
.map
(|
x
|
self
.lower_expr
(
x
))
.collect
())
}
ExprKind
::
Repeat
(
ref
expr
,
ref
count
)
=>
{
let
expr
=
self
.lower_expr
(
expr
);
...
...
src/librustc/hir/map/def_collector.rs
浏览文件 @
cf0b7bdd
...
...
@@ -448,7 +448,7 @@ fn visit_expr(&mut self, expr: &'ast hir::Expr) {
}
fn
visit_ty
(
&
mut
self
,
ty
:
&
'ast
hir
::
Ty
)
{
if
let
hir
::
Ty
FixedLengthVec
(
_
,
ref
length
)
=
ty
.node
{
if
let
hir
::
Ty
Array
(
_
,
ref
length
)
=
ty
.node
{
self
.visit_hir_const_integer
(
length
);
}
if
let
hir
::
TyImplTrait
(
..
)
=
ty
.node
{
...
...
src/librustc/hir/mod.rs
浏览文件 @
cf0b7bdd
...
...
@@ -478,7 +478,7 @@ fn walk_<G>(&self, it: &mut G) -> bool
PatKind
::
Box
(
ref
s
)
|
PatKind
::
Ref
(
ref
s
,
_
)
=>
{
s
.walk_
(
it
)
}
PatKind
::
Vec
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
PatKind
::
Slice
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
before
.iter
()
.all
(|
p
|
p
.walk_
(
it
))
&&
slice
.iter
()
.all
(|
p
|
p
.walk_
(
it
))
&&
after
.iter
()
.all
(|
p
|
p
.walk_
(
it
))
...
...
@@ -554,8 +554,8 @@ pub enum PatKind {
/// A range pattern, e.g. `1...2`
Range
(
P
<
Expr
>
,
P
<
Expr
>
),
/// `[a, b, ..i, y, z]` is represented as:
/// `PatKind::
Vec
(box [a, b], Some(i), box [y, z])`
Vec
(
HirVec
<
P
<
Pat
>>
,
Option
<
P
<
Pat
>>
,
HirVec
<
P
<
Pat
>>
),
/// `PatKind::
Slice
(box [a, b], Some(i), box [y, z])`
Slice
(
HirVec
<
P
<
Pat
>>
,
Option
<
P
<
Pat
>>
,
HirVec
<
P
<
Pat
>>
),
}
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug,
Copy)]
...
...
@@ -826,7 +826,7 @@ pub enum Expr_ {
/// A `box x` expression.
ExprBox
(
P
<
Expr
>
),
/// An array (`[a, b, c, d]`)
Expr
Vec
(
HirVec
<
P
<
Expr
>>
),
Expr
Array
(
HirVec
<
P
<
Expr
>>
),
/// A function call
///
/// The first field resolves to the function itself (usually an `ExprPath`),
...
...
@@ -1080,10 +1080,10 @@ pub struct BareFnTy {
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug)]
/// The different kinds of types recognized by the compiler
pub
enum
Ty_
{
/// A variable length
array
(`[T]`)
Ty
Vec
(
P
<
Ty
>
),
/// A variable length
slice
(`[T]`)
Ty
Slice
(
P
<
Ty
>
),
/// A fixed length array (`[T; n]`)
Ty
FixedLengthVec
(
P
<
Ty
>
,
P
<
Expr
>
),
Ty
Array
(
P
<
Ty
>
,
P
<
Expr
>
),
/// A raw pointer (`*const T` or `*mut T`)
TyPtr
(
MutTy
),
/// A reference (`&'a T` or `&'a mut T`)
...
...
src/librustc/hir/pat_util.rs
浏览文件 @
cf0b7bdd
...
...
@@ -62,7 +62,7 @@ pub fn pat_is_refutable(dm: &DefMap, pat: &hir::Pat) -> bool {
_
=>
false
}
}
PatKind
::
Vec
(
..
)
=>
true
,
PatKind
::
Slice
(
..
)
=>
true
,
_
=>
false
}
}
...
...
src/librustc/hir/print.rs
浏览文件 @
cf0b7bdd
...
...
@@ -486,7 +486,7 @@ pub fn print_type(&mut self, ty: &hir::Ty) -> io::Result<()> {
self
.maybe_print_comment
(
ty
.span.lo
)
?
;
self
.ibox
(
0
)
?
;
match
ty
.node
{
hir
::
Ty
Vec
(
ref
ty
)
=>
{
hir
::
Ty
Slice
(
ref
ty
)
=>
{
word
(
&
mut
self
.s
,
"["
)
?
;
self
.print_type
(
&
ty
)
?
;
word
(
&
mut
self
.s
,
"]"
)
?
;
...
...
@@ -543,7 +543,7 @@ pub fn print_type(&mut self, ty: &hir::Ty) -> io::Result<()> {
hir
::
TyImplTrait
(
ref
bounds
)
=>
{
self
.print_bounds
(
"impl "
,
&
bounds
[
..
])
?
;
}
hir
::
Ty
FixedLengthVec
(
ref
ty
,
ref
v
)
=>
{
hir
::
Ty
Array
(
ref
ty
,
ref
v
)
=>
{
word
(
&
mut
self
.s
,
"["
)
?
;
self
.print_type
(
&
ty
)
?
;
word
(
&
mut
self
.s
,
"; "
)
?
;
...
...
@@ -1319,7 +1319,7 @@ pub fn print_expr(&mut self, expr: &hir::Expr) -> io::Result<()> {
self
.word_space
(
"box"
)
?
;
self
.print_expr
(
expr
)
?
;
}
hir
::
Expr
Vec
(
ref
exprs
)
=>
{
hir
::
Expr
Array
(
ref
exprs
)
=>
{
self
.print_expr_vec
(
&
exprs
[
..
])
?
;
}
hir
::
ExprRepeat
(
ref
element
,
ref
count
)
=>
{
...
...
@@ -1829,7 +1829,7 @@ pub fn print_pat(&mut self, pat: &hir::Pat) -> io::Result<()> {
word
(
&
mut
self
.s
,
"..."
)
?
;
self
.print_expr
(
&
end
)
?
;
}
PatKind
::
Vec
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
PatKind
::
Slice
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
word
(
&
mut
self
.s
,
"["
)
?
;
self
.commasep
(
Inconsistent
,
&
before
[
..
],
|
s
,
p
|
s
.print_pat
(
&
p
))
?
;
if
let
Some
(
ref
p
)
=
*
slice
{
...
...
src/librustc/infer/error_reporting.rs
浏览文件 @
cf0b7bdd
...
...
@@ -1433,8 +1433,8 @@ fn rebuild_arg_ty_or_output(&self,
hir
::
TyPtr
(
ref
mut_ty
)
=>
{
ty_queue
.push
(
&
mut_ty
.ty
);
}
hir
::
Ty
Vec
(
ref
ty
)
|
hir
::
Ty
FixedLengthVec
(
ref
ty
,
_
)
=>
{
hir
::
Ty
Slice
(
ref
ty
)
|
hir
::
Ty
Array
(
ref
ty
,
_
)
=>
{
ty_queue
.push
(
&
ty
);
}
hir
::
TyTup
(
ref
tys
)
=>
ty_queue
.extend
(
tys
.iter
()
.map
(|
ty
|
&**
ty
)),
...
...
@@ -1469,9 +1469,9 @@ fn build_to(from: P<hir::Ty>,
ty
:
build_to
(
mut_ty
.ty
,
to
),
})
}
hir
::
Ty
Vec
(
ty
)
=>
hir
::
TyVec
(
build_to
(
ty
,
to
)),
hir
::
Ty
FixedLengthVec
(
ty
,
e
)
=>
{
hir
::
Ty
FixedLengthVec
(
build_to
(
ty
,
to
),
e
)
hir
::
Ty
Slice
(
ty
)
=>
hir
::
TySlice
(
build_to
(
ty
,
to
)),
hir
::
Ty
Array
(
ty
,
e
)
=>
{
hir
::
Ty
Array
(
build_to
(
ty
,
to
),
e
)
}
hir
::
TyTup
(
tys
)
=>
{
hir
::
TyTup
(
tys
.into_iter
()
.map
(|
ty
|
build_to
(
ty
,
to
))
.collect
())
...
...
src/librustc/middle/expr_use_visitor.rs
浏览文件 @
cf0b7bdd
...
...
@@ -442,7 +442,7 @@ pub fn walk_expr(&mut self, expr: &hir::Expr) {
}
}
hir
::
Expr
Vec
(
ref
exprs
)
=>
{
hir
::
Expr
Array
(
ref
exprs
)
=>
{
self
.consume_exprs
(
exprs
);
}
...
...
src/librustc/middle/liveness.rs
浏览文件 @
cf0b7bdd
...
...
@@ -490,7 +490,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
// otherwise, live nodes are not required:
hir
::
ExprIndex
(
..
)
|
hir
::
ExprField
(
..
)
|
hir
::
ExprTupField
(
..
)
|
hir
::
Expr
Vec
(
..
)
|
hir
::
ExprCall
(
..
)
|
hir
::
ExprMethodCall
(
..
)
|
hir
::
Expr
Array
(
..
)
|
hir
::
ExprCall
(
..
)
|
hir
::
ExprMethodCall
(
..
)
|
hir
::
ExprTup
(
..
)
|
hir
::
ExprBinary
(
..
)
|
hir
::
ExprAddrOf
(
..
)
|
hir
::
ExprCast
(
..
)
|
hir
::
ExprUnary
(
..
)
|
hir
::
ExprBreak
(
_
)
|
hir
::
ExprAgain
(
_
)
|
hir
::
ExprLit
(
_
)
|
hir
::
ExprRet
(
..
)
|
...
...
@@ -1095,7 +1095,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
// Uninteresting cases: just propagate in rev exec order
hir
::
Expr
Vec
(
ref
exprs
)
=>
{
hir
::
Expr
Array
(
ref
exprs
)
=>
{
self
.propagate_through_exprs
(
&
exprs
[
..
],
succ
)
}
...
...
@@ -1436,7 +1436,7 @@ fn check_expr(this: &mut Liveness, expr: &Expr) {
hir
::
ExprCall
(
..
)
|
hir
::
ExprMethodCall
(
..
)
|
hir
::
ExprIf
(
..
)
|
hir
::
ExprMatch
(
..
)
|
hir
::
ExprWhile
(
..
)
|
hir
::
ExprLoop
(
..
)
|
hir
::
ExprIndex
(
..
)
|
hir
::
ExprField
(
..
)
|
hir
::
ExprTupField
(
..
)
|
hir
::
Expr
Vec
(
..
)
|
hir
::
ExprTup
(
..
)
|
hir
::
ExprBinary
(
..
)
|
hir
::
Expr
Array
(
..
)
|
hir
::
ExprTup
(
..
)
|
hir
::
ExprBinary
(
..
)
|
hir
::
ExprCast
(
..
)
|
hir
::
ExprUnary
(
..
)
|
hir
::
ExprRet
(
..
)
|
hir
::
ExprBreak
(
..
)
|
hir
::
ExprAgain
(
..
)
|
hir
::
ExprLit
(
_
)
|
hir
::
ExprBlock
(
..
)
|
hir
::
ExprAddrOf
(
..
)
|
...
...
src/librustc/middle/mem_categorization.rs
浏览文件 @
cf0b7bdd
...
...
@@ -503,7 +503,7 @@ pub fn cat_expr_unadjusted(&self, expr: &hir::Expr) -> McResult<cmt<'tcx>> {
hir
::
ExprClosure
(
..
)
|
hir
::
ExprRet
(
..
)
|
hir
::
ExprUnary
(
..
)
|
hir
::
ExprMethodCall
(
..
)
|
hir
::
ExprCast
(
..
)
|
hir
::
Expr
Vec
(
..
)
|
hir
::
ExprTup
(
..
)
|
hir
::
ExprIf
(
..
)
|
hir
::
Expr
Array
(
..
)
|
hir
::
ExprTup
(
..
)
|
hir
::
ExprIf
(
..
)
|
hir
::
ExprBinary
(
..
)
|
hir
::
ExprWhile
(
..
)
|
hir
::
ExprBlock
(
..
)
|
hir
::
ExprLoop
(
..
)
|
hir
::
ExprMatch
(
..
)
|
hir
::
ExprLit
(
..
)
|
hir
::
ExprBreak
(
..
)
|
...
...
@@ -1155,7 +1155,7 @@ fn cat_pattern_<F>(&self, cmt: cmt<'tcx>, pat: &hir::Pat, op: &mut F) -> McResul
self
.cat_pattern_
(
subcmt
,
&
subpat
,
op
)
?
;
}
PatKind
::
Vec
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
PatKind
::
Slice
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
let
context
=
InteriorOffsetKind
::
Pattern
;
let
elt_cmt
=
self
.cat_index
(
pat
,
cmt
,
context
)
?
;
for
before_pat
in
before
{
...
...
src/librustc/middle/region.rs
浏览文件 @
cf0b7bdd
...
...
@@ -961,7 +961,7 @@ fn is_binding_pat(pat: &hir::Pat) -> bool {
field_pats
.iter
()
.any
(|
fp
|
is_binding_pat
(
&
fp
.node.pat
))
}
PatKind
::
Vec
(
ref
pats1
,
ref
pats2
,
ref
pats3
)
=>
{
PatKind
::
Slice
(
ref
pats1
,
ref
pats2
,
ref
pats3
)
=>
{
pats1
.iter
()
.any
(|
p
|
is_binding_pat
(
&
p
))
||
pats2
.iter
()
.any
(|
p
|
is_binding_pat
(
&
p
))
||
pats3
.iter
()
.any
(|
p
|
is_binding_pat
(
&
p
))
...
...
@@ -1012,7 +1012,7 @@ fn record_rvalue_scope_if_borrow_expr(visitor: &mut RegionResolutionVisitor,
visitor
,
&
field
.expr
,
blk_id
);
}
}
hir
::
Expr
Vec
(
ref
subexprs
)
|
hir
::
Expr
Array
(
ref
subexprs
)
|
hir
::
ExprTup
(
ref
subexprs
)
=>
{
for
subexpr
in
subexprs
{
record_rvalue_scope_if_borrow_expr
(
...
...
src/librustc/mir/repr.rs
浏览文件 @
cf0b7bdd
...
...
@@ -1016,7 +1016,7 @@ pub enum CastKind {
#[derive(Clone,
Debug,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable)]
pub
enum
AggregateKind
<
'tcx
>
{
Vec
,
Array
,
Tuple
,
/// The second field is variant number (discriminant), it's equal to 0
/// for struct and union expressions. The fourth field is active field
...
...
@@ -1107,8 +1107,6 @@ fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
}
Aggregate
(
ref
kind
,
ref
lvs
)
=>
{
use
self
::
AggregateKind
::
*
;
fn
fmt_tuple
(
fmt
:
&
mut
Formatter
,
lvs
:
&
[
Operand
])
->
fmt
::
Result
{
let
mut
tuple_fmt
=
fmt
.debug_tuple
(
""
);
for
lv
in
lvs
{
...
...
@@ -1118,9 +1116,9 @@ fn fmt_tuple(fmt: &mut Formatter, lvs: &[Operand]) -> fmt::Result {
}
match
*
kind
{
Vec
=>
write!
(
fmt
,
"{:?}"
,
lvs
),
AggregateKind
::
Array
=>
write!
(
fmt
,
"{:?}"
,
lvs
),
Tuple
=>
{
AggregateKind
::
Tuple
=>
{
match
lvs
.len
()
{
0
=>
write!
(
fmt
,
"()"
),
1
=>
write!
(
fmt
,
"({:?},)"
,
lvs
[
0
]),
...
...
@@ -1128,7 +1126,7 @@ fn fmt_tuple(fmt: &mut Formatter, lvs: &[Operand]) -> fmt::Result {
}
}
Adt
(
adt_def
,
variant
,
substs
,
_
)
=>
{
A
ggregateKind
::
A
dt
(
adt_def
,
variant
,
substs
,
_
)
=>
{
let
variant_def
=
&
adt_def
.variants
[
variant
];
ppaux
::
parameterized
(
fmt
,
substs
,
variant_def
.did
,
...
...
@@ -1147,7 +1145,7 @@ fn fmt_tuple(fmt: &mut Formatter, lvs: &[Operand]) -> fmt::Result {
}
}
Closure
(
def_id
,
_
)
=>
ty
::
tls
::
with
(|
tcx
|
{
AggregateKind
::
Closure
(
def_id
,
_
)
=>
ty
::
tls
::
with
(|
tcx
|
{
if
let
Some
(
node_id
)
=
tcx
.map
.as_local_node_id
(
def_id
)
{
let
name
=
format!
(
"[closure@{:?}]"
,
tcx
.map
.span
(
node_id
));
let
mut
struct_fmt
=
fmt
.debug_struct
(
&
name
);
...
...
src/librustc/mir/tcx.rs
浏览文件 @
cf0b7bdd
...
...
@@ -175,7 +175,7 @@ pub fn ty<'a, 'gcx>(&self, mir: &Mir<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Opti
}
&
Rvalue
::
Aggregate
(
ref
ak
,
ref
ops
)
=>
{
match
*
ak
{
AggregateKind
::
Vec
=>
{
AggregateKind
::
Array
=>
{
if
let
Some
(
operand
)
=
ops
.get
(
0
)
{
let
ty
=
operand
.ty
(
mir
,
tcx
);
Some
(
tcx
.mk_array
(
ty
,
ops
.len
()))
...
...
src/librustc/mir/visit.rs
浏览文件 @
cf0b7bdd
...
...
@@ -531,7 +531,7 @@ fn super_rvalue(&mut self,
Rvalue
::
Aggregate
(
ref
$
(
$mutability
)
*
kind
,
ref
$
(
$mutability
)
*
operands
)
=>
{
match
*
kind
{
AggregateKind
::
Vec
=>
{
AggregateKind
::
Array
=>
{
}
AggregateKind
::
Tuple
=>
{
}
...
...
src/librustc/ty/fast_reject.rs
浏览文件 @
cf0b7bdd
...
...
@@ -24,7 +24,7 @@ pub enum SimplifiedType {
FloatSimplifiedType
(
ast
::
FloatTy
),
AdtSimplifiedType
(
DefId
),
StrSimplifiedType
,
Vec
SimplifiedType
,
Array
SimplifiedType
,
PtrSimplifiedType
,
NeverSimplifiedType
,
TupleSimplifiedType
(
usize
),
...
...
@@ -57,7 +57,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
ty
::
TyFloat
(
float_type
)
=>
Some
(
FloatSimplifiedType
(
float_type
)),
ty
::
TyAdt
(
def
,
_
)
=>
Some
(
AdtSimplifiedType
(
def
.did
)),
ty
::
TyStr
=>
Some
(
StrSimplifiedType
),
ty
::
TyArray
(
..
)
|
ty
::
TySlice
(
_
)
=>
Some
(
Vec
SimplifiedType
),
ty
::
TyArray
(
..
)
|
ty
::
TySlice
(
_
)
=>
Some
(
Array
SimplifiedType
),
ty
::
TyRawPtr
(
_
)
=>
Some
(
PtrSimplifiedType
),
ty
::
TyTrait
(
ref
trait_info
)
=>
{
Some
(
TraitSimplifiedType
(
trait_info
.principal
.def_id
()))
...
...
src/librustc/ty/mod.rs
浏览文件 @
cf0b7bdd
...
...
@@ -2228,7 +2228,7 @@ pub fn expr_is_lval(self, expr: &hir::Expr) -> bool {
hir
::
ExprClosure
(
..
)
|
hir
::
ExprBlock
(
..
)
|
hir
::
ExprRepeat
(
..
)
|
hir
::
Expr
Vec
(
..
)
|
hir
::
Expr
Array
(
..
)
|
hir
::
ExprBreak
(
..
)
|
hir
::
ExprAgain
(
..
)
|
hir
::
ExprRet
(
..
)
|
...
...
src/librustc_const_eval/check_match.rs
浏览文件 @
cf0b7bdd
...
...
@@ -610,14 +610,14 @@ fn construct_witness<'a,'tcx>(cx: &MatchCheckCtxt<'a,'tcx>, ctor: &Constructor,
ty
::
TySlice
(
_
)
=>
match
ctor
{
&
Slice
(
n
)
=>
{
assert_eq!
(
pats_len
,
n
);
PatKind
::
Vec
(
pats
.collect
(),
None
,
hir
::
HirVec
::
new
())
PatKind
::
Slice
(
pats
.collect
(),
None
,
hir
::
HirVec
::
new
())
},
_
=>
unreachable!
()
},
ty
::
TyArray
(
_
,
len
)
=>
{
assert_eq!
(
pats_len
,
len
);
PatKind
::
Vec
(
pats
.collect
(),
None
,
hir
::
HirVec
::
new
())
PatKind
::
Slice
(
pats
.collect
(),
None
,
hir
::
HirVec
::
new
())
}
_
=>
{
...
...
@@ -713,7 +713,7 @@ fn is_useful<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>,
};
let
max_slice_length
=
rows
.iter
()
.filter_map
(|
row
|
match
row
[
0
]
.0
.node
{
PatKind
::
Vec
(
ref
before
,
_
,
ref
after
)
=>
Some
(
before
.len
()
+
after
.len
()),
PatKind
::
Slice
(
ref
before
,
_
,
ref
after
)
=>
Some
(
before
.len
()
+
after
.len
()),
_
=>
None
})
.max
()
.map_or
(
0
,
|
v
|
v
+
1
);
...
...
@@ -812,7 +812,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: &Pat,
vec!
[
ConstantValue
(
eval_const_expr
(
cx
.tcx
,
&
expr
))],
PatKind
::
Range
(
ref
lo
,
ref
hi
)
=>
vec!
[
ConstantRange
(
eval_const_expr
(
cx
.tcx
,
&
lo
),
eval_const_expr
(
cx
.tcx
,
&
hi
))],
PatKind
::
Vec
(
ref
before
,
ref
slice
,
ref
after
)
=>
PatKind
::
Slice
(
ref
before
,
ref
slice
,
ref
after
)
=>
match
left_ty
.sty
{
ty
::
TyArray
(
..
)
=>
vec!
[
Single
],
ty
::
TySlice
(
_
)
if
slice
.is_some
()
=>
{
...
...
@@ -1001,7 +1001,7 @@ pub fn specialize<'a, 'b, 'tcx>(
}
}
PatKind
::
Vec
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
PatKind
::
Slice
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
let
pat_len
=
before
.len
()
+
after
.len
();
match
*
constructor
{
Single
=>
{
...
...
src/librustc_const_eval/eval.rs
浏览文件 @
cf0b7bdd
...
...
@@ -317,11 +317,11 @@ pub fn const_expr_to_pat<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
PatKind
::
Struct
(
path
.clone
(),
field_pats
,
false
)
}
hir
::
Expr
Vec
(
ref
exprs
)
=>
{
hir
::
Expr
Array
(
ref
exprs
)
=>
{
let
pats
=
exprs
.iter
()
.map
(|
expr
|
const_expr_to_pat
(
tcx
,
&
expr
,
pat_id
,
span
))
.collect
::
<
Result
<
_
,
_
>>
()
?
;
PatKind
::
Vec
(
pats
,
None
,
hir
::
HirVec
::
new
())
PatKind
::
Slice
(
pats
,
None
,
hir
::
HirVec
::
new
())
}
hir
::
ExprPath
(
_
,
ref
path
)
=>
{
...
...
@@ -898,7 +898,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
Array
(
_
,
n
)
if
idx
>=
n
=>
{
signal!
(
e
,
IndexOutOfBounds
{
len
:
n
,
index
:
idx
})
}
Array
(
v
,
n
)
=>
if
let
hir
::
Expr
Vec
(
ref
v
)
=
tcx
.map
.expect_expr
(
v
)
.node
{
Array
(
v
,
n
)
=>
if
let
hir
::
Expr
Array
(
ref
v
)
=
tcx
.map
.expect_expr
(
v
)
.node
{
assert_eq!
(
n
as
usize
as
u64
,
n
);
eval_const_expr_partial
(
tcx
,
&
v
[
idx
as
usize
],
ty_hint
,
fn_args
)
?
}
else
{
...
...
@@ -925,7 +925,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
_
=>
signal!
(
e
,
IndexedNonVec
),
}
}
hir
::
Expr
Vec
(
ref
v
)
=>
Array
(
e
.id
,
v
.len
()
as
u64
),
hir
::
Expr
Array
(
ref
v
)
=>
Array
(
e
.id
,
v
.len
()
as
u64
),
hir
::
ExprRepeat
(
_
,
ref
n
)
=>
{
let
len_hint
=
ty_hint
.checked_or
(
tcx
.types.usize
);
Repeat
(
...
...
src/librustc_incremental/calculate_svh/svh_visitor.rs
浏览文件 @
cf0b7bdd
...
...
@@ -207,7 +207,7 @@ enum SawExprComponent<'a> {
SawExprAgain
(
Option
<
token
::
InternedString
>
),
SawExprBox
,
SawExpr
Vec
,
SawExpr
Array
,
SawExprCall
,
SawExprMethodCall
,
SawExprTup
,
...
...
@@ -235,7 +235,7 @@ enum SawExprComponent<'a> {
fn
saw_expr
<
'a
>
(
node
:
&
'a
Expr_
)
->
SawExprComponent
<
'a
>
{
match
*
node
{
ExprBox
(
..
)
=>
SawExprBox
,
Expr
Vec
(
..
)
=>
SawExprVec
,
Expr
Array
(
..
)
=>
SawExprArray
,
ExprCall
(
..
)
=>
SawExprCall
,
ExprMethodCall
(
..
)
=>
SawExprMethodCall
,
ExprTup
(
..
)
=>
SawExprTup
,
...
...
src/librustc_mir/build/expr/as_rvalue.rs
浏览文件 @
cf0b7bdd
...
...
@@ -160,7 +160,7 @@ fn expr_as_rvalue(&mut self,
.map
(|
f
|
unpack!
(
block
=
this
.as_operand
(
block
,
f
)))
.collect
();
block
.and
(
Rvalue
::
Aggregate
(
AggregateKind
::
Vec
,
fields
))
block
.and
(
Rvalue
::
Aggregate
(
AggregateKind
::
Array
,
fields
))
}
ExprKind
::
Tuple
{
fields
}
=>
{
// see (*) above
// first process the set of fields
...
...
src/librustc_mir/hair/cx/expr.rs
浏览文件 @
cf0b7bdd
...
...
@@ -613,7 +613,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
value
:
value
.to_ref
(),
value_extents
:
cx
.tcx.region_maps
.node_extent
(
value
.id
)
},
hir
::
Expr
Vec
(
ref
fields
)
=>
hir
::
Expr
Array
(
ref
fields
)
=>
ExprKind
::
Vec
{
fields
:
fields
.to_ref
()
},
hir
::
ExprTup
(
ref
fields
)
=>
ExprKind
::
Tuple
{
fields
:
fields
.to_ref
()
},
...
...
src/librustc_mir/hair/cx/pattern.rs
浏览文件 @
cf0b7bdd
...
...
@@ -113,7 +113,7 @@ fn to_pattern(&mut self, pat: &hir::Pat) -> Pattern<'tcx> {
PatternKind
::
Deref
{
subpattern
:
self
.to_pattern
(
subpattern
)
}
}
PatKind
::
Vec
(
ref
prefix
,
ref
slice
,
ref
suffix
)
=>
{
PatKind
::
Slice
(
ref
prefix
,
ref
slice
,
ref
suffix
)
=>
{
let
ty
=
self
.cx.tcx
.node_id_to_type
(
pat
.id
);
match
ty
.sty
{
ty
::
TyRef
(
_
,
mt
)
=>
...
...
src/librustc_mir/mir_map.rs
浏览文件 @
cf0b7bdd
...
...
@@ -202,7 +202,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
// Array lengths, i.e. [T; constant].
fn
visit_ty
(
&
mut
self
,
ty
:
&
'tcx
hir
::
Ty
)
{
if
let
hir
::
Ty
FixedLengthVec
(
_
,
ref
length
)
=
ty
.node
{
if
let
hir
::
Ty
Array
(
_
,
ref
length
)
=
ty
.node
{
self
.build_const_integer
(
length
);
}
intravisit
::
walk_ty
(
self
,
ty
);
...
...
src/librustc_passes/consts.rs
浏览文件 @
cf0b7bdd
...
...
@@ -602,7 +602,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
hir
::
ExprIndex
(
..
)
|
hir
::
ExprField
(
..
)
|
hir
::
ExprTupField
(
..
)
|
hir
::
Expr
Vec
(
_
)
|
hir
::
Expr
Array
(
_
)
|
hir
::
ExprType
(
..
)
|
hir
::
ExprTup
(
..
)
=>
{}
...
...
src/librustc_trans/mir/constant.rs
浏览文件 @
cf0b7bdd
...
...
@@ -572,7 +572,7 @@ fn const_rvalue(&self, rvalue: &mir::Rvalue<'tcx>,
}
match
*
kind
{
mir
::
AggregateKind
::
Vec
=>
{
mir
::
AggregateKind
::
Array
=>
{
self
.const_array
(
dest_ty
,
&
fields
)
}
mir
::
AggregateKind
::
Adt
(
..
)
|
...
...
src/librustc_typeck/astconv.rs
浏览文件 @
cf0b7bdd
...
...
@@ -1623,7 +1623,7 @@ pub fn ast_ty_to_ty(&self, rscope: &RegionScope, ast_ty: &hir::Ty) -> Ty<'tcx> {
}
let
result_ty
=
match
ast_ty
.node
{
hir
::
Ty
Vec
(
ref
ty
)
=>
{
hir
::
Ty
Slice
(
ref
ty
)
=>
{
tcx
.mk_slice
(
self
.ast_ty_to_ty
(
rscope
,
&
ty
))
}
hir
::
TyObjectSum
(
ref
ty
,
ref
bounds
)
=>
{
...
...
@@ -1758,7 +1758,7 @@ pub fn ast_ty_to_ty(&self, rscope: &RegionScope, ast_ty: &hir::Ty) -> Ty<'tcx> {
ty
}
hir
::
Ty
FixedLengthVec
(
ref
ty
,
ref
e
)
=>
{
hir
::
Ty
Array
(
ref
ty
,
ref
e
)
=>
{
if
let
Ok
(
length
)
=
eval_length
(
tcx
.global_tcx
(),
&
e
,
"array length"
)
{
tcx
.mk_array
(
self
.ast_ty_to_ty
(
rscope
,
&
ty
),
length
)
}
else
{
...
...
src/librustc_typeck/check/_match.rs
浏览文件 @
cf0b7bdd
...
...
@@ -227,7 +227,7 @@ pub fn check_pat(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>) {
tcx
.types.err
}
}
PatKind
::
Vec
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
PatKind
::
Slice
(
ref
before
,
ref
slice
,
ref
after
)
=>
{
let
expected_ty
=
self
.structurally_resolved_type
(
pat
.span
,
expected
);
let
(
inner_ty
,
slice_ty
)
=
match
expected_ty
.sty
{
ty
::
TyArray
(
inner_ty
,
size
)
=>
{
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
cf0b7bdd
...
...
@@ -450,7 +450,7 @@ fn visit_item(&mut self, i: &'tcx hir::Item) {
fn
visit_ty
(
&
mut
self
,
t
:
&
'tcx
hir
::
Ty
)
{
match
t
.node
{
hir
::
Ty
FixedLengthVec
(
_
,
ref
expr
)
=>
{
hir
::
Ty
Array
(
_
,
ref
expr
)
=>
{
check_const_with_type
(
self
.ccx
,
&
expr
,
self
.ccx.tcx.types.usize
,
expr
.id
);
}
_
=>
{}
...
...
@@ -626,7 +626,7 @@ fn visit_block(&mut self, b: &'gcx hir::Block) {
// need to record the type for that node
fn
visit_ty
(
&
mut
self
,
t
:
&
'gcx
hir
::
Ty
)
{
match
t
.node
{
hir
::
Ty
FixedLengthVec
(
ref
ty
,
ref
count_expr
)
=>
{
hir
::
Ty
Array
(
ref
ty
,
ref
count_expr
)
=>
{
self
.visit_ty
(
&
ty
);
self
.fcx
.check_expr_with_hint
(
&
count_expr
,
self
.fcx.tcx.types.usize
);
}
...
...
@@ -3590,7 +3590,7 @@ fn check_expr_kind(&self,
self
.check_method_call
(
expr
,
name
,
&
args
[
..
],
&
tps
[
..
],
expected
,
lvalue_pref
)
}
hir
::
ExprCast
(
ref
e
,
ref
t
)
=>
{
if
let
hir
::
Ty
FixedLengthVec
(
_
,
ref
count_expr
)
=
t
.node
{
if
let
hir
::
Ty
Array
(
_
,
ref
count_expr
)
=
t
.node
{
self
.check_expr_with_hint
(
&
count_expr
,
tcx
.types.usize
);
}
...
...
@@ -3623,7 +3623,7 @@ fn check_expr_kind(&self,
self
.check_expr_eq_type
(
&
e
,
typ
);
typ
}
hir
::
Expr
Vec
(
ref
args
)
=>
{
hir
::
Expr
Array
(
ref
args
)
=>
{
let
uty
=
expected
.to_option
(
self
)
.and_then
(|
uty
|
{
match
uty
.sty
{
ty
::
TyArray
(
ty
,
_
)
|
ty
::
TySlice
(
ty
)
=>
Some
(
ty
),
...
...
src/librustc_typeck/check/writeback.rs
浏览文件 @
cf0b7bdd
...
...
@@ -247,7 +247,7 @@ fn visit_local(&mut self, l: &hir::Local) {
fn
visit_ty
(
&
mut
self
,
t
:
&
hir
::
Ty
)
{
match
t
.node
{
hir
::
Ty
FixedLengthVec
(
ref
ty
,
ref
count_expr
)
=>
{
hir
::
Ty
Array
(
ref
ty
,
ref
count_expr
)
=>
{
self
.visit_ty
(
&
ty
);
write_ty_to_tcx
(
self
.fcx.ccx
,
count_expr
.id
,
self
.tcx
()
.types.usize
);
}
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
cf0b7bdd
...
...
@@ -1646,8 +1646,8 @@ fn clean(&self, cx: &DocContext) -> Type {
TyRptr
(
ref
l
,
ref
m
)
=>
BorrowedRef
{
lifetime
:
l
.clean
(
cx
),
mutability
:
m
.mutbl
.clean
(
cx
),
type_
:
box
m
.ty
.clean
(
cx
)},
Ty
Vec
(
ref
ty
)
=>
Vector
(
box
ty
.clean
(
cx
)),
Ty
FixedLengthVec
(
ref
ty
,
ref
e
)
=>
{
Ty
Slice
(
ref
ty
)
=>
Vector
(
box
ty
.clean
(
cx
)),
Ty
Array
(
ref
ty
,
ref
e
)
=>
{
let
n
=
if
let
Some
(
tcx
)
=
cx
.tcx_opt
()
{
use
rustc_const_math
::{
ConstInt
,
ConstUsize
};
use
rustc_const_eval
::
eval_const_expr
;
...
...
@@ -2699,7 +2699,7 @@ fn name_from_pat(p: &hir::Pat) -> String {
},
PatKind
::
Range
(
..
)
=>
panic!
(
"tried to get argument name from PatKind::Range,
\
which is not allowed in function arguments"
),
PatKind
::
Vec
(
ref
begin
,
ref
mid
,
ref
end
)
=>
{
PatKind
::
Slice
(
ref
begin
,
ref
mid
,
ref
end
)
=>
{
let
begin
=
begin
.iter
()
.map
(|
p
|
name_from_pat
(
&**
p
));
let
mid
=
mid
.as_ref
()
.map
(|
p
|
format!
(
"..{}"
,
name_from_pat
(
&**
p
)))
.into_iter
();
let
end
=
end
.iter
()
.map
(|
p
|
name_from_pat
(
&**
p
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录