Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
954ae9c9
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,发现更多精彩内容 >>
提交
954ae9c9
编写于
3月 05, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libsyntax: Remove struct literal expressions from the compiler
上级
4e3dbfe0
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
24 addition
and
143 deletion
+24
-143
src/librustc/middle/check_const.rs
src/librustc/middle/check_const.rs
+1
-2
src/librustc/middle/const_eval.rs
src/librustc/middle/const_eval.rs
+1
-2
src/librustc/middle/lint.rs
src/librustc/middle/lint.rs
+0
-27
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+14
-28
src/librustc/middle/mem_categorization.rs
src/librustc/middle/mem_categorization.rs
+1
-2
src/librustc/middle/moves.rs
src/librustc/middle/moves.rs
+0
-1
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/consts.rs
+0
-6
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/expr.rs
+0
-1
src/librustc/middle/trans/type_use.rs
src/librustc/middle/trans/type_use.rs
+2
-5
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+0
-1
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+0
-3
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/regionck.rs
+0
-1
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+0
-1
src/libsyntax/ext/build.rs
src/libsyntax/ext/build.rs
+0
-7
src/libsyntax/ext/log_syntax.rs
src/libsyntax/ext/log_syntax.rs
+4
-1
src/libsyntax/fold.rs
src/libsyntax/fold.rs
+0
-6
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+1
-29
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+0
-16
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+0
-4
未找到文件。
src/librustc/middle/check_const.rs
浏览文件 @
954ae9c9
...
@@ -162,8 +162,7 @@ pub fn check_expr(sess: Session,
...
@@ -162,8 +162,7 @@ pub fn check_expr(sess: Session,
expr_field
(
*
)
|
expr_field
(
*
)
|
expr_index
(
*
)
|
expr_index
(
*
)
|
expr_tup
(
*
)
|
expr_tup
(
*
)
|
expr_struct
(
_
,
_
,
None
)
|
expr_struct
(
_
,
_
,
None
)
=>
{
}
expr_rec
(
_
,
None
)
=>
{
}
expr_addr_of
(
*
)
=>
{
expr_addr_of
(
*
)
=>
{
sess
.span_err
(
sess
.span_err
(
e
.span
,
e
.span
,
...
...
src/librustc/middle/const_eval.rs
浏览文件 @
954ae9c9
...
@@ -117,8 +117,7 @@ pub fn classify(e: @expr,
...
@@ -117,8 +117,7 @@ pub fn classify(e: @expr,
}
}
}
}
ast
::
expr_struct
(
_
,
ref
fs
,
None
)
|
ast
::
expr_struct
(
_
,
ref
fs
,
None
)
=>
{
ast
::
expr_rec
(
ref
fs
,
None
)
=>
{
let
cs
=
do
vec
::
map
((
*
fs
))
|
f
|
{
let
cs
=
do
vec
::
map
((
*
fs
))
|
f
|
{
if
f
.node.mutbl
==
ast
::
m_imm
{
if
f
.node.mutbl
==
ast
::
m_imm
{
classify
(
f
.node.expr
,
def_map
,
tcx
)
classify
(
f
.node.expr
,
def_map
,
tcx
)
...
...
src/librustc/middle/lint.rs
浏览文件 @
954ae9c9
...
@@ -73,7 +73,6 @@ pub enum lint {
...
@@ -73,7 +73,6 @@ pub enum lint {
deprecated_mode
,
deprecated_mode
,
deprecated_pattern
,
deprecated_pattern
,
non_camel_case_types
,
non_camel_case_types
,
structural_records
,
type_limits
,
type_limits
,
default_methods
,
default_methods
,
deprecated_self
,
deprecated_self
,
...
@@ -217,13 +216,6 @@ pub fn get_lint_dict() -> LintDict {
...
@@ -217,13 +216,6 @@ pub fn get_lint_dict() -> LintDict {
default
:
allow
default
:
allow
}),
}),
(
@~
"structural_records"
,
@
LintSpec
{
lint
:
structural_records
,
desc
:
"use of any structural records"
,
default
:
deny
}),
(
@~
"legacy modes"
,
(
@~
"legacy modes"
,
@
LintSpec
{
@
LintSpec
{
lint
:
legacy_modes
,
lint
:
legacy_modes
,
...
@@ -486,7 +478,6 @@ fn check_item(i: @ast::item, cx: ty::ctxt) {
...
@@ -486,7 +478,6 @@ fn check_item(i: @ast::item, cx: ty::ctxt) {
check_item_path_statement
(
cx
,
i
);
check_item_path_statement
(
cx
,
i
);
check_item_non_camel_case_types
(
cx
,
i
);
check_item_non_camel_case_types
(
cx
,
i
);
check_item_heap
(
cx
,
i
);
check_item_heap
(
cx
,
i
);
check_item_structural_records
(
cx
,
i
);
check_item_deprecated_modes
(
cx
,
i
);
check_item_deprecated_modes
(
cx
,
i
);
check_item_type_limits
(
cx
,
i
);
check_item_type_limits
(
cx
,
i
);
check_item_default_methods
(
cx
,
i
);
check_item_default_methods
(
cx
,
i
);
...
@@ -729,24 +720,6 @@ fn check_item_deprecated_mutable_fields(cx: ty::ctxt, item: @ast::item) {
...
@@ -729,24 +720,6 @@ fn check_item_deprecated_mutable_fields(cx: ty::ctxt, item: @ast::item) {
}
}
}
}
fn
check_item_structural_records
(
cx
:
ty
::
ctxt
,
it
:
@
ast
::
item
)
{
let
visit
=
item_stopping_visitor
(
visit
::
mk_simple_visitor
(
@
visit
::
SimpleVisitor
{
visit_expr
:
|
e
:
@
ast
::
expr
|
{
match
e
.node
{
ast
::
expr_rec
(
*
)
=>
cx
.sess
.span_lint
(
structural_records
,
e
.id
,
it
.id
,
e
.span
,
~
"structural records are deprecated"
),
_
=>
()
}
},
..
*
visit
::
default_simple_visitor
()
}));
visit
::
visit_item
(
it
,
(),
visit
);
}
fn
check_item_ctypes
(
cx
:
ty
::
ctxt
,
it
:
@
ast
::
item
)
{
fn
check_item_ctypes
(
cx
:
ty
::
ctxt
,
it
:
@
ast
::
item
)
{
fn
check_foreign_fn
(
cx
:
ty
::
ctxt
,
fn_id
:
ast
::
node_id
,
fn
check_foreign_fn
(
cx
:
ty
::
ctxt
,
fn_id
:
ast
::
node_id
,
...
...
src/librustc/middle/liveness.rs
浏览文件 @
954ae9c9
...
@@ -615,16 +615,13 @@ fn visit_expr(expr: @expr, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
...
@@ -615,16 +615,13 @@ fn visit_expr(expr: @expr, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
}
}
// otherwise, live nodes are not required:
// otherwise, live nodes are not required:
expr_index
(
*
)
|
expr_field
(
*
)
|
expr_vstore
(
*
)
|
expr_index
(
*
)
|
expr_field
(
*
)
|
expr_vstore
(
*
)
|
expr_vec
(
*
)
|
expr_vec
(
*
)
|
expr_rec
(
*
)
|
expr_call
(
*
)
|
expr_method_call
(
*
)
|
expr_call
(
*
)
|
expr_method_call
(
*
)
|
expr_tup
(
*
)
|
expr_log
(
*
)
|
expr_tup
(
*
)
|
expr_log
(
*
)
|
expr_binary
(
*
)
|
expr_binary
(
*
)
|
expr_assert
(
*
)
|
expr_addr_of
(
*
)
|
expr_copy
(
*
)
|
expr_assert
(
*
)
|
expr_addr_of
(
*
)
|
expr_copy
(
*
)
|
expr_loop_body
(
*
)
|
expr_do_body
(
*
)
|
expr_cast
(
*
)
|
expr_unary
(
*
)
|
expr_loop_body
(
*
)
|
expr_do_body
(
*
)
|
expr_cast
(
*
)
|
expr_unary
(
*
)
|
expr_break
(
_
)
|
expr_again
(
_
)
|
expr_lit
(
_
)
|
expr_ret
(
*
)
|
expr_break
(
_
)
|
expr_again
(
_
)
|
expr_lit
(
_
)
|
expr_ret
(
*
)
|
expr_block
(
*
)
|
expr_assign
(
*
)
|
expr_block
(
*
)
|
expr_assign
(
*
)
|
expr_swap
(
*
)
|
expr_assign_op
(
*
)
|
expr_swap
(
*
)
|
expr_assign_op
(
*
)
|
expr_mac
(
*
)
|
expr_struct
(
*
)
|
expr_mac
(
*
)
|
expr_struct
(
*
)
|
expr_repeat
(
*
)
|
expr_paren
(
*
)
=>
{
expr_repeat
(
*
)
|
expr_paren
(
*
)
=>
{
visit
::
visit_expr
(
expr
,
self
,
vt
);
visit
::
visit_expr
(
expr
,
self
,
vt
);
}
}
}
}
...
@@ -1287,13 +1284,6 @@ fn propagate_through_expr(&self, expr: @expr, succ: LiveNode)
...
@@ -1287,13 +1284,6 @@ fn propagate_through_expr(&self, expr: @expr, succ: LiveNode)
self
.propagate_through_expr
(
element
,
succ
)
self
.propagate_through_expr
(
element
,
succ
)
}
}
expr_rec
(
ref
fields
,
with_expr
)
=>
{
let
succ
=
self
.propagate_through_opt_expr
(
with_expr
,
succ
);
do
(
*
fields
)
.foldr
(
succ
)
|
field
,
succ
|
{
self
.propagate_through_expr
(
field
.node.expr
,
succ
)
}
}
expr_struct
(
_
,
ref
fields
,
with_expr
)
=>
{
expr_struct
(
_
,
ref
fields
,
with_expr
)
=>
{
let
succ
=
self
.propagate_through_opt_expr
(
with_expr
,
succ
);
let
succ
=
self
.propagate_through_opt_expr
(
with_expr
,
succ
);
do
(
*
fields
)
.foldr
(
succ
)
|
field
,
succ
|
{
do
(
*
fields
)
.foldr
(
succ
)
|
field
,
succ
|
{
...
@@ -1618,18 +1608,14 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
...
@@ -1618,18 +1608,14 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
}
}
// no correctness conditions related to liveness
// no correctness conditions related to liveness
expr_call
(
*
)
|
expr_method_call
(
*
)
|
expr_call
(
*
)
|
expr_method_call
(
*
)
|
expr_if
(
*
)
|
expr_match
(
*
)
|
expr_if
(
*
)
|
expr_match
(
*
)
|
expr_while
(
*
)
|
expr_loop
(
*
)
|
expr_index
(
*
)
|
expr_field
(
*
)
|
expr_while
(
*
)
|
expr_loop
(
*
)
|
expr_vstore
(
*
)
|
expr_vec
(
*
)
|
expr_tup
(
*
)
|
expr_log
(
*
)
|
expr_index
(
*
)
|
expr_field
(
*
)
|
expr_vstore
(
*
)
|
expr_binary
(
*
)
|
expr_assert
(
*
)
|
expr_copy
(
*
)
|
expr_loop_body
(
*
)
|
expr_vec
(
*
)
|
expr_rec
(
*
)
|
expr_tup
(
*
)
|
expr_do_body
(
*
)
|
expr_cast
(
*
)
|
expr_unary
(
*
)
|
expr_ret
(
*
)
|
expr_log
(
*
)
|
expr_binary
(
*
)
|
expr_break
(
*
)
|
expr_again
(
*
)
|
expr_lit
(
_
)
|
expr_block
(
*
)
|
expr_assert
(
*
)
|
expr_copy
(
*
)
|
expr_swap
(
*
)
|
expr_mac
(
*
)
|
expr_addr_of
(
*
)
|
expr_struct
(
*
)
|
expr_loop_body
(
*
)
|
expr_do_body
(
*
)
|
expr_repeat
(
*
)
|
expr_paren
(
*
)
=>
{
expr_cast
(
*
)
|
expr_unary
(
*
)
|
expr_ret
(
*
)
|
expr_break
(
*
)
|
expr_again
(
*
)
|
expr_lit
(
_
)
|
expr_block
(
*
)
|
expr_swap
(
*
)
|
expr_mac
(
*
)
|
expr_addr_of
(
*
)
|
expr_struct
(
*
)
|
expr_repeat
(
*
)
|
expr_paren
(
*
)
=>
{
visit
::
visit_expr
(
expr
,
self
,
vt
);
visit
::
visit_expr
(
expr
,
self
,
vt
);
}
}
}
}
...
...
src/librustc/middle/mem_categorization.rs
浏览文件 @
954ae9c9
...
@@ -449,8 +449,7 @@ fn cat_expr_unadjusted(&self, expr: @ast::expr) -> cmt {
...
@@ -449,8 +449,7 @@ fn cat_expr_unadjusted(&self, expr: @ast::expr) -> cmt {
ast
::
expr_binary
(
*
)
|
ast
::
expr_while
(
*
)
|
ast
::
expr_binary
(
*
)
|
ast
::
expr_while
(
*
)
|
ast
::
expr_block
(
*
)
|
ast
::
expr_loop
(
*
)
|
ast
::
expr_match
(
*
)
|
ast
::
expr_block
(
*
)
|
ast
::
expr_loop
(
*
)
|
ast
::
expr_match
(
*
)
|
ast
::
expr_lit
(
*
)
|
ast
::
expr_break
(
*
)
|
ast
::
expr_mac
(
*
)
|
ast
::
expr_lit
(
*
)
|
ast
::
expr_break
(
*
)
|
ast
::
expr_mac
(
*
)
|
ast
::
expr_again
(
*
)
|
ast
::
expr_rec
(
*
)
|
ast
::
expr_struct
(
*
)
|
ast
::
expr_again
(
*
)
|
ast
::
expr_struct
(
*
)
|
ast
::
expr_repeat
(
*
)
=>
{
ast
::
expr_repeat
(
*
)
=>
{
return
self
.cat_rvalue
(
expr
,
expr_ty
);
return
self
.cat_rvalue
(
expr
,
expr_ty
);
}
}
}
}
...
...
src/librustc/middle/moves.rs
浏览文件 @
954ae9c9
...
@@ -469,7 +469,6 @@ fn use_expr(&self,
...
@@ -469,7 +469,6 @@ fn use_expr(&self,
self
.use_fn_args
(
expr
.callee_id
,
*
args
,
visitor
);
self
.use_fn_args
(
expr
.callee_id
,
*
args
,
visitor
);
}
}
expr_rec
(
ref
fields
,
opt_with
)
|
expr_struct
(
_
,
ref
fields
,
opt_with
)
=>
{
expr_struct
(
_
,
ref
fields
,
opt_with
)
=>
{
for
fields
.each
|
field
|
{
for
fields
.each
|
field
|
{
self
.consume_expr
(
field
.node.expr
,
visitor
);
self
.consume_expr
(
field
.node.expr
,
visitor
);
...
...
src/librustc/middle/trans/consts.rs
浏览文件 @
954ae9c9
...
@@ -368,12 +368,6 @@ fn const_expr_unchecked(cx: @CrateContext, e: @ast::expr) -> ValueRef {
...
@@ -368,12 +368,6 @@ fn const_expr_unchecked(cx: @CrateContext, e: @ast::expr) -> ValueRef {
let
repr
=
adt
::
represent_type
(
cx
,
ety
);
let
repr
=
adt
::
represent_type
(
cx
,
ety
);
adt
::
trans_const
(
cx
,
repr
,
0
,
es
.map
(|
e
|
const_expr
(
cx
,
*
e
)))
adt
::
trans_const
(
cx
,
repr
,
0
,
es
.map
(|
e
|
const_expr
(
cx
,
*
e
)))
}
}
ast
::
expr_rec
(
ref
fs
,
None
)
=>
{
let
ety
=
ty
::
expr_ty
(
cx
.tcx
,
e
);
let
repr
=
adt
::
represent_type
(
cx
,
ety
);
adt
::
trans_const
(
cx
,
repr
,
0
,
fs
.map
(|
f
|
const_expr
(
cx
,
f
.node.expr
)))
}
ast
::
expr_struct
(
_
,
ref
fs
,
None
)
=>
{
ast
::
expr_struct
(
_
,
ref
fs
,
None
)
=>
{
let
ety
=
ty
::
expr_ty
(
cx
.tcx
,
e
);
let
ety
=
ty
::
expr_ty
(
cx
.tcx
,
e
);
let
repr
=
adt
::
represent_type
(
cx
,
ety
);
let
repr
=
adt
::
represent_type
(
cx
,
ety
);
...
...
src/librustc/middle/trans/expr.rs
浏览文件 @
954ae9c9
...
@@ -599,7 +599,6 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
...
@@ -599,7 +599,6 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
controlflow
::
trans_block
(
bcx
,
blk
,
dest
)
controlflow
::
trans_block
(
bcx
,
blk
,
dest
)
};
};
}
}
ast
::
expr_rec
(
ref
fields
,
base
)
|
ast
::
expr_struct
(
_
,
ref
fields
,
base
)
=>
{
ast
::
expr_struct
(
_
,
ref
fields
,
base
)
=>
{
return
trans_rec_or_struct
(
bcx
,
(
*
fields
),
base
,
expr
.id
,
dest
);
return
trans_rec_or_struct
(
bcx
,
(
*
fields
),
base
,
expr
.id
,
dest
);
}
}
...
...
src/librustc/middle/trans/type_use.rs
浏览文件 @
954ae9c9
...
@@ -263,12 +263,9 @@ pub fn mark_for_method_call(cx: Context, e_id: node_id, callee_id: node_id) {
...
@@ -263,12 +263,9 @@ pub fn mark_for_method_call(cx: Context, e_id: node_id, callee_id: node_id) {
pub
fn
mark_for_expr
(
cx
:
Context
,
e
:
@
expr
)
{
pub
fn
mark_for_expr
(
cx
:
Context
,
e
:
@
expr
)
{
match
e
.node
{
match
e
.node
{
expr_vstore
(
_
,
_
)
|
expr_vstore
(
_
,
_
)
|
expr_vec
(
_
,
_
)
|
expr_struct
(
*
)
|
expr_tup
(
_
)
|
expr_vec
(
_
,
_
)
|
expr_rec
(
_
,
_
)
|
expr_struct
(
*
)
|
expr_tup
(
_
)
|
expr_unary
(
box
(
_
),
_
)
|
expr_unary
(
uniq
(
_
),
_
)
|
expr_unary
(
box
(
_
),
_
)
|
expr_unary
(
uniq
(
_
),
_
)
|
expr_binary
(
add
,
_
,
_
)
|
expr_binary
(
add
,
_
,
_
)
|
expr_copy
(
_
)
|
expr_repeat
(
*
)
=>
{
expr_copy
(
_
)
|
expr_repeat
(
*
)
=>
{
node_type_needs
(
cx
,
use_repr
,
e
.id
);
node_type_needs
(
cx
,
use_repr
,
e
.id
);
}
}
expr_cast
(
base
,
_
)
=>
{
expr_cast
(
base
,
_
)
=>
{
...
...
src/librustc/middle/ty.rs
浏览文件 @
954ae9c9
...
@@ -3066,7 +3066,6 @@ pub fn expr_kind(tcx: ctxt,
...
@@ -3066,7 +3066,6 @@ pub fn expr_kind(tcx: ctxt,
ast
::
expr_call
(
*
)
|
ast
::
expr_call
(
*
)
|
ast
::
expr_method_call
(
*
)
|
ast
::
expr_method_call
(
*
)
|
ast
::
expr_rec
(
*
)
|
ast
::
expr_struct
(
*
)
|
ast
::
expr_struct
(
*
)
|
ast
::
expr_tup
(
*
)
|
ast
::
expr_tup
(
*
)
|
ast
::
expr_if
(
*
)
|
ast
::
expr_if
(
*
)
|
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
954ae9c9
...
@@ -2508,9 +2508,6 @@ fn types_compatible(fcx: @mut FnCtxt, sp: span, t1: ty::t,
...
@@ -2508,9 +2508,6 @@ fn types_compatible(fcx: @mut FnCtxt, sp: span, t1: ty::t,
let
typ
=
ty
::
mk_tup
(
tcx
,
elt_ts
);
let
typ
=
ty
::
mk_tup
(
tcx
,
elt_ts
);
fcx
.write_ty
(
id
,
typ
);
fcx
.write_ty
(
id
,
typ
);
}
}
ast
::
expr_rec
(
ref
fields
,
base
)
=>
{
fail
!
()
}
ast
::
expr_struct
(
path
,
ref
fields
,
base_expr
)
=>
{
ast
::
expr_struct
(
path
,
ref
fields
,
base_expr
)
=>
{
// Resolve the path.
// Resolve the path.
match
tcx
.def_map
.find
(
&
id
)
{
match
tcx
.def_map
.find
(
&
id
)
{
...
...
src/librustc/middle/typeck/check/regionck.rs
浏览文件 @
954ae9c9
...
@@ -701,7 +701,6 @@ fn guarantor(rcx: @mut Rcx, expr: @ast::expr) -> Option<ty::Region> {
...
@@ -701,7 +701,6 @@ fn guarantor(rcx: @mut Rcx, expr: @ast::expr) -> Option<ty::Region> {
ast
::
expr_cast
(
*
)
|
ast
::
expr_cast
(
*
)
|
ast
::
expr_call
(
*
)
|
ast
::
expr_call
(
*
)
|
ast
::
expr_method_call
(
*
)
|
ast
::
expr_method_call
(
*
)
|
ast
::
expr_rec
(
*
)
|
ast
::
expr_struct
(
*
)
|
ast
::
expr_struct
(
*
)
|
ast
::
expr_tup
(
*
)
|
ast
::
expr_tup
(
*
)
|
ast
::
expr_if
(
*
)
|
ast
::
expr_if
(
*
)
|
...
...
src/libsyntax/ast.rs
浏览文件 @
954ae9c9
...
@@ -564,7 +564,6 @@ pub enum CallSugar {
...
@@ -564,7 +564,6 @@ pub enum CallSugar {
pub
enum
expr_
{
pub
enum
expr_
{
expr_vstore
(
@
expr
,
expr_vstore
),
expr_vstore
(
@
expr
,
expr_vstore
),
expr_vec
(
~
[
@
expr
],
mutability
),
expr_vec
(
~
[
@
expr
],
mutability
),
expr_rec
(
~
[
field
],
Option
<@
expr
>
),
expr_call
(
@
expr
,
~
[
@
expr
],
CallSugar
),
expr_call
(
@
expr
,
~
[
@
expr
],
CallSugar
),
expr_method_call
(
@
expr
,
ident
,
~
[
@
Ty
],
~
[
@
expr
],
CallSugar
),
expr_method_call
(
@
expr
,
ident
,
~
[
@
Ty
],
~
[
@
expr
],
CallSugar
),
expr_tup
(
~
[
@
expr
]),
expr_tup
(
~
[
@
expr
]),
...
...
src/libsyntax/ext/build.rs
浏览文件 @
954ae9c9
...
@@ -162,13 +162,6 @@ pub fn mk_field(sp: span, f: &Field) -> ast::field {
...
@@ -162,13 +162,6 @@ pub fn mk_field(sp: span, f: &Field) -> ast::field {
pub
fn
mk_fields
(
sp
:
span
,
fields
:
~
[
Field
])
->
~
[
ast
::
field
]
{
pub
fn
mk_fields
(
sp
:
span
,
fields
:
~
[
Field
])
->
~
[
ast
::
field
]
{
fields
.map
(|
f
|
mk_field
(
sp
,
f
))
fields
.map
(|
f
|
mk_field
(
sp
,
f
))
}
}
pub
fn
mk_rec_e
(
cx
:
ext_ctxt
,
sp
:
span
,
+
fields
:
~
[
Field
])
->
@
ast
::
expr
{
mk_expr
(
cx
,
sp
,
ast
::
expr_rec
(
mk_fields
(
sp
,
fields
),
option
::
None
::
<@
ast
::
expr
>
))
}
pub
fn
mk_struct_e
(
cx
:
ext_ctxt
,
pub
fn
mk_struct_e
(
cx
:
ext_ctxt
,
sp
:
span
,
sp
:
span
,
+
ctor_path
:
~
[
ast
::
ident
],
+
ctor_path
:
~
[
ast
::
ident
],
...
...
src/libsyntax/ext/log_syntax.rs
浏览文件 @
954ae9c9
...
@@ -32,7 +32,10 @@ pub fn expand_syntax_ext(cx: ext_ctxt,
...
@@ -32,7 +32,10 @@ pub fn expand_syntax_ext(cx: ext_ctxt,
MRExpr
(
@
ast
::
expr
{
MRExpr
(
@
ast
::
expr
{
id
:
cx
.next_id
(),
id
:
cx
.next_id
(),
callee_id
:
cx
.next_id
(),
callee_id
:
cx
.next_id
(),
node
:
ast
::
expr_rec
(
~
[],
option
::
None
),
node
:
ast
::
expr_lit
(
@
codemap
::
spanned
{
node
:
ast
::
lit_nil
,
span
:
sp
}),
span
:
sp
,
span
:
sp
,
})
})
}
}
src/libsyntax/fold.rs
浏览文件 @
954ae9c9
...
@@ -479,12 +479,6 @@ fn fold_field_(field: field, fld: @ast_fold) -> field {
...
@@ -479,12 +479,6 @@ fn fold_field_(field: field, fld: @ast_fold) -> field {
expr_repeat
(
expr
,
count
,
mutt
)
=>
{
expr_repeat
(
expr
,
count
,
mutt
)
=>
{
expr_repeat
(
fld
.fold_expr
(
expr
),
fld
.fold_expr
(
count
),
mutt
)
expr_repeat
(
fld
.fold_expr
(
expr
),
fld
.fold_expr
(
count
),
mutt
)
}
}
expr_rec
(
ref
fields
,
maybe_expr
)
=>
{
expr_rec
(
fields
.map
(|
x
|
fold_field
(
*
x
)),
maybe_expr
.map
(|
x
|
fld
.fold_expr
(
*
x
))
)
}
expr_tup
(
ref
elts
)
=>
expr_tup
(
elts
.map
(|
x
|
fld
.fold_expr
(
*
x
))),
expr_tup
(
ref
elts
)
=>
expr_tup
(
elts
.map
(|
x
|
fld
.fold_expr
(
*
x
))),
expr_call
(
f
,
ref
args
,
blk
)
=>
{
expr_call
(
f
,
ref
args
,
blk
)
=>
{
expr_call
(
expr_call
(
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
954ae9c9
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
use
ast
::{
expr_break
,
expr_call
,
expr_cast
,
expr_copy
,
expr_do_body
};
use
ast
::{
expr_break
,
expr_call
,
expr_cast
,
expr_copy
,
expr_do_body
};
use
ast
::{
expr_field
,
expr_fn_block
,
expr_if
,
expr_index
};
use
ast
::{
expr_field
,
expr_fn_block
,
expr_if
,
expr_index
};
use
ast
::{
expr_lit
,
expr_log
,
expr_loop
,
expr_loop_body
,
expr_mac
};
use
ast
::{
expr_lit
,
expr_log
,
expr_loop
,
expr_loop_body
,
expr_mac
};
use
ast
::{
expr_method_call
,
expr_paren
,
expr_path
,
expr_re
c
,
expr_re
peat
};
use
ast
::{
expr_method_call
,
expr_paren
,
expr_path
,
expr_repeat
};
use
ast
::{
expr_ret
,
expr_swap
,
expr_struct
,
expr_tup
,
expr_unary
};
use
ast
::{
expr_ret
,
expr_swap
,
expr_struct
,
expr_tup
,
expr_unary
};
use
ast
::{
expr_vec
,
expr_vstore
,
expr_vstore_mut_box
};
use
ast
::{
expr_vec
,
expr_vstore
,
expr_vstore_mut_box
};
use
ast
::{
expr_vstore_fixed
,
expr_vstore_slice
,
expr_vstore_box
};
use
ast
::{
expr_vstore_fixed
,
expr_vstore_slice
,
expr_vstore_box
};
...
@@ -1956,34 +1956,6 @@ fn looking_at_record_literal(&self) -> bool {
...
@@ -1956,34 +1956,6 @@ fn looking_at_record_literal(&self) -> bool {
self
.look_ahead
(
2
)
==
token
::
COLON
))
self
.look_ahead
(
2
)
==
token
::
COLON
))
}
}
fn
parse_record_literal
(
&
self
)
->
expr_
{
self
.expect
(
&
token
::
LBRACE
);
let
mut
fields
=
~
[
self
.parse_field
(
token
::
COLON
)];
let
mut
base
=
None
;
while
*
self
.token
!=
token
::
RBRACE
{
if
*
self
.token
==
token
::
COMMA
&&
self
.look_ahead
(
1
)
==
token
::
DOTDOT
{
self
.bump
();
self
.bump
();
base
=
Some
(
self
.parse_expr
());
break
;
}
if
self
.try_parse_obsolete_with
()
{
break
;
}
self
.expect
(
&
token
::
COMMA
);
if
*
self
.token
==
token
::
RBRACE
{
// record ends by an optional trailing comma
break
;
}
fields
.push
(
self
.parse_field
(
token
::
COLON
));
}
self
.expect
(
&
token
::
RBRACE
);
self
.warn
(
~
"REC"
);
return
expr_rec
(
fields
,
base
);
}
fn
parse_match_expr
(
&
self
)
->
@
expr
{
fn
parse_match_expr
(
&
self
)
->
@
expr
{
let
lo
=
self
.last_span.lo
;
let
lo
=
self
.last_span.lo
;
let
discriminant
=
self
.parse_expr
();
let
discriminant
=
self
.parse_expr
();
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
954ae9c9
...
@@ -1169,22 +1169,6 @@ fn print_field(s: @ps, field: ast::field) {
...
@@ -1169,22 +1169,6 @@ fn print_field(s: @ps, field: ast::field) {
end
(
s
);
end
(
s
);
}
}
ast
::
expr_rec
(
ref
fields
,
wth
)
=>
{
word
(
s
.s
,
~
"{"
);
commasep_cmnt
(
s
,
consistent
,
(
*
fields
),
print_field
,
get_span
);
match
wth
{
Some
(
expr
)
=>
{
ibox
(
s
,
indent_unit
);
word
(
s
.s
,
~
","
);
space
(
s
.s
);
word
(
s
.s
,
~
".."
);
print_expr
(
s
,
expr
);
end
(
s
);
}
_
=>
word
(
s
.s
,
~
","
)
}
word
(
s
.s
,
~
"}"
);
}
ast
::
expr_struct
(
path
,
ref
fields
,
wth
)
=>
{
ast
::
expr_struct
(
path
,
ref
fields
,
wth
)
=>
{
print_path
(
s
,
path
,
true
);
print_path
(
s
,
path
,
true
);
word
(
s
.s
,
~
"{"
);
word
(
s
.s
,
~
"{"
);
...
...
src/libsyntax/visit.rs
浏览文件 @
954ae9c9
...
@@ -479,10 +479,6 @@ pub fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
...
@@ -479,10 +479,6 @@ pub fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
(
v
.visit_expr
)(
element
,
e
,
v
);
(
v
.visit_expr
)(
element
,
e
,
v
);
(
v
.visit_expr
)(
count
,
e
,
v
);
(
v
.visit_expr
)(
count
,
e
,
v
);
}
}
expr_rec
(
ref
flds
,
base
)
=>
{
for
flds
.each
|
f
|
{
(
v
.visit_expr
)(
f
.node.expr
,
e
,
v
);
}
visit_expr_opt
(
base
,
e
,
v
);
}
expr_struct
(
p
,
ref
flds
,
base
)
=>
{
expr_struct
(
p
,
ref
flds
,
base
)
=>
{
visit_path
(
p
,
e
,
v
);
visit_path
(
p
,
e
,
v
);
for
flds
.each
|
f
|
{
(
v
.visit_expr
)(
f
.node.expr
,
e
,
v
);
}
for
flds
.each
|
f
|
{
(
v
.visit_expr
)(
f
.node.expr
,
e
,
v
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录