Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
bc355244
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,发现更多精彩内容 >>
提交
bc355244
编写于
3月 23, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make `ast::Visibility` non-copyable
上级
74240b22
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
53 addition
and
53 deletion
+53
-53
src/librustc_front/lowering.rs
src/librustc_front/lowering.rs
+5
-5
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+4
-4
src/libsyntax/ast_util.rs
src/libsyntax/ast_util.rs
+1
-1
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+6
-6
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+32
-32
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+5
-5
未找到文件。
src/librustc_front/lowering.rs
浏览文件 @
bc355244
...
...
@@ -761,7 +761,7 @@ pub fn lower_impl_item(lctx: &LoweringContext, i: &ImplItem) -> hir::ImplItem {
id
:
i
.id
,
name
:
i
.ident.name
,
attrs
:
lower_attrs
(
lctx
,
&
i
.attrs
),
vis
:
lower_visibility
(
lctx
,
i
.vis
),
vis
:
lower_visibility
(
lctx
,
&
i
.vis
),
defaultness
:
lower_defaultness
(
lctx
,
i
.defaultness
),
node
:
match
i
.node
{
ImplItemKind
::
Const
(
ref
ty
,
ref
expr
)
=>
{
...
...
@@ -839,7 +839,7 @@ pub fn lower_item(lctx: &LoweringContext, i: &Item) -> hir::Item {
name
:
i
.ident.name
,
attrs
:
lower_attrs
(
lctx
,
&
i
.attrs
),
node
:
node
,
vis
:
lower_visibility
(
lctx
,
i
.vis
),
vis
:
lower_visibility
(
lctx
,
&
i
.vis
),
span
:
i
.span
,
}
}
...
...
@@ -857,7 +857,7 @@ pub fn lower_foreign_item(lctx: &LoweringContext, i: &ForeignItem) -> hir::Forei
hir
::
ForeignItemStatic
(
lower_ty
(
lctx
,
t
),
m
)
}
},
vis
:
lower_visibility
(
lctx
,
i
.vis
),
vis
:
lower_visibility
(
lctx
,
&
i
.vis
),
span
:
i
.span
,
}
}
...
...
@@ -1706,8 +1706,8 @@ pub fn lower_capture_clause(_lctx: &LoweringContext, c: CaptureBy) -> hir::Captu
}
}
pub
fn
lower_visibility
(
_
lctx
:
&
LoweringContext
,
v
:
Visibility
)
->
hir
::
Visibility
{
match
v
{
pub
fn
lower_visibility
(
_
lctx
:
&
LoweringContext
,
v
:
&
Visibility
)
->
hir
::
Visibility
{
match
*
v
{
Visibility
::
Public
=>
hir
::
Public
,
Visibility
::
Inherited
=>
hir
::
Inherited
,
}
...
...
src/libsyntax/ast.rs
浏览文件 @
bc355244
...
...
@@ -1868,7 +1868,7 @@ pub struct PolyTraitRef {
pub
span
:
Span
,
}
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug
,
Copy
)]
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug)]
pub
enum
Visibility
{
Public
,
Inherited
,
...
...
@@ -1893,7 +1893,7 @@ pub fn ident(&self) -> Option<Ident> {
pub
type
StructField
=
Spanned
<
StructField_
>
;
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug
,
Copy
)]
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug)]
pub
enum
StructFieldKind
{
NamedField
(
Ident
,
Visibility
),
/// Element of a tuple-like struct
...
...
@@ -1908,9 +1908,9 @@ pub fn is_unnamed(&self) -> bool {
}
}
pub
fn
visibility
(
&
self
)
->
Visibility
{
pub
fn
visibility
(
&
self
)
->
&
Visibility
{
match
*
self
{
NamedField
(
_
,
vis
)
|
UnnamedField
(
vis
)
=>
vis
NamedField
(
_
,
ref
vis
)
|
UnnamedField
(
ref
vis
)
=>
vis
}
}
}
...
...
src/libsyntax/ast_util.rs
浏览文件 @
bc355244
...
...
@@ -247,7 +247,7 @@ fn visit_fn(&mut self,
FnKind
::
ItemFn
(
_
,
generics
,
_
,
_
,
_
,
_
)
=>
{
self
.visit_generics_helper
(
generics
)
}
FnKind
::
Method
(
_
,
sig
,
_
)
=>
{
FnKind
::
Method
(
_
,
ref
sig
,
_
)
=>
{
self
.visit_generics_helper
(
&
sig
.generics
)
}
FnKind
::
Closure
=>
{}
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
bc355244
...
...
@@ -4952,7 +4952,7 @@ pub fn parse_impl_item(&mut self) -> PResult<'a, ImplItem> {
self
.commit_expr_expecting
(
&
expr
,
token
::
Semi
)
?
;
(
name
,
ast
::
ImplItemKind
::
Const
(
typ
,
expr
))
}
else
{
let
(
name
,
inner_attrs
,
node
)
=
self
.parse_impl_method
(
vis
)
?
;
let
(
name
,
inner_attrs
,
node
)
=
self
.parse_impl_method
(
&
vis
)
?
;
attrs
.extend
(
inner_attrs
);
(
name
,
node
)
};
...
...
@@ -4968,8 +4968,8 @@ pub fn parse_impl_item(&mut self) -> PResult<'a, ImplItem> {
})
}
fn
complain_if_pub_macro
(
&
mut
self
,
visa
:
Visibility
,
span
:
Span
)
{
match
visa
{
fn
complain_if_pub_macro
(
&
mut
self
,
visa
:
&
Visibility
,
span
:
Span
)
{
match
*
visa
{
Visibility
::
Public
=>
{
let
is_macro_rules
:
bool
=
match
self
.token
{
token
::
Ident
(
sid
,
_
)
=>
sid
.name
==
intern
(
"macro_rules"
),
...
...
@@ -4993,7 +4993,7 @@ fn complain_if_pub_macro(&mut self, visa: Visibility, span: Span) {
}
/// Parse a method or a macro invocation in a trait impl.
fn
parse_impl_method
(
&
mut
self
,
vis
:
Visibility
)
fn
parse_impl_method
(
&
mut
self
,
vis
:
&
Visibility
)
->
PResult
<
'a
,
(
Ident
,
Vec
<
ast
::
Attribute
>
,
ast
::
ImplItemKind
)
>
{
// code copied from parse_macro_use_or_failure... abstraction!
if
!
self
.token
.is_any_keyword
()
...
...
@@ -5003,7 +5003,7 @@ fn parse_impl_method(&mut self, vis: Visibility)
// method macro.
let
last_span
=
self
.last_span
;
self
.complain_if_pub_macro
(
vis
,
last_span
);
self
.complain_if_pub_macro
(
&
vis
,
last_span
);
let
lo
=
self
.span.lo
;
let
pth
=
self
.parse_path
(
NoTypesAllowed
)
?
;
...
...
@@ -6045,7 +6045,7 @@ fn parse_macro_use_or_failure(
// MACRO INVOCATION ITEM
let
last_span
=
self
.last_span
;
self
.complain_if_pub_macro
(
visibility
,
last_span
);
self
.complain_if_pub_macro
(
&
visibility
,
last_span
);
let
mac_lo
=
self
.span.lo
;
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
bc355244
...
...
@@ -388,7 +388,7 @@ pub fn fun_to_string(decl: &ast::FnDecl,
to_string
(|
s
|
{
s
.head
(
""
)
?
;
s
.print_fn
(
decl
,
unsafety
,
constness
,
Abi
::
Rust
,
Some
(
name
),
generics
,
opt_explicit_self
,
ast
::
Visibility
::
Inherited
)
?
;
generics
,
opt_explicit_self
,
&
ast
::
Visibility
::
Inherited
)
?
;
s
.end
()
?
;
// Close the head box
s
.end
()
// Close the outer box
})
...
...
@@ -432,8 +432,8 @@ pub fn mac_to_string(arg: &ast::Mac) -> String {
to_string
(|
s
|
s
.print_mac
(
arg
,
::
parse
::
token
::
Paren
))
}
pub
fn
visibility_qualified
(
vis
:
ast
::
Visibility
,
s
:
&
str
)
->
String
{
match
vis
{
pub
fn
visibility_qualified
(
vis
:
&
ast
::
Visibility
,
s
:
&
str
)
->
String
{
match
*
vis
{
ast
::
Visibility
::
Public
=>
format!
(
"pub {}"
,
s
),
ast
::
Visibility
::
Inherited
=>
s
.to_string
()
}
...
...
@@ -1052,13 +1052,13 @@ pub fn print_foreign_item(&mut self,
self
.print_fn
(
decl
,
ast
::
Unsafety
::
Normal
,
ast
::
Constness
::
NotConst
,
Abi
::
Rust
,
Some
(
item
.ident
),
generics
,
None
,
item
.vis
)
?
;
generics
,
None
,
&
item
.vis
)
?
;
self
.end
()
?
;
// end head-ibox
word
(
&
mut
self
.s
,
";"
)
?
;
self
.end
()
// end the outer fn box
}
ast
::
ForeignItemKind
::
Static
(
ref
t
,
m
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
"static"
))
?
;
self
.head
(
&
visibility_qualified
(
&
item
.vis
,
"static"
))
?
;
if
m
{
self
.word_space
(
"mut"
)
?
;
}
...
...
@@ -1076,7 +1076,7 @@ fn print_associated_const(&mut self,
ident
:
ast
::
Ident
,
ty
:
&
ast
::
Ty
,
default
:
Option
<&
ast
::
Expr
>
,
vis
:
ast
::
Visibility
)
vis
:
&
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
word
(
&
mut
self
.s
,
&
visibility_qualified
(
vis
,
""
))
?
;
...
...
@@ -1118,7 +1118,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
self
.ann
.pre
(
self
,
NodeItem
(
item
))
?
;
match
item
.node
{
ast
::
ItemKind
::
ExternCrate
(
ref
optional_path
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
"extern crate"
))
?
;
self
.head
(
&
visibility_qualified
(
&
item
.vis
,
"extern crate"
))
?
;
if
let
Some
(
p
)
=
*
optional_path
{
let
val
=
p
.as_str
();
if
val
.contains
(
"-"
)
{
...
...
@@ -1136,14 +1136,14 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
self
.end
()
?
;
// end outer head-block
}
ast
::
ItemKind
::
Use
(
ref
vp
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
"use"
))
?
;
self
.head
(
&
visibility_qualified
(
&
item
.vis
,
"use"
))
?
;
self
.print_view_path
(
&
vp
)
?
;
word
(
&
mut
self
.s
,
";"
)
?
;
self
.end
()
?
;
// end inner head-block
self
.end
()
?
;
// end outer head-block
}
ast
::
ItemKind
::
Static
(
ref
ty
,
m
,
ref
expr
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
"static"
))
?
;
self
.head
(
&
visibility_qualified
(
&
item
.vis
,
"static"
))
?
;
if
m
==
ast
::
Mutability
::
Mutable
{
self
.word_space
(
"mut"
)
?
;
}
...
...
@@ -1159,7 +1159,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
self
.end
()
?
;
// end the outer cbox
}
ast
::
ItemKind
::
Const
(
ref
ty
,
ref
expr
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
"const"
))
?
;
self
.head
(
&
visibility_qualified
(
&
item
.vis
,
"const"
))
?
;
self
.print_ident
(
item
.ident
)
?
;
self
.word_space
(
":"
)
?
;
self
.print_type
(
&
ty
)
?
;
...
...
@@ -1181,13 +1181,13 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
Some
(
item
.ident
),
typarams
,
None
,
item
.vis
&
item
.vis
)
?
;
word
(
&
mut
self
.s
,
" "
)
?
;
self
.print_block_with_attrs
(
&
body
,
&
item
.attrs
)
?
;
}
ast
::
ItemKind
::
Mod
(
ref
_
mod
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
"mod"
))
?
;
self
.head
(
&
visibility_qualified
(
&
item
.vis
,
"mod"
))
?
;
self
.print_ident
(
item
.ident
)
?
;
self
.nbsp
()
?
;
self
.bopen
()
?
;
...
...
@@ -1204,7 +1204,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
ast
::
ItemKind
::
Ty
(
ref
ty
,
ref
params
)
=>
{
self
.ibox
(
INDENT_UNIT
)
?
;
self
.ibox
(
0
)
?
;
self
.word_nbsp
(
&
visibility_qualified
(
item
.vis
,
"type"
))
?
;
self
.word_nbsp
(
&
visibility_qualified
(
&
item
.vis
,
"type"
))
?
;
self
.print_ident
(
item
.ident
)
?
;
self
.print_generics
(
params
)
?
;
self
.end
()
?
;
// end the inner ibox
...
...
@@ -1222,17 +1222,17 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
params
,
item
.ident
,
item
.span
,
item
.vis
&
item
.vis
)
?
;
}
ast
::
ItemKind
::
Struct
(
ref
struct_def
,
ref
generics
)
=>
{
self
.head
(
&
visibility_qualified
(
item
.vis
,
"struct"
))
?
;
self
.head
(
&
visibility_qualified
(
&
item
.vis
,
"struct"
))
?
;
self
.print_struct
(
&
struct_def
,
generics
,
item
.ident
,
item
.span
,
true
)
?
;
}
ast
::
ItemKind
::
DefaultImpl
(
unsafety
,
ref
trait_ref
)
=>
{
self
.head
(
""
)
?
;
self
.print_visibility
(
item
.vis
)
?
;
self
.print_visibility
(
&
item
.vis
)
?
;
self
.print_unsafety
(
unsafety
)
?
;
self
.word_nbsp
(
"impl"
)
?
;
self
.print_trait_ref
(
trait_ref
)
?
;
...
...
@@ -1249,7 +1249,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
ref
ty
,
ref
impl_items
)
=>
{
self
.head
(
""
)
?
;
self
.print_visibility
(
item
.vis
)
?
;
self
.print_visibility
(
&
item
.vis
)
?
;
self
.print_unsafety
(
unsafety
)
?
;
self
.word_nbsp
(
"impl"
)
?
;
...
...
@@ -1287,7 +1287,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
}
ast
::
ItemKind
::
Trait
(
unsafety
,
ref
generics
,
ref
bounds
,
ref
trait_items
)
=>
{
self
.head
(
""
)
?
;
self
.print_visibility
(
item
.vis
)
?
;
self
.print_visibility
(
&
item
.vis
)
?
;
self
.print_unsafety
(
unsafety
)
?
;
self
.word_nbsp
(
"trait"
)
?
;
self
.print_ident
(
item
.ident
)
?
;
...
...
@@ -1312,7 +1312,7 @@ pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
self
.bclose
(
item
.span
)
?
;
}
ast
::
ItemKind
::
Mac
(
codemap
::
Spanned
{
ref
node
,
..
})
=>
{
self
.print_visibility
(
item
.vis
)
?
;
self
.print_visibility
(
&
item
.vis
)
?
;
self
.print_path
(
&
node
.path
,
false
,
0
)
?
;
word
(
&
mut
self
.s
,
"! "
)
?
;
self
.print_ident
(
item
.ident
)
?
;
...
...
@@ -1355,7 +1355,7 @@ fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) -> io::Result<()> {
pub
fn
print_enum_def
(
&
mut
self
,
enum_definition
:
&
ast
::
EnumDef
,
generics
:
&
ast
::
Generics
,
ident
:
ast
::
Ident
,
span
:
codemap
::
Span
,
visibility
:
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
visibility
:
&
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
self
.head
(
&
visibility_qualified
(
visibility
,
"enum"
))
?
;
self
.print_ident
(
ident
)
?
;
self
.print_generics
(
generics
)
?
;
...
...
@@ -1381,8 +1381,8 @@ pub fn print_variants(&mut self,
self
.bclose
(
span
)
}
pub
fn
print_visibility
(
&
mut
self
,
vis
:
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
match
vis
{
pub
fn
print_visibility
(
&
mut
self
,
vis
:
&
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
match
*
vis
{
ast
::
Visibility
::
Public
=>
self
.word_nbsp
(
"pub"
),
ast
::
Visibility
::
Inherited
=>
Ok
(())
}
...
...
@@ -1404,7 +1404,7 @@ pub fn print_struct(&mut self,
|
s
,
field
|
{
match
field
.node.kind
{
ast
::
NamedField
(
..
)
=>
panic!
(
"unexpected named field"
),
ast
::
UnnamedField
(
vis
)
=>
{
ast
::
UnnamedField
(
ref
vis
)
=>
{
s
.print_visibility
(
vis
)
?
;
s
.maybe_print_comment
(
field
.span.lo
)
?
;
s
.print_type
(
&
field
.node.ty
)
...
...
@@ -1429,7 +1429,7 @@ pub fn print_struct(&mut self,
for
field
in
struct_def
.fields
()
{
match
field
.node.kind
{
ast
::
UnnamedField
(
..
)
=>
panic!
(
"unexpected unnamed field"
),
ast
::
NamedField
(
ident
,
visibility
)
=>
{
ast
::
NamedField
(
ident
,
ref
visibility
)
=>
{
self
.hardbreak_if_not_bol
()
?
;
self
.maybe_print_comment
(
field
.span.lo
)
?
;
self
.print_outer_attributes
(
&
field
.node.attrs
)
?
;
...
...
@@ -1528,7 +1528,7 @@ pub fn print_variant(&mut self, v: &ast::Variant) -> io::Result<()> {
pub
fn
print_method_sig
(
&
mut
self
,
ident
:
ast
::
Ident
,
m
:
&
ast
::
MethodSig
,
vis
:
ast
::
Visibility
)
vis
:
&
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
self
.print_fn
(
&
m
.decl
,
m
.unsafety
,
...
...
@@ -1550,13 +1550,13 @@ pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
ast
::
TraitItemKind
::
Const
(
ref
ty
,
ref
default
)
=>
{
self
.print_associated_const
(
ti
.ident
,
&
ty
,
default
.as_ref
()
.map
(|
expr
|
&**
expr
),
ast
::
Visibility
::
Inherited
)
?
;
&
ast
::
Visibility
::
Inherited
)
?
;
}
ast
::
TraitItemKind
::
Method
(
ref
sig
,
ref
body
)
=>
{
if
body
.is_some
()
{
self
.head
(
""
)
?
;
}
self
.print_method_sig
(
ti
.ident
,
sig
,
ast
::
Visibility
::
Inherited
)
?
;
self
.print_method_sig
(
ti
.ident
,
sig
,
&
ast
::
Visibility
::
Inherited
)
?
;
if
let
Some
(
ref
body
)
=
*
body
{
self
.nbsp
()
?
;
self
.print_block_with_attrs
(
body
,
&
ti
.attrs
)
?
;
...
...
@@ -1582,11 +1582,11 @@ pub fn print_impl_item(&mut self, ii: &ast::ImplItem) -> io::Result<()> {
}
match
ii
.node
{
ast
::
ImplItemKind
::
Const
(
ref
ty
,
ref
expr
)
=>
{
self
.print_associated_const
(
ii
.ident
,
&
ty
,
Some
(
&
expr
),
ii
.vis
)
?
;
self
.print_associated_const
(
ii
.ident
,
&
ty
,
Some
(
&
expr
),
&
ii
.vis
)
?
;
}
ast
::
ImplItemKind
::
Method
(
ref
sig
,
ref
body
)
=>
{
self
.head
(
""
)
?
;
self
.print_method_sig
(
ii
.ident
,
sig
,
ii
.vis
)
?
;
self
.print_method_sig
(
ii
.ident
,
sig
,
&
ii
.vis
)
?
;
self
.nbsp
()
?
;
self
.print_block_with_attrs
(
body
,
&
ii
.attrs
)
?
;
}
...
...
@@ -2655,7 +2655,7 @@ pub fn print_fn(&mut self,
name
:
Option
<
ast
::
Ident
>
,
generics
:
&
ast
::
Generics
,
opt_explicit_self
:
Option
<&
ast
::
SelfKind
>
,
vis
:
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
vis
:
&
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
self
.print_fn_header_info
(
unsafety
,
constness
,
abi
,
vis
)
?
;
if
let
Some
(
name
)
=
name
{
...
...
@@ -3037,7 +3037,7 @@ pub fn print_ty_fn(&mut self,
name
,
&
generics
,
opt_explicit_self
,
ast
::
Visibility
::
Inherited
)
?
;
&
ast
::
Visibility
::
Inherited
)
?
;
self
.end
()
}
...
...
@@ -3112,7 +3112,7 @@ pub fn print_fn_header_info(&mut self,
unsafety
:
ast
::
Unsafety
,
constness
:
ast
::
Constness
,
abi
:
Abi
,
vis
:
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
vis
:
&
ast
::
Visibility
)
->
io
::
Result
<
()
>
{
word
(
&
mut
self
.s
,
&
visibility_qualified
(
vis
,
""
))
?
;
match
constness
{
...
...
src/libsyntax/visit.rs
浏览文件 @
bc355244
...
...
@@ -31,10 +31,10 @@
#[derive(Copy,
Clone,
PartialEq,
Eq)]
pub
enum
FnKind
<
'a
>
{
/// fn foo() or extern "Abi" fn foo()
ItemFn
(
Ident
,
&
'a
Generics
,
Unsafety
,
Constness
,
Abi
,
Visibility
),
ItemFn
(
Ident
,
&
'a
Generics
,
Unsafety
,
Constness
,
Abi
,
&
'a
Visibility
),
/// fn foo(&self)
Method
(
Ident
,
&
'a
MethodSig
,
Option
<
Visibility
>
),
Method
(
Ident
,
&
'a
MethodSig
,
Option
<
&
'a
Visibility
>
),
/// |x, y| {}
Closure
,
...
...
@@ -260,7 +260,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
}
ItemKind
::
Fn
(
ref
declaration
,
unsafety
,
constness
,
abi
,
ref
generics
,
ref
body
)
=>
{
visitor
.visit_fn
(
FnKind
::
ItemFn
(
item
.ident
,
generics
,
unsafety
,
constness
,
abi
,
item
.vis
),
constness
,
abi
,
&
item
.vis
),
declaration
,
body
,
item
.span
,
...
...
@@ -546,7 +546,7 @@ pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V,
FnKind
::
ItemFn
(
_
,
generics
,
_
,
_
,
_
,
_
)
=>
{
visitor
.visit_generics
(
generics
);
}
FnKind
::
Method
(
_
,
sig
,
_
)
=>
{
FnKind
::
Method
(
_
,
ref
sig
,
_
)
=>
{
visitor
.visit_generics
(
&
sig
.generics
);
visitor
.visit_explicit_self
(
&
sig
.explicit_self
);
}
...
...
@@ -597,7 +597,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
visitor
.visit_expr
(
expr
);
}
ImplItemKind
::
Method
(
ref
sig
,
ref
body
)
=>
{
visitor
.visit_fn
(
FnKind
::
Method
(
impl_item
.ident
,
sig
,
Some
(
impl_item
.vis
)),
&
sig
.decl
,
visitor
.visit_fn
(
FnKind
::
Method
(
impl_item
.ident
,
sig
,
Some
(
&
impl_item
.vis
)),
&
sig
.decl
,
body
,
impl_item
.span
,
impl_item
.id
);
}
ImplItemKind
::
Type
(
ref
ty
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录