Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e0ceef5a
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,发现更多精彩内容 >>
提交
e0ceef5a
编写于
12月 03, 2015
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ExprType to HIR and make everything compile
+ Apply parser changes manually + Add feature gate
上级
b8157cc6
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
83 addition
and
31 deletion
+83
-31
src/librustc/middle/const_eval.rs
src/librustc/middle/const_eval.rs
+1
-1
src/librustc/middle/ty/mod.rs
src/librustc/middle/ty/mod.rs
+4
-0
src/librustc_front/fold.rs
src/librustc_front/fold.rs
+3
-0
src/librustc_front/hir.rs
src/librustc_front/hir.rs
+1
-0
src/librustc_front/intravisit.rs
src/librustc_front/intravisit.rs
+1
-1
src/librustc_front/lowering.rs
src/librustc_front/lowering.rs
+4
-0
src/librustc_front/print/pprust.rs
src/librustc_front/print/pprust.rs
+7
-1
src/librustc_lint/unused.rs
src/librustc_lint/unused.rs
+1
-0
src/librustc_mir/hair/cx/expr.rs
src/librustc_mir/hair/cx/expr.rs
+2
-0
src/librustc_trans/trans/consts.rs
src/librustc_trans/trans/consts.rs
+1
-1
src/librustc_trans/trans/debuginfo/create_scope_map.rs
src/librustc_trans/trans/debuginfo/create_scope_map.rs
+1
-0
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/expr.rs
+4
-0
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+7
-0
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+7
-1
src/libsyntax/util/parser.rs
src/libsyntax/util/parser.rs
+9
-7
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+1
-5
src/libsyntax_ext/asm.rs
src/libsyntax_ext/asm.rs
+3
-3
src/test/compile-fail/type-ascription-feature-gate.rs
src/test/compile-fail/type-ascription-feature-gate.rs
+15
-0
src/test/run-pass/coerce-expect-unsized-ascribed.rs
src/test/run-pass/coerce-expect-unsized-ascribed.rs
+11
-11
未找到文件。
src/librustc/middle/const_eval.rs
浏览文件 @
e0ceef5a
...
...
@@ -1126,7 +1126,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
None
=>
unreachable!
(),
}
}
hir
::
ExprType
(
ref
e
,
_
)
=>
try!
(
eval_const_expr_partial
(
tcx
,
&**
e
,
ety
)),
hir
::
ExprType
(
ref
e
,
_
)
=>
try!
(
eval_const_expr_partial
(
tcx
,
&**
e
,
ty_hint
,
fn_args
)),
hir
::
ExprTup
(
_
)
=>
Tuple
(
e
.id
),
hir
::
ExprStruct
(
..
)
=>
Struct
(
e
.id
),
hir
::
ExprIndex
(
ref
arr
,
ref
idx
)
=>
{
...
...
src/librustc/middle/ty/mod.rs
浏览文件 @
e0ceef5a
...
...
@@ -2108,6 +2108,10 @@ pub fn expr_is_lval(&self, expr: &hir::Expr) -> bool {
}
}
hir
::
ExprType
(
ref
e
,
_
)
=>
{
self
.expr_is_lval
(
e
)
}
hir
::
ExprUnary
(
hir
::
UnDeref
,
_
)
|
hir
::
ExprField
(
..
)
|
hir
::
ExprTupField
(
..
)
|
...
...
src/librustc_front/fold.rs
浏览文件 @
e0ceef5a
...
...
@@ -1042,6 +1042,9 @@ pub fn noop_fold_expr<T: Folder>(Expr { id, node, span, attrs }: Expr, folder: &
ExprCast
(
expr
,
ty
)
=>
{
ExprCast
(
folder
.fold_expr
(
expr
),
folder
.fold_ty
(
ty
))
}
ExprType
(
expr
,
ty
)
=>
{
ExprType
(
folder
.fold_expr
(
expr
),
folder
.fold_ty
(
ty
))
}
ExprAddrOf
(
m
,
ohs
)
=>
ExprAddrOf
(
m
,
folder
.fold_expr
(
ohs
)),
ExprIf
(
cond
,
tr
,
fl
)
=>
{
ExprIf
(
folder
.fold_expr
(
cond
),
...
...
src/librustc_front/hir.rs
浏览文件 @
e0ceef5a
...
...
@@ -720,6 +720,7 @@ pub enum Expr_ {
ExprLit
(
P
<
Lit
>
),
/// A cast (`foo as f64`)
ExprCast
(
P
<
Expr
>
,
P
<
Ty
>
),
ExprType
(
P
<
Expr
>
,
P
<
Ty
>
),
/// An `if` block, with an optional else block
///
/// `if expr { block } else { expr }`
...
...
src/librustc_front/intravisit.rs
浏览文件 @
e0ceef5a
...
...
@@ -732,7 +732,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
visitor
.visit_expr
(
subexpression
)
}
ExprLit
(
_
)
=>
{}
ExprCast
(
ref
subexpression
,
ref
typ
)
=>
{
ExprCast
(
ref
subexpression
,
ref
typ
)
|
ExprType
(
ref
subexpression
,
ref
typ
)
=>
{
visitor
.visit_expr
(
subexpression
);
visitor
.visit_ty
(
typ
)
}
...
...
src/librustc_front/lowering.rs
浏览文件 @
e0ceef5a
...
...
@@ -1125,6 +1125,10 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P<hir::Expr> {
let
expr
=
lower_expr
(
lctx
,
expr
);
hir
::
ExprCast
(
expr
,
lower_ty
(
lctx
,
ty
))
}
ExprType
(
ref
expr
,
ref
ty
)
=>
{
let
expr
=
lower_expr
(
lctx
,
expr
);
hir
::
ExprType
(
expr
,
lower_ty
(
lctx
,
ty
))
}
ExprAddrOf
(
m
,
ref
ohs
)
=>
{
let
m
=
lower_mutability
(
lctx
,
m
);
let
ohs
=
lower_expr
(
lctx
,
ohs
);
...
...
src/librustc_front/print/pprust.rs
浏览文件 @
e0ceef5a
...
...
@@ -336,7 +336,8 @@ fn needs_parentheses(expr: &hir::Expr) -> bool {
hir
::
ExprBinary
(
..
)
|
hir
::
ExprClosure
(
..
)
|
hir
::
ExprAssignOp
(
..
)
|
hir
::
ExprCast
(
..
)
=>
true
,
hir
::
ExprCast
(
..
)
|
hir
::
ExprType
(
..
)
=>
true
,
_
=>
false
,
}
}
...
...
@@ -1354,6 +1355,11 @@ pub fn print_expr(&mut self, expr: &hir::Expr) -> io::Result<()> {
try!
(
self
.word_space
(
"as"
));
try!
(
self
.print_type
(
&**
ty
));
}
hir
::
ExprType
(
ref
expr
,
ref
ty
)
=>
{
try!
(
self
.print_expr
(
&**
expr
));
try!
(
self
.word_space
(
":"
));
try!
(
self
.print_type
(
&**
ty
));
}
hir
::
ExprIf
(
ref
test
,
ref
blk
,
ref
elseopt
)
=>
{
try!
(
self
.print_if
(
&**
test
,
&**
blk
,
elseopt
.as_ref
()
.map
(|
e
|
&**
e
)));
}
...
...
src/librustc_lint/unused.rs
浏览文件 @
e0ceef5a
...
...
@@ -319,6 +319,7 @@ fn contains_exterior_struct_lit(value: &ast::Expr) -> bool {
}
ast
::
ExprUnary
(
_
,
ref
x
)
|
ast
::
ExprCast
(
ref
x
,
_
)
|
ast
::
ExprType
(
ref
x
,
_
)
|
ast
::
ExprField
(
ref
x
,
_
)
|
ast
::
ExprTupField
(
ref
x
,
_
)
|
ast
::
ExprIndex
(
ref
x
,
_
)
=>
{
...
...
src/librustc_mir/hair/cx/expr.rs
浏览文件 @
e0ceef5a
...
...
@@ -320,6 +320,8 @@ fn make_mirror<'a>(self, cx: &mut Cx<'a, 'tcx>) -> Expr<'tcx> {
name
:
Field
::
new
(
index
.node
as
usize
)
},
hir
::
ExprCast
(
ref
source
,
_
)
=>
ExprKind
::
Cast
{
source
:
source
.to_ref
()
},
hir
::
ExprType
(
ref
source
,
_
)
=>
return
source
.make_mirror
(
cx
),
hir
::
ExprBox
(
ref
value
)
=>
ExprKind
::
Box
{
value
:
value
.to_ref
()
},
hir
::
ExprVec
(
ref
fields
)
=>
...
...
src/librustc_trans/trans/consts.rs
浏览文件 @
e0ceef5a
...
...
@@ -1004,7 +1004,7 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
try!
(
const_fn_call
(
cx
,
MethodCallKey
(
method_call
),
method_did
,
&
arg_vals
,
param_substs
,
trueconst
))
},
hir
::
ExprType
(
ref
e
,
_
)
=>
const_expr
(
cx
,
&**
e
,
param_substs
)
.0
,
hir
::
ExprType
(
ref
e
,
_
)
=>
try!
(
const_expr
(
cx
,
&**
e
,
param_substs
,
fn_args
,
trueconst
)
)
.0
,
hir
::
ExprBlock
(
ref
block
)
=>
{
match
block
.expr
{
Some
(
ref
expr
)
=>
try!
(
const_expr
(
...
...
src/librustc_trans/trans/debuginfo/create_scope_map.rs
浏览文件 @
e0ceef5a
...
...
@@ -320,6 +320,7 @@ fn walk_expr(cx: &CrateContext,
hir
::
ExprPath
(
..
)
=>
{}
hir
::
ExprCast
(
ref
sub_exp
,
_
)
|
hir
::
ExprType
(
ref
sub_exp
,
_
)
|
hir
::
ExprAddrOf
(
_
,
ref
sub_exp
)
|
hir
::
ExprField
(
ref
sub_exp
,
_
)
|
hir
::
ExprTupField
(
ref
sub_exp
,
_
)
=>
...
...
src/librustc_trans/trans/expr.rs
浏览文件 @
e0ceef5a
...
...
@@ -2610,6 +2610,10 @@ fn expr_kind(tcx: &ty::ctxt, expr: &hir::Expr) -> ExprKind {
}
}
hir
::
ExprType
(
ref
expr
,
_
)
=>
{
expr_kind
(
tcx
,
expr
)
}
hir
::
ExprUnary
(
hir
::
UnDeref
,
_
)
|
hir
::
ExprField
(
..
)
|
hir
::
ExprTupField
(
..
)
|
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
e0ceef5a
...
...
@@ -233,6 +233,9 @@
// Allows `#[deprecated]` attribute
(
"deprecated"
,
"1.6.0"
,
Some
(
29935
),
Active
),
// allow using type ascription in expressions
(
"type_ascription"
,
"1.6.0"
,
Some
(
23416
),
Active
),
];
// (changing above list without updating src/doc/reference.md makes @cmr sad)
...
...
@@ -960,6 +963,10 @@ fn visit_expr(&mut self, e: &ast::Expr) {
"box expression syntax is experimental;
\
you can call `Box::new` instead."
);
}
ast
::
ExprType
(
..
)
=>
{
self
.gate_feature
(
"type_ascription"
,
e
.span
,
"type ascription is experimental"
);
}
_
=>
{}
}
visit
::
walk_expr
(
self
,
e
);
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
e0ceef5a
...
...
@@ -2789,6 +2789,10 @@ pub fn parse_assoc_expr_with(&mut self,
lhs
=
self
.mk_expr
(
lhs
.span.lo
,
rhs
.span.hi
,
ExprCast
(
lhs
,
rhs
),
None
);
continue
}
else
if
op
==
AssocOp
::
Colon
{
let
rhs
=
try!
(
self
.parse_ty
());
lhs
=
self
.mk_expr
(
lhs
.span.lo
,
rhs
.span.hi
,
ExprType
(
lhs
,
rhs
));
continue
}
else
if
op
==
AssocOp
::
DotDot
{
// If we didn’t have to handle `x..`, it would be pretty easy to generalise
// it to the Fixity::None code.
...
...
@@ -2857,7 +2861,9 @@ pub fn parse_assoc_expr_with(&mut self,
let
aopexpr
=
self
.mk_assign_op
(
codemap
::
respan
(
cur_op_span
,
aop
),
lhs
,
rhs
);
self
.mk_expr
(
lhs_span
.lo
,
rhs_span
.hi
,
aopexpr
,
None
)
}
AssocOp
::
As
|
AssocOp
::
DotDot
=>
self
.bug
(
"As or DotDot branch reached"
)
AssocOp
::
As
|
AssocOp
::
Colon
|
AssocOp
::
DotDot
=>
{
self
.bug
(
"As, Colon or DotDot branch reached"
)
}
};
if
op
.fixity
()
==
Fixity
::
None
{
break
}
...
...
src/libsyntax/util/parser.rs
浏览文件 @
e0ceef5a
...
...
@@ -60,7 +60,9 @@ pub enum AssocOp {
/// `as`
As
,
/// `..` range
DotDot
DotDot
,
/// `:`
Colon
,
}
#[derive(Debug,
PartialEq,
Eq)]
...
...
@@ -100,6 +102,7 @@ pub fn from_token(t: &Token) -> Option<AssocOp> {
Token
::
AndAnd
=>
Some
(
LAnd
),
Token
::
OrOr
=>
Some
(
LOr
),
Token
::
DotDot
=>
Some
(
DotDot
),
Token
::
Colon
=>
Some
(
Colon
),
_
if
t
.is_keyword
(
keywords
::
As
)
=>
Some
(
As
),
_
=>
None
}
...
...
@@ -134,7 +137,7 @@ pub fn from_ast_binop(op: ast::BinOp_) -> Self {
pub
fn
precedence
(
&
self
)
->
usize
{
use
self
::
AssocOp
::
*
;
match
*
self
{
As
=>
14
,
As
|
Colon
=>
14
,
Multiply
|
Divide
|
Modulus
=>
13
,
Add
|
Subtract
=>
12
,
ShiftLeft
|
ShiftRight
=>
11
,
...
...
@@ -158,7 +161,7 @@ pub fn fixity(&self) -> Fixity {
Inplace
|
Assign
|
AssignOp
(
_
)
=>
Fixity
::
Right
,
As
|
Multiply
|
Divide
|
Modulus
|
Add
|
Subtract
|
ShiftLeft
|
ShiftRight
|
BitAnd
|
BitXor
|
BitOr
|
Less
|
Greater
|
LessEqual
|
GreaterEqual
|
Equal
|
NotEqual
|
LAnd
|
LOr
=>
Fixity
::
Left
,
LAnd
|
LOr
|
Colon
=>
Fixity
::
Left
,
DotDot
=>
Fixity
::
None
}
}
...
...
@@ -168,7 +171,7 @@ pub fn is_comparison(&self) -> bool {
match
*
self
{
Less
|
Greater
|
LessEqual
|
GreaterEqual
|
Equal
|
NotEqual
=>
true
,
Inplace
|
Assign
|
AssignOp
(
_
)
|
As
|
Multiply
|
Divide
|
Modulus
|
Add
|
Subtract
|
ShiftLeft
|
ShiftRight
|
BitAnd
|
BitXor
|
BitOr
|
LAnd
|
LOr
|
DotDot
=>
false
ShiftLeft
|
ShiftRight
|
BitAnd
|
BitXor
|
BitOr
|
LAnd
|
LOr
|
DotDot
|
Colon
=>
false
}
}
...
...
@@ -178,7 +181,7 @@ pub fn is_assign_like(&self) -> bool {
Assign
|
AssignOp
(
_
)
|
Inplace
=>
true
,
Less
|
Greater
|
LessEqual
|
GreaterEqual
|
Equal
|
NotEqual
|
As
|
Multiply
|
Divide
|
Modulus
|
Add
|
Subtract
|
ShiftLeft
|
ShiftRight
|
BitAnd
|
BitXor
|
BitOr
|
LAnd
|
LOr
|
DotDot
=>
false
LOr
|
DotDot
|
Colon
=>
false
}
}
...
...
@@ -203,8 +206,7 @@ pub fn to_ast_binop(&self) -> Option<ast::BinOp_> {
BitOr
=>
Some
(
ast
::
BiBitOr
),
LAnd
=>
Some
(
ast
::
BiAnd
),
LOr
=>
Some
(
ast
::
BiOr
),
Inplace
|
Assign
|
AssignOp
(
_
)
|
As
|
DotDot
=>
None
Inplace
|
Assign
|
AssignOp
(
_
)
|
As
|
DotDot
|
Colon
=>
None
}
}
}
src/libsyntax/visit.rs
浏览文件 @
e0ceef5a
...
...
@@ -693,14 +693,10 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) {
visitor
.visit_expr
(
subexpression
)
}
ExprLit
(
_
)
=>
{}
ExprCast
(
ref
subexpression
,
ref
typ
)
=>
{
ExprCast
(
ref
subexpression
,
ref
typ
)
|
ExprType
(
ref
subexpression
,
ref
typ
)
=>
{
visitor
.visit_expr
(
subexpression
);
visitor
.visit_ty
(
typ
)
}
ExprType
(
ref
subexpression
,
ref
typ
)
=>
{
visitor
.visit_expr
(
&**
subexpression
);
visitor
.visit_ty
(
&**
typ
)
}
ExprIf
(
ref
head_expression
,
ref
if_block
,
ref
optional_else
)
=>
{
visitor
.visit_expr
(
head_expression
);
visitor
.visit_block
(
if_block
);
...
...
src/libsyntax_ext/asm.rs
浏览文件 @
e0ceef5a
...
...
@@ -62,8 +62,8 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
// parsed as `asm!(z)` with `z = "x": y` which is type ascription.
let
first_colon
=
tts
.iter
()
.position
(|
tt
|
{
match
*
tt
{
ast
::
T
t
Token
(
_
,
token
::
Colon
)
|
ast
::
T
t
Token
(
_
,
token
::
ModSep
)
=>
true
,
ast
::
T
okenTree
::
Token
(
_
,
token
::
Colon
)
|
ast
::
T
okenTree
::
Token
(
_
,
token
::
ModSep
)
=>
true
,
_
=>
false
}
})
.unwrap_or
(
tts
.len
());
...
...
@@ -99,7 +99,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
// This is most likely malformed.
if
p2
.token
!=
token
::
Eof
{
let
mut
extra_tts
=
p
2
.parse_all_token_trees
(
);
let
mut
extra_tts
=
p
anictry!
(
p2
.parse_all_token_trees
()
);
extra_tts
.extend
(
tts
[
first_colon
..
]
.iter
()
.cloned
());
p
=
parse
::
tts_to_parser
(
cx
.parse_sess
,
extra_tts
,
cx
.cfg
());
}
...
...
src/test/compile-fail/type-ascription-feature-gate.rs
0 → 100644
浏览文件 @
e0ceef5a
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Type ascription is feature gated
fn
main
()
{
let
a
=
10
:
u8
;
//~ ERROR type ascription is experimental
}
src/test/run-pass/coerce-expect-unsized-ascribed.rs
浏览文件 @
e0ceef5a
...
...
@@ -16,25 +16,25 @@
// A version of coerce-expect-unsized that uses type ascription.
pub
fn
main
()
{
let
_
=
box
{
[
1
,
2
,
3
]
}:
Box
<
[
i
nt
]
>
;
let
_
=
box
if
true
{
[
1
,
2
,
3
]
}
else
{
[
1
,
3
,
4
]
}:
Box
<
[
i
nt
]
>
;
let
_
=
box
match
true
{
true
=>
[
1
,
2
,
3
],
false
=>
[
1
,
3
,
4
]
}:
Box
<
[
i
nt
]
>
;
let
_
=
box
{
|
x
|
(
x
as
u8
)
}:
Box
<
Fn
(
i
nt
)
->
_
>
;
let
_
=
box
{
[
1
,
2
,
3
]
}:
Box
<
[
i
32
]
>
;
let
_
=
box
if
true
{
[
1
,
2
,
3
]
}
else
{
[
1
,
3
,
4
]
}:
Box
<
[
i
32
]
>
;
let
_
=
box
match
true
{
true
=>
[
1
,
2
,
3
],
false
=>
[
1
,
3
,
4
]
}:
Box
<
[
i
32
]
>
;
let
_
=
box
{
|
x
|
(
x
as
u8
)
}:
Box
<
Fn
(
i
32
)
->
_
>
;
let
_
=
box
if
true
{
false
}
else
{
true
}:
Box
<
Debug
>
;
let
_
=
box
match
true
{
true
=>
'a'
,
false
=>
'b'
}:
Box
<
Debug
>
;
let
_
=
&
{
[
1
,
2
,
3
]
}:
&
[
i
nt
];
let
_
=
&
if
true
{
[
1
,
2
,
3
]
}
else
{
[
1
,
3
,
4
]
}:
&
[
i
nt
];
let
_
=
&
match
true
{
true
=>
[
1
,
2
,
3
],
false
=>
[
1
,
3
,
4
]
}:
&
[
i
nt
];
let
_
=
&
{
|
x
|
(
x
as
u8
)
}:
&
Fn
(
i
nt
)
->
_
;
let
_
=
&
{
[
1
,
2
,
3
]
}:
&
[
i
32
];
let
_
=
&
if
true
{
[
1
,
2
,
3
]
}
else
{
[
1
,
3
,
4
]
}:
&
[
i
32
];
let
_
=
&
match
true
{
true
=>
[
1
,
2
,
3
],
false
=>
[
1
,
3
,
4
]
}:
&
[
i
32
];
let
_
=
&
{
|
x
|
(
x
as
u8
)
}:
&
Fn
(
i
32
)
->
_
;
let
_
=
&
if
true
{
false
}
else
{
true
}:
&
Debug
;
let
_
=
&
match
true
{
true
=>
'a'
,
false
=>
'b'
}:
&
Debug
;
let
_
=
Box
::
new
([
1
,
2
,
3
]):
Box
<
[
i
nt
]
>
;
let
_
=
Box
::
new
(|
x
|
(
x
as
u8
)):
Box
<
Fn
(
i
nt
)
->
_
>
;
let
_
=
Box
::
new
([
1
,
2
,
3
]):
Box
<
[
i
32
]
>
;
let
_
=
Box
::
new
(|
x
|
(
x
as
u8
)):
Box
<
Fn
(
i
32
)
->
_
>
;
let
_
=
vec!
[
Box
::
new
(|
x
|
(
x
as
u8
)),
box
|
x
|
(
x
as
i16
as
u8
),
]:
Vec
<
Box
<
Fn
(
i
nt
)
->
_
>>
;
]:
Vec
<
Box
<
Fn
(
i
32
)
->
_
>>
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录