Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
dfe35da6
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
dfe35da6
编写于
2月 09, 2016
作者:
O
Oliver 'ker' Schneider
提交者:
Oliver Schneider
2月 11, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[breaking-change] don't glob export ast::TraitItemKind variants
上级
73fa9b2d
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
38 addition
and
40 deletion
+38
-40
src/librustc_driver/pretty.rs
src/librustc_driver/pretty.rs
+1
-1
src/librustc_front/lowering.rs
src/librustc_front/lowering.rs
+3
-3
src/librustc_trans/save/dump_csv.rs
src/librustc_trans/save/dump_csv.rs
+4
-4
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+5
-6
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+3
-3
src/libsyntax/feature_gate.rs
src/libsyntax/feature_gate.rs
+3
-3
src/libsyntax/fold.rs
src/libsyntax/fold.rs
+6
-6
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+6
-7
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+3
-3
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+4
-4
未找到文件。
src/librustc_driver/pretty.rs
浏览文件 @
dfe35da6
...
...
@@ -616,7 +616,7 @@ fn fold_item_kind(&mut self, i: ast::ItemKind) -> ast::ItemKind {
fn
fold_trait_item
(
&
mut
self
,
i
:
P
<
ast
::
TraitItem
>
)
->
SmallVector
<
P
<
ast
::
TraitItem
>>
{
match
i
.node
{
ast
::
ConstTraitItem
(
..
)
=>
{
ast
::
TraitItemKind
::
Const
(
..
)
=>
{
self
.within_static_or_const
=
true
;
let
ret
=
fold
::
noop_fold_trait_item
(
i
,
self
);
self
.within_static_or_const
=
false
;
...
...
src/librustc_front/lowering.rs
浏览文件 @
dfe35da6
...
...
@@ -728,15 +728,15 @@ pub fn lower_trait_item(lctx: &LoweringContext, i: &TraitItem) -> hir::TraitItem
name
:
i
.ident.name
,
attrs
:
lower_attrs
(
lctx
,
&
i
.attrs
),
node
:
match
i
.node
{
ConstTraitItem
(
ref
ty
,
ref
default
)
=>
{
TraitItemKind
::
Const
(
ref
ty
,
ref
default
)
=>
{
hir
::
ConstTraitItem
(
lower_ty
(
lctx
,
ty
),
default
.as_ref
()
.map
(|
x
|
lower_expr
(
lctx
,
x
)))
}
MethodTraitItem
(
ref
sig
,
ref
body
)
=>
{
TraitItemKind
::
Method
(
ref
sig
,
ref
body
)
=>
{
hir
::
MethodTraitItem
(
lower_method_sig
(
lctx
,
sig
),
body
.as_ref
()
.map
(|
x
|
lower_block
(
lctx
,
x
)))
}
T
ypeTraitItem
(
ref
bounds
,
ref
default
)
=>
{
T
raitItemKind
::
Type
(
ref
bounds
,
ref
default
)
=>
{
hir
::
TypeTraitItem
(
lower_bounds
(
lctx
,
bounds
),
default
.as_ref
()
.map
(|
x
|
lower_ty
(
lctx
,
x
)))
}
...
...
src/librustc_trans/save/dump_csv.rs
浏览文件 @
dfe35da6
...
...
@@ -1020,22 +1020,22 @@ fn visit_generics(&mut self, generics: &ast::Generics) {
fn
visit_trait_item
(
&
mut
self
,
trait_item
:
&
ast
::
TraitItem
)
{
self
.process_macro_use
(
trait_item
.span
,
trait_item
.id
);
match
trait_item
.node
{
ast
::
ConstTraitItem
(
ref
ty
,
Some
(
ref
expr
))
=>
{
ast
::
TraitItemKind
::
Const
(
ref
ty
,
Some
(
ref
expr
))
=>
{
self
.process_const
(
trait_item
.id
,
trait_item
.ident.name
,
trait_item
.span
,
&*
ty
,
&*
expr
);
}
ast
::
MethodTraitItem
(
ref
sig
,
ref
body
)
=>
{
ast
::
TraitItemKind
::
Method
(
ref
sig
,
ref
body
)
=>
{
self
.process_method
(
sig
,
body
.as_ref
()
.map
(|
x
|
&**
x
),
trait_item
.id
,
trait_item
.ident.name
,
trait_item
.span
);
}
ast
::
ConstTraitItem
(
_
,
None
)
|
ast
::
T
ypeTraitItem
(
..
)
=>
{}
ast
::
TraitItemKind
::
Const
(
_
,
None
)
|
ast
::
T
raitItemKind
::
Type
(
..
)
=>
{}
}
}
...
...
src/libsyntax/ast.rs
浏览文件 @
dfe35da6
...
...
@@ -14,7 +14,6 @@
pub
use
self
::
PathListItem_
::
*
;
pub
use
self
::
StrStyle
::
*
;
pub
use
self
::
StructFieldKind
::
*
;
pub
use
self
::
TraitItem_
::
*
;
pub
use
self
::
TyParamBound
::
*
;
pub
use
self
::
UnsafeSource
::
*
;
pub
use
self
::
ViewPath_
::
*
;
...
...
@@ -1324,15 +1323,15 @@ pub struct TraitItem {
pub
id
:
NodeId
,
pub
ident
:
Ident
,
pub
attrs
:
Vec
<
Attribute
>
,
pub
node
:
TraitItem
_
,
pub
node
:
TraitItem
Kind
,
pub
span
:
Span
,
}
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug)]
pub
enum
TraitItem
_
{
Const
TraitItem
(
P
<
Ty
>
,
Option
<
P
<
Expr
>>
),
Method
TraitItem
(
MethodSig
,
Option
<
P
<
Block
>>
),
Type
TraitItem
(
TyParamBounds
,
Option
<
P
<
Ty
>>
),
pub
enum
TraitItem
Kind
{
Const
(
P
<
Ty
>
,
Option
<
P
<
Expr
>>
),
Method
(
MethodSig
,
Option
<
P
<
Block
>>
),
Type
(
TyParamBounds
,
Option
<
P
<
Ty
>>
),
}
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug)]
...
...
src/libsyntax/ext/expand.rs
浏览文件 @
dfe35da6
...
...
@@ -919,14 +919,14 @@ fn expand_annotatable(a: Annotatable,
},
Annotatable
::
TraitItem
(
it
)
=>
match
it
.node
{
ast
::
MethodTraitItem
(
_
,
Some
(
_
))
=>
SmallVector
::
one
(
it
.map
(|
ti
|
ast
::
TraitItem
{
ast
::
TraitItemKind
::
Method
(
_
,
Some
(
_
))
=>
SmallVector
::
one
(
it
.map
(|
ti
|
ast
::
TraitItem
{
id
:
ti
.id
,
ident
:
ti
.ident
,
attrs
:
ti
.attrs
,
node
:
match
ti
.node
{
ast
::
MethodTraitItem
(
sig
,
Some
(
body
))
=>
{
ast
::
TraitItemKind
::
Method
(
sig
,
Some
(
body
))
=>
{
let
(
sig
,
body
)
=
expand_and_rename_method
(
sig
,
body
,
fld
);
ast
::
MethodTraitItem
(
sig
,
Some
(
body
))
ast
::
TraitItemKind
::
Method
(
sig
,
Some
(
body
))
}
_
=>
unreachable!
()
},
...
...
src/libsyntax/feature_gate.rs
浏览文件 @
dfe35da6
...
...
@@ -1071,17 +1071,17 @@ fn visit_fn(&mut self,
fn
visit_trait_item
(
&
mut
self
,
ti
:
&
'v
ast
::
TraitItem
)
{
match
ti
.node
{
ast
::
ConstTraitItem
(
..
)
=>
{
ast
::
TraitItemKind
::
Const
(
..
)
=>
{
self
.gate_feature
(
"associated_consts"
,
ti
.span
,
"associated constants are experimental"
)
}
ast
::
MethodTraitItem
(
ref
sig
,
_
)
=>
{
ast
::
TraitItemKind
::
Method
(
ref
sig
,
_
)
=>
{
if
sig
.constness
==
ast
::
Constness
::
Const
{
self
.gate_feature
(
"const_fn"
,
ti
.span
,
"const fn is unstable"
);
}
}
ast
::
T
ypeTraitItem
(
_
,
Some
(
_
))
=>
{
ast
::
T
raitItemKind
::
Type
(
_
,
Some
(
_
))
=>
{
self
.gate_feature
(
"associated_type_defaults"
,
ti
.span
,
"associated type defaults are unstable"
);
}
...
...
src/libsyntax/fold.rs
浏览文件 @
dfe35da6
...
...
@@ -969,16 +969,16 @@ pub fn noop_fold_trait_item<T: Folder>(i: P<TraitItem>, folder: &mut T)
ident
:
folder
.fold_ident
(
ident
),
attrs
:
fold_attrs
(
attrs
,
folder
),
node
:
match
node
{
ConstTraitItem
(
ty
,
default
)
=>
{
ConstTraitItem
(
folder
.fold_ty
(
ty
),
TraitItemKind
::
Const
(
ty
,
default
)
=>
{
TraitItemKind
::
Const
(
folder
.fold_ty
(
ty
),
default
.map
(|
x
|
folder
.fold_expr
(
x
)))
}
MethodTraitItem
(
sig
,
body
)
=>
{
MethodTraitItem
(
noop_fold_method_sig
(
sig
,
folder
),
TraitItemKind
::
Method
(
sig
,
body
)
=>
{
TraitItemKind
::
Method
(
noop_fold_method_sig
(
sig
,
folder
),
body
.map
(|
x
|
folder
.fold_block
(
x
)))
}
T
ypeTraitItem
(
bounds
,
default
)
=>
{
T
ypeTraitItem
(
folder
.fold_bounds
(
bounds
),
T
raitItemKind
::
Type
(
bounds
,
default
)
=>
{
T
raitItemKind
::
Type
(
folder
.fold_bounds
(
bounds
),
default
.map
(|
x
|
folder
.fold_ty
(
x
)))
}
},
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
dfe35da6
...
...
@@ -13,11 +13,11 @@
use
abi
::{
self
,
Abi
};
use
ast
::
BareFnTy
;
use
ast
::{
RegionTyParamBound
,
TraitTyParamBound
,
TraitBoundModifier
};
use
ast
::
{
Public
,
Unsafety
}
;
use
ast
::{
Mod
,
Arg
,
Arm
,
Attribute
,
BindingMode
};
use
ast
::
Unsafety
;
use
ast
::{
Mod
,
Arg
,
Arm
,
Attribute
,
BindingMode
,
TraitItemKind
};
use
ast
::
Block
;
use
ast
::{
BlockCheckMode
,
CaptureBy
};
use
ast
::{
Constness
,
C
onstTraitItem
,
C
rate
,
CrateConfig
};
use
ast
::{
Constness
,
Crate
,
CrateConfig
};
use
ast
::{
Decl
,
DeclKind
};
use
ast
::{
EMPTY_CTXT
,
EnumDef
,
ExplicitSelf
};
use
ast
::{
Expr
,
ExprKind
};
...
...
@@ -39,7 +39,6 @@
use
ast
::
SelfKind
;
use
ast
::{
Delimited
,
SequenceRepetition
,
TokenTree
,
TraitItem
,
TraitRef
};
use
ast
::{
Ty
,
TyKind
,
TypeBinding
,
TyParam
,
TyParamBounds
};
use
ast
::
TypeTraitItem
;
use
ast
::
UnnamedField
;
use
ast
::{
ViewPath
,
ViewPathGlob
,
ViewPathList
,
ViewPathSimple
};
use
ast
::{
Visibility
,
WhereClause
};
...
...
@@ -1188,7 +1187,7 @@ pub fn parse_trait_items(&mut self) -> PResult<'a, Vec<P<TraitItem>>> {
let
(
name
,
node
)
=
if
p
.eat_keyword
(
keywords
::
Type
)
{
let
TyParam
{
ident
,
bounds
,
default
,
..
}
=
try!
(
p
.parse_ty_param
());
try!
(
p
.expect
(
&
token
::
Semi
));
(
ident
,
T
ypeTraitItem
(
bounds
,
default
))
(
ident
,
T
raitItemKind
::
Type
(
bounds
,
default
))
}
else
if
p
.is_const_item
()
{
try!
(
p
.expect_keyword
(
keywords
::
Const
));
let
ident
=
try!
(
p
.parse_ident
());
...
...
@@ -1203,7 +1202,7 @@ pub fn parse_trait_items(&mut self) -> PResult<'a, Vec<P<TraitItem>>> {
try!
(
p
.expect
(
&
token
::
Semi
));
None
};
(
ident
,
ConstTraitItem
(
ty
,
default
))
(
ident
,
TraitItemKind
::
Const
(
ty
,
default
))
}
else
{
let
(
constness
,
unsafety
,
abi
)
=
try!
(
p
.parse_fn_front_matter
());
...
...
@@ -1247,7 +1246,7 @@ pub fn parse_trait_items(&mut self) -> PResult<'a, Vec<P<TraitItem>>> {
token_str
)[
..
]))
}
};
(
ident
,
ast
::
MethodTraitItem
(
sig
,
body
))
(
ident
,
ast
::
TraitItemKind
::
Method
(
sig
,
body
))
};
Ok
(
P
(
TraitItem
{
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
dfe35da6
...
...
@@ -1552,12 +1552,12 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
try!
(
self
.maybe_print_comment
(
ti
.span.lo
));
try!
(
self
.print_outer_attributes
(
&
ti
.attrs
));
match
ti
.node
{
ast
::
ConstTraitItem
(
ref
ty
,
ref
default
)
=>
{
ast
::
TraitItemKind
::
Const
(
ref
ty
,
ref
default
)
=>
{
try!
(
self
.print_associated_const
(
ti
.ident
,
&
ty
,
default
.as_ref
()
.map
(|
expr
|
&**
expr
),
ast
::
Inherited
));
}
ast
::
MethodTraitItem
(
ref
sig
,
ref
body
)
=>
{
ast
::
TraitItemKind
::
Method
(
ref
sig
,
ref
body
)
=>
{
if
body
.is_some
()
{
try!
(
self
.head
(
""
));
}
...
...
@@ -1569,7 +1569,7 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
try!
(
word
(
&
mut
self
.s
,
";"
));
}
}
ast
::
T
ypeTraitItem
(
ref
bounds
,
ref
default
)
=>
{
ast
::
T
raitItemKind
::
Type
(
ref
bounds
,
ref
default
)
=>
{
try!
(
self
.print_associated_type
(
ti
.ident
,
Some
(
bounds
),
default
.as_ref
()
.map
(|
ty
|
&**
ty
)));
}
...
...
src/libsyntax/visit.rs
浏览文件 @
dfe35da6
...
...
@@ -565,20 +565,20 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
visitor
.visit_ident
(
trait_item
.span
,
trait_item
.ident
);
walk_list!
(
visitor
,
visit_attribute
,
&
trait_item
.attrs
);
match
trait_item
.node
{
ConstTraitItem
(
ref
ty
,
ref
default
)
=>
{
TraitItemKind
::
Const
(
ref
ty
,
ref
default
)
=>
{
visitor
.visit_ty
(
ty
);
walk_list!
(
visitor
,
visit_expr
,
default
);
}
MethodTraitItem
(
ref
sig
,
None
)
=>
{
TraitItemKind
::
Method
(
ref
sig
,
None
)
=>
{
visitor
.visit_explicit_self
(
&
sig
.explicit_self
);
visitor
.visit_generics
(
&
sig
.generics
);
walk_fn_decl
(
visitor
,
&
sig
.decl
);
}
MethodTraitItem
(
ref
sig
,
Some
(
ref
body
))
=>
{
TraitItemKind
::
Method
(
ref
sig
,
Some
(
ref
body
))
=>
{
visitor
.visit_fn
(
FnKind
::
Method
(
trait_item
.ident
,
sig
,
None
),
&
sig
.decl
,
body
,
trait_item
.span
,
trait_item
.id
);
}
T
ypeTraitItem
(
ref
bounds
,
ref
default
)
=>
{
T
raitItemKind
::
Type
(
ref
bounds
,
ref
default
)
=>
{
walk_list!
(
visitor
,
visit_ty_param_bound
,
bounds
);
walk_list!
(
visitor
,
visit_ty
,
default
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录