Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
eaaa60db
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,发现更多精彩内容 >>
提交
eaaa60db
编写于
11月 11, 2015
作者:
O
Oliver Schneider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename ImplItem_::*ImplItem to ImplItem_::*
[breaking change]
上级
af5d9d65
变更
31
显示空白变更内容
内联
并排
Showing
31 changed file
with
103 addition
and
106 deletion
+103
-106
src/librustc/front/map/blocks.rs
src/librustc/front/map/blocks.rs
+1
-1
src/librustc/front/map/collector.rs
src/librustc/front/map/collector.rs
+3
-4
src/librustc/front/map/mod.rs
src/librustc/front/map/mod.rs
+3
-3
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+1
-1
src/librustc/middle/check_const.rs
src/librustc/middle/check_const.rs
+1
-1
src/librustc/middle/check_static_recursion.rs
src/librustc/middle/check_static_recursion.rs
+1
-1
src/librustc/middle/const_eval.rs
src/librustc/middle/const_eval.rs
+3
-3
src/librustc/middle/dead.rs
src/librustc/middle/dead.rs
+6
-6
src/librustc/middle/infer/error_reporting.rs
src/librustc/middle/infer/error_reporting.rs
+2
-2
src/librustc/middle/reachable.rs
src/librustc/middle/reachable.rs
+6
-6
src/librustc/middle/ty/mod.rs
src/librustc/middle/ty/mod.rs
+4
-4
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/mod.rs
+1
-1
src/librustc_front/fold.rs
src/librustc_front/fold.rs
+5
-5
src/librustc_front/hir.rs
src/librustc_front/hir.rs
+3
-4
src/librustc_front/lowering.rs
src/librustc_front/lowering.rs
+3
-3
src/librustc_front/print/pprust.rs
src/librustc_front/print/pprust.rs
+3
-3
src/librustc_front/visit.rs
src/librustc_front/visit.rs
+3
-3
src/librustc_lint/bad_style.rs
src/librustc_lint/bad_style.rs
+1
-1
src/librustc_lint/builtin.rs
src/librustc_lint/builtin.rs
+3
-3
src/librustc_mir/mir_map.rs
src/librustc_mir/mir_map.rs
+2
-2
src/librustc_privacy/lib.rs
src/librustc_privacy/lib.rs
+12
-12
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+6
-7
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/base.rs
+2
-2
src/librustc_trans/trans/debuginfo/mod.rs
src/librustc_trans/trans/debuginfo/mod.rs
+1
-1
src/librustc_trans/trans/inline.rs
src/librustc_trans/trans/inline.rs
+1
-1
src/librustc_trans/trans/meth.rs
src/librustc_trans/trans/meth.rs
+2
-2
src/librustc_trans/trans/monomorphize.rs
src/librustc_trans/trans/monomorphize.rs
+1
-1
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+9
-9
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/mod.rs
+3
-3
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+8
-8
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+3
-3
未找到文件。
src/librustc/front/map/blocks.rs
浏览文件 @
eaaa60db
...
...
@@ -236,7 +236,7 @@ fn handle<A, I, M, C>(self, item_fn: I, method: M, closure: C) -> A where
},
map
::
NodeImplItem
(
ii
)
=>
{
match
ii
.node
{
ast
::
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
ast
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
method
(
ii
.id
,
ii
.name
,
sig
,
Some
(
ii
.vis
),
body
,
ii
.span
)
}
_
=>
{
...
...
src/librustc/front/map/collector.rs
浏览文件 @
eaaa60db
...
...
@@ -224,8 +224,8 @@ fn visit_trait_item(&mut self, ti: &'ast TraitItem) {
fn
visit_impl_item
(
&
mut
self
,
ii
:
&
'ast
ImplItem
)
{
let
def_data
=
match
ii
.node
{
MethodImplItem
(
..
)
|
ConstImplItem
(
..
)
=>
DefPathData
::
Value
(
ii
.name
),
TypeImplItem
(
..
)
=>
DefPathData
::
Type
(
ii
.name
),
ImplItem_
::
Method
(
..
)
|
ImplItem_
::
Const
(
..
)
=>
DefPathData
::
Value
(
ii
.name
),
ImplItem_
::
Type
(
..
)
=>
DefPathData
::
Type
(
ii
.name
),
};
self
.insert_def
(
ii
.id
,
NodeImplItem
(
ii
),
def_data
);
...
...
@@ -234,7 +234,7 @@ fn visit_impl_item(&mut self, ii: &'ast ImplItem) {
self
.parent_node
=
ii
.id
;
match
ii
.node
{
ConstImplItem
(
_
,
ref
expr
)
=>
{
ImplItem_
::
Const
(
_
,
ref
expr
)
=>
{
self
.create_def
(
expr
.id
,
DefPathData
::
Initializer
);
}
_
=>
{
}
...
...
@@ -313,4 +313,3 @@ fn visit_macro_def(&mut self, macro_def: &'ast MacroDef) {
self
.create_def
(
macro_def
.id
,
DefPathData
::
MacroDef
(
macro_def
.name
));
}
}
src/librustc/front/map/mod.rs
浏览文件 @
eaaa60db
...
...
@@ -937,18 +937,18 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
}
Some
(
NodeImplItem
(
ii
))
=>
{
match
ii
.node
{
ConstImplItem
(
..
)
=>
{
ImplItem_
::
Const
(
..
)
=>
{
format!
(
"assoc const {} in {}{}"
,
ii
.name
,
map
.path_to_string
(
id
),
id_str
)
}
MethodImplItem
(
..
)
=>
{
ImplItem_
::
Method
(
..
)
=>
{
format!
(
"method {} in {}{}"
,
ii
.name
,
map
.path_to_string
(
id
),
id_str
)
}
TypeImplItem
(
_
)
=>
{
ImplItem_
::
Type
(
_
)
=>
{
format!
(
"assoc type {} in {}{}"
,
ii
.name
,
map
.path_to_string
(
id
),
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
eaaa60db
...
...
@@ -739,7 +739,7 @@ fn encode_info_for_method<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
let
elem
=
ast_map
::
PathName
(
m
.name
);
encode_path
(
rbml_w
,
impl_path
.chain
(
Some
(
elem
)));
if
let
Some
(
impl_item
)
=
impl_item_opt
{
if
let
hir
::
MethodImplItem
(
ref
sig
,
_
)
=
impl_item
.node
{
if
let
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=
impl_item
.node
{
encode_attributes
(
rbml_w
,
&
impl_item
.attrs
);
let
scheme
=
ecx
.tcx
.lookup_item_type
(
m
.def_id
);
let
any_types
=
!
scheme
.generics.types
.is_empty
();
...
...
src/librustc/middle/check_const.rs
浏览文件 @
eaaa60db
...
...
@@ -348,7 +348,7 @@ fn visit_trait_item(&mut self, t: &'v hir::TraitItem) {
fn
visit_impl_item
(
&
mut
self
,
i
:
&
'v
hir
::
ImplItem
)
{
match
i
.node
{
hir
::
ConstImplItem
(
_
,
ref
expr
)
=>
{
hir
::
ImplItem_
::
Const
(
_
,
ref
expr
)
=>
{
self
.global_expr
(
Mode
::
Const
,
&*
expr
);
}
_
=>
self
.with_mode
(
Mode
::
Var
,
|
v
|
visit
::
walk_impl_item
(
v
,
i
)),
...
...
src/librustc/middle/check_static_recursion.rs
浏览文件 @
eaaa60db
...
...
@@ -79,7 +79,7 @@ fn visit_trait_item(&mut self, ti: &'ast hir::TraitItem) {
fn
visit_impl_item
(
&
mut
self
,
ii
:
&
'ast
hir
::
ImplItem
)
{
match
ii
.node
{
hir
::
ConstImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
=>
{
let
mut
recursion_visitor
=
CheckItemRecursionVisitor
::
new
(
self
,
&
ii
.span
);
recursion_visitor
.visit_impl_item
(
ii
);
...
...
src/librustc/middle/const_eval.rs
浏览文件 @
eaaa60db
...
...
@@ -129,7 +129,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
_
=>
None
},
Some
(
ast_map
::
NodeImplItem
(
ii
))
=>
match
ii
.node
{
hir
::
ConstImplItem
(
_
,
ref
expr
)
=>
{
hir
::
ImplItem_
::
Const
(
_
,
ref
expr
)
=>
{
Some
(
&*
expr
)
}
_
=>
None
...
...
@@ -171,7 +171,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
_
=>
None
},
csearch
::
FoundAst
::
Found
(
&
InlinedItem
::
ImplItem
(
_
,
ref
ii
))
=>
match
ii
.node
{
hir
::
ConstImplItem
(
_
,
ref
expr
)
=>
Some
(
expr
.id
),
hir
::
ImplItem_
::
Const
(
_
,
ref
expr
)
=>
Some
(
expr
.id
),
_
=>
None
},
_
=>
None
...
...
@@ -996,7 +996,7 @@ fn fromb(b: bool) -> ConstVal { Int(b as i64) }
},
ty
::
ImplContainer
(
_
)
=>
match
tcx
.map
.find
(
node_id
)
{
Some
(
ast_map
::
NodeImplItem
(
ii
))
=>
match
ii
.node
{
hir
::
ConstImplItem
(
ref
ty
,
ref
expr
)
=>
{
hir
::
ImplItem_
::
Const
(
ref
ty
,
ref
expr
)
=>
{
(
Some
(
&**
expr
),
Some
(
&**
ty
))
}
_
=>
(
None
,
None
)
...
...
src/librustc/middle/dead.rs
浏览文件 @
eaaa60db
...
...
@@ -358,14 +358,14 @@ fn visit_item(&mut self, item: &hir::Item) {
hir
::
ItemImpl
(
_
,
_
,
_
,
ref
opt_trait
,
_
,
ref
impl_items
)
=>
{
for
impl_item
in
impl_items
{
match
impl_item
.node
{
hir
::
ConstImplItem
(
..
)
|
hir
::
MethodImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
|
hir
::
ImplItem_
::
Method
(
..
)
=>
{
if
opt_trait
.is_some
()
||
has_allow_dead_code_or_lang_attr
(
&
impl_item
.attrs
)
{
self
.worklist
.push
(
impl_item
.id
);
}
}
hir
::
TypeImplItem
(
_
)
=>
{}
hir
::
ImplItem_
::
Type
(
_
)
=>
{}
}
}
}
...
...
@@ -571,21 +571,21 @@ fn visit_struct_field(&mut self, field: &hir::StructField) {
fn
visit_impl_item
(
&
mut
self
,
impl_item
:
&
hir
::
ImplItem
)
{
match
impl_item
.node
{
hir
::
ConstImplItem
(
_
,
ref
expr
)
=>
{
hir
::
ImplItem_
::
Const
(
_
,
ref
expr
)
=>
{
if
!
self
.symbol_is_live
(
impl_item
.id
,
None
)
{
self
.warn_dead_code
(
impl_item
.id
,
impl_item
.span
,
impl_item
.name
,
"associated const"
);
}
visit
::
walk_expr
(
self
,
expr
)
}
hir
::
MethodImplItem
(
_
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
_
,
ref
body
)
=>
{
if
!
self
.symbol_is_live
(
impl_item
.id
,
None
)
{
self
.warn_dead_code
(
impl_item
.id
,
impl_item
.span
,
impl_item
.name
,
"method"
);
}
visit
::
walk_block
(
self
,
body
)
}
hir
::
TypeImplItem
(
..
)
=>
{}
hir
::
ImplItem_
::
Type
(
..
)
=>
{}
}
}
...
...
src/librustc/middle/infer/error_reporting.rs
浏览文件 @
eaaa60db
...
...
@@ -948,7 +948,7 @@ fn give_suggestion(&self, same_regions: &[SameRegions]) {
}
ast_map
::
NodeImplItem
(
item
)
=>
{
match
item
.node
{
hir
::
MethodImplItem
(
ref
sig
,
_
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=>
{
Some
((
&
sig
.decl
,
&
sig
.generics
,
sig
.unsafety
,
...
...
@@ -1839,7 +1839,7 @@ fn lifetimes_in_scope(tcx: &ty::ctxt,
},
ast_map
::
NodeImplItem
(
ii
)
=>
{
match
ii
.node
{
hir
::
MethodImplItem
(
ref
sig
,
_
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=>
{
taken
.push_all
(
&
sig
.generics.lifetimes
);
Some
(
ii
.id
)
}
...
...
src/librustc/middle/reachable.rs
浏览文件 @
eaaa60db
...
...
@@ -185,8 +185,8 @@ fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool {
}
Some
(
ast_map
::
NodeImplItem
(
impl_item
))
=>
{
match
impl_item
.node
{
hir
::
ConstImplItem
(
..
)
=>
true
,
hir
::
MethodImplItem
(
ref
sig
,
_
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
=>
true
,
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=>
{
if
generics_require_inlining
(
&
sig
.generics
)
||
attr
::
requests_inline
(
&
impl_item
.attrs
)
{
true
...
...
@@ -206,7 +206,7 @@ fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool {
}
}
}
hir
::
TypeImplItem
(
_
)
=>
false
,
hir
::
ImplItem_
::
Type
(
_
)
=>
false
,
}
}
Some
(
_
)
=>
false
,
...
...
@@ -299,16 +299,16 @@ fn propagate_node(&mut self, node: &ast_map::Node,
}
ast_map
::
NodeImplItem
(
impl_item
)
=>
{
match
impl_item
.node
{
hir
::
ConstImplItem
(
_
,
ref
expr
)
=>
{
hir
::
ImplItem_
::
Const
(
_
,
ref
expr
)
=>
{
self
.visit_expr
(
&*
expr
);
}
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
let
did
=
self
.tcx.map
.get_parent_did
(
search_item
);
if
method_might_be_inlined
(
self
.tcx
,
sig
,
impl_item
,
did
)
{
visit
::
walk_block
(
self
,
body
)
}
}
hir
::
TypeImplItem
(
_
)
=>
{}
hir
::
ImplItem_
::
Type
(
_
)
=>
{}
}
}
// Nothing to recurse on for these
...
...
src/librustc/middle/ty/mod.rs
浏览文件 @
eaaa60db
...
...
@@ -1124,7 +1124,7 @@ pub fn for_item(cx: &'a ctxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx
match
cx
.map
.find
(
id
)
{
Some
(
ast_map
::
NodeImplItem
(
ref
impl_item
))
=>
{
match
impl_item
.node
{
hir
::
TypeImplItem
(
_
)
=>
{
hir
::
ImplItem_
::
Type
(
_
)
=>
{
// associated types don't have their own entry (for some reason),
// so for now just grab environment for the impl
let
impl_id
=
cx
.map
.get_parent
(
id
);
...
...
@@ -1136,7 +1136,7 @@ pub fn for_item(cx: &'a ctxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx
&
predicates
,
id
)
}
hir
::
ConstImplItem
(
_
,
_
)
=>
{
hir
::
ImplItem_
::
Const
(
_
,
_
)
=>
{
let
def_id
=
cx
.map
.local_def_id
(
id
);
let
scheme
=
cx
.lookup_item_type
(
def_id
);
let
predicates
=
cx
.lookup_predicates
(
def_id
);
...
...
@@ -1145,7 +1145,7 @@ pub fn for_item(cx: &'a ctxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx
&
predicates
,
id
)
}
hir
::
MethodImplItem
(
_
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
_
,
ref
body
)
=>
{
let
method_def_id
=
cx
.map
.local_def_id
(
id
);
match
cx
.impl_or_trait_item
(
method_def_id
)
{
MethodTraitItem
(
ref
method_ty
)
=>
{
...
...
@@ -2158,7 +2158,7 @@ pub fn associated_consts(&self, id: DefId) -> Vec<Rc<AssociatedConst<'tcx>>> {
}
ItemImpl
(
_
,
_
,
_
,
_
,
_
,
ref
iis
)
=>
{
iis
.iter
()
.filter_map
(|
ii
|
{
if
let
hir
::
ConstImplItem
(
_
,
_
)
=
ii
.node
{
if
let
hir
::
ImplItem_
::
Const
(
_
,
_
)
=
ii
.node
{
match
self
.impl_or_trait_item
(
self
.map
.local_def_id
(
ii
.id
))
{
ConstTraitItem
(
ac
)
=>
Some
(
ac
),
_
=>
{
...
...
src/librustc_borrowck/borrowck/mod.rs
浏览文件 @
eaaa60db
...
...
@@ -89,7 +89,7 @@ fn visit_trait_item(&mut self, ti: &hir::TraitItem) {
}
fn
visit_impl_item
(
&
mut
self
,
ii
:
&
hir
::
ImplItem
)
{
if
let
hir
::
ConstImplItem
(
_
,
ref
expr
)
=
ii
.node
{
if
let
hir
::
ImplItem_
::
Const
(
_
,
ref
expr
)
=
ii
.node
{
gather_loans
::
gather_loans_in_static_initializer
(
self
,
&*
expr
);
}
visit
::
walk_impl_item
(
self
,
ii
);
...
...
src/librustc_front/fold.rs
浏览文件 @
eaaa60db
...
...
@@ -867,13 +867,13 @@ pub fn noop_fold_impl_item<T: Folder>(i: P<ImplItem>, folder: &mut T) -> P<ImplI
attrs
:
fold_attrs
(
attrs
,
folder
),
vis
:
vis
,
node
:
match
node
{
ConstImplItem
(
ty
,
expr
)
=>
{
ConstImplItem
(
folder
.fold_ty
(
ty
),
folder
.fold_expr
(
expr
))
ImplItem_
::
Const
(
ty
,
expr
)
=>
{
ImplItem_
::
Const
(
folder
.fold_ty
(
ty
),
folder
.fold_expr
(
expr
))
}
MethodImplItem
(
sig
,
body
)
=>
{
MethodImplItem
(
noop_fold_method_sig
(
sig
,
folder
),
folder
.fold_block
(
body
))
ImplItem_
::
Method
(
sig
,
body
)
=>
{
ImplItem_
::
Method
(
noop_fold_method_sig
(
sig
,
folder
),
folder
.fold_block
(
body
))
}
TypeImplItem
(
ty
)
=>
TypeImplItem
(
folder
.fold_ty
(
ty
)),
ImplItem_
::
Type
(
ty
)
=>
ImplItem_
::
Type
(
folder
.fold_ty
(
ty
)),
},
span
:
folder
.new_span
(
span
),
}
...
...
src/librustc_front/hir.rs
浏览文件 @
eaaa60db
...
...
@@ -19,7 +19,6 @@
pub
use
self
::
Expr_
::
*
;
pub
use
self
::
FunctionRetTy
::
*
;
pub
use
self
::
ForeignItem_
::
*
;
pub
use
self
::
ImplItem_
::
*
;
pub
use
self
::
Item_
::
*
;
pub
use
self
::
Mutability
::
*
;
pub
use
self
::
Pat_
::
*
;
...
...
@@ -777,9 +776,9 @@ pub struct ImplItem {
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug)]
pub
enum
ImplItem_
{
Const
ImplItem
(
P
<
Ty
>
,
P
<
Expr
>
),
Method
ImplItem
(
MethodSig
,
P
<
Block
>
),
Type
ImplItem
(
P
<
Ty
>
),
Const
(
P
<
Ty
>
,
P
<
Expr
>
),
Method
(
MethodSig
,
P
<
Block
>
),
Type
(
P
<
Ty
>
),
}
// Bind a type to an associated type: `A=Foo`.
...
...
src/librustc_front/lowering.rs
浏览文件 @
eaaa60db
...
...
@@ -676,12 +676,12 @@ pub fn lower_impl_item(_lctx: &LoweringContext, i: &ImplItem) -> P<hir::ImplItem
vis
:
lower_visibility
(
_
lctx
,
i
.vis
),
node
:
match
i
.node
{
ConstImplItem
(
ref
ty
,
ref
expr
)
=>
{
hir
::
ConstImplItem
(
lower_ty
(
_
lctx
,
ty
),
lower_expr
(
_
lctx
,
expr
))
hir
::
ImplItem_
::
Const
(
lower_ty
(
_
lctx
,
ty
),
lower_expr
(
_
lctx
,
expr
))
}
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
MethodImplItem
(
lower_method_sig
(
_
lctx
,
sig
),
lower_block
(
_
lctx
,
body
))
hir
::
ImplItem_
::
Method
(
lower_method_sig
(
_
lctx
,
sig
),
lower_block
(
_
lctx
,
body
))
}
TypeImplItem
(
ref
ty
)
=>
hir
::
TypeImplItem
(
lower_ty
(
_
lctx
,
ty
)),
TypeImplItem
(
ref
ty
)
=>
hir
::
ImplItem_
::
Type
(
lower_ty
(
_
lctx
,
ty
)),
MacImplItem
(
..
)
=>
panic!
(
"Shouldn't exist any more"
),
},
span
:
i
.span
,
...
...
src/librustc_front/print/pprust.rs
浏览文件 @
eaaa60db
...
...
@@ -1011,16 +1011,16 @@ pub fn print_impl_item(&mut self, ii: &hir::ImplItem) -> io::Result<()> {
try!
(
self
.maybe_print_comment
(
ii
.span.lo
));
try!
(
self
.print_outer_attributes
(
&
ii
.attrs
));
match
ii
.node
{
hir
::
ConstImplItem
(
ref
ty
,
ref
expr
)
=>
{
hir
::
ImplItem_
::
Const
(
ref
ty
,
ref
expr
)
=>
{
try!
(
self
.print_associated_const
(
ii
.name
,
&
ty
,
Some
(
&
expr
),
ii
.vis
));
}
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
try!
(
self
.head
(
""
));
try!
(
self
.print_method_sig
(
ii
.name
,
sig
,
ii
.vis
));
try!
(
self
.nbsp
());
try!
(
self
.print_block_with_attrs
(
body
,
&
ii
.attrs
));
}
hir
::
TypeImplItem
(
ref
ty
)
=>
{
hir
::
ImplItem_
::
Type
(
ref
ty
)
=>
{
try!
(
self
.print_associated_type
(
ii
.name
,
None
,
Some
(
ty
)));
}
}
...
...
src/librustc_front/visit.rs
浏览文件 @
eaaa60db
...
...
@@ -614,18 +614,18 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
visitor
.visit_name
(
impl_item
.span
,
impl_item
.name
);
walk_list!
(
visitor
,
visit_attribute
,
&
impl_item
.attrs
);
match
impl_item
.node
{
ConstImplItem
(
ref
ty
,
ref
expr
)
=>
{
ImplItem_
::
Const
(
ref
ty
,
ref
expr
)
=>
{
visitor
.visit_ty
(
ty
);
visitor
.visit_expr
(
expr
);
}
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
visitor
.visit_fn
(
FnKind
::
Method
(
impl_item
.name
,
sig
,
Some
(
impl_item
.vis
)),
&
sig
.decl
,
body
,
impl_item
.span
,
impl_item
.id
);
}
TypeImplItem
(
ref
ty
)
=>
{
ImplItem_
::
Type
(
ref
ty
)
=>
{
visitor
.visit_ty
(
ty
);
}
}
...
...
src/librustc_lint/bad_style.rs
浏览文件 @
eaaa60db
...
...
@@ -351,7 +351,7 @@ fn check_trait_item(&mut self, cx: &LateContext, ti: &hir::TraitItem) {
fn
check_impl_item
(
&
mut
self
,
cx
:
&
LateContext
,
ii
:
&
hir
::
ImplItem
)
{
match
ii
.node
{
hir
::
ConstImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
=>
{
NonUpperCaseGlobals
::
check_upper_case
(
cx
,
"associated constant"
,
ii
.name
,
ii
.span
);
}
...
...
src/librustc_lint/builtin.rs
浏览文件 @
eaaa60db
...
...
@@ -505,9 +505,9 @@ fn check_impl_item(&mut self, cx: &LateContext, impl_item: &hir::ImplItem) {
}
let
desc
=
match
impl_item
.node
{
hir
::
ConstImplItem
(
..
)
=>
"an associated constant"
,
hir
::
MethodImplItem
(
..
)
=>
"a method"
,
hir
::
TypeImplItem
(
_
)
=>
"an associated type"
,
hir
::
ImplItem_
::
Const
(
..
)
=>
"an associated constant"
,
hir
::
ImplItem_
::
Method
(
..
)
=>
"a method"
,
hir
::
ImplItem_
::
Type
(
_
)
=>
"an associated type"
,
};
self
.check_missing_docs_attrs
(
cx
,
Some
(
impl_item
.id
),
&
impl_item
.attrs
,
...
...
src/librustc_mir/mir_map.rs
浏览文件 @
eaaa60db
...
...
@@ -99,10 +99,10 @@ fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
fn
visit_impl_item
(
&
mut
self
,
impl_item
:
&
'tcx
hir
::
ImplItem
)
{
match
impl_item
.node
{
hir
::
MethodImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Method
(
..
)
=>
{
self
.visit_mir
(
&
impl_item
.attrs
,
|
c
|
visit
::
walk_impl_item
(
c
,
impl_item
));
}
hir
::
ConstImplItem
(
..
)
|
hir
::
TypeImplItem
(
..
)
=>
{}
hir
::
ImplItem_
::
Const
(
..
)
|
hir
::
ImplItem_
::
Type
(
..
)
=>
{}
}
visit
::
walk_impl_item
(
self
,
impl_item
);
}
...
...
src/librustc_privacy/lib.rs
浏览文件 @
eaaa60db
...
...
@@ -553,8 +553,8 @@ fn def_privacy(&self, did: DefId) -> PrivacyResult {
// where the method was defined?
Some
(
ast_map
::
NodeImplItem
(
ii
))
=>
{
match
ii
.node
{
hir
::
ConstImplItem
(
..
)
|
hir
::
MethodImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
|
hir
::
ImplItem_
::
Method
(
..
)
=>
{
let
imp
=
self
.tcx.map
.get_parent_did
(
closest_private_id
);
match
self
.tcx
.impl_trait_ref
(
imp
)
{
...
...
@@ -565,7 +565,7 @@ fn def_privacy(&self, did: DefId) -> PrivacyResult {
_
=>
ii
.vis
}
}
hir
::
TypeImplItem
(
_
)
=>
return
Allowable
,
hir
::
ImplItem_
::
Type
(
_
)
=>
return
Allowable
,
}
}
Some
(
ast_map
::
NodeTraitItem
(
_
))
=>
{
...
...
@@ -1293,11 +1293,11 @@ fn visit_item(&mut self, item: &hir::Item) {
impl_items
.iter
()
.any
(|
impl_item
|
{
match
impl_item
.node
{
hir
::
ConstImplItem
(
..
)
|
hir
::
MethodImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
|
hir
::
ImplItem_
::
Method
(
..
)
=>
{
self
.exported_items
.contains
(
&
impl_item
.id
)
}
hir
::
TypeImplItem
(
_
)
=>
false
,
hir
::
ImplItem_
::
Type
(
_
)
=>
false
,
}
});
...
...
@@ -1316,13 +1316,13 @@ fn visit_item(&mut self, item: &hir::Item) {
// don't erroneously report errors for private
// types in private items.
match
impl_item
.node
{
hir
::
ConstImplItem
(
..
)
|
hir
::
MethodImplItem
(
..
)
hir
::
ImplItem_
::
Const
(
..
)
|
hir
::
ImplItem_
::
Method
(
..
)
if
self
.item_is_public
(
&
impl_item
.id
,
impl_item
.vis
)
=>
{
visit
::
walk_impl_item
(
self
,
impl_item
)
}
hir
::
TypeImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Type
(
..
)
=>
{
visit
::
walk_impl_item
(
self
,
impl_item
)
}
_
=>
{}
...
...
@@ -1347,7 +1347,7 @@ fn visit_item(&mut self, item: &hir::Item) {
// Those in 3. are warned with this call.
for
impl_item
in
impl_items
{
if
let
hir
::
TypeImplItem
(
ref
ty
)
=
impl_item
.node
{
if
let
hir
::
ImplItem_
::
Type
(
ref
ty
)
=
impl_item
.node
{
self
.visit_ty
(
ty
);
}
}
...
...
@@ -1359,13 +1359,13 @@ fn visit_item(&mut self, item: &hir::Item) {
let
mut
found_pub_static
=
false
;
for
impl_item
in
impl_items
{
match
impl_item
.node
{
hir
::
ConstImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
=>
{
if
self
.item_is_public
(
&
impl_item
.id
,
impl_item
.vis
)
{
found_pub_static
=
true
;
visit
::
walk_impl_item
(
self
,
impl_item
);
}
}
hir
::
MethodImplItem
(
ref
sig
,
_
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=>
{
if
sig
.explicit_self.node
==
hir
::
SelfStatic
&&
self
.item_is_public
(
&
impl_item
.id
,
impl_item
.vis
)
{
found_pub_static
=
true
;
...
...
src/librustc_resolve/lib.rs
浏览文件 @
eaaa60db
...
...
@@ -79,7 +79,7 @@
use
rustc_front
::
visit
::{
self
,
FnKind
,
Visitor
};
use
rustc_front
::
hir
;
use
rustc_front
::
hir
::{
Arm
,
BindByRef
,
BindByValue
,
BindingMode
,
Block
};
use
rustc_front
::
hir
::
{
ConstImplItem
,
Crate
}
;
use
rustc_front
::
hir
::
Crate
;
use
rustc_front
::
hir
::{
Expr
,
ExprAgain
,
ExprBreak
,
ExprField
};
use
rustc_front
::
hir
::{
ExprLoop
,
ExprWhile
,
ExprMethodCall
};
use
rustc_front
::
hir
::{
ExprPath
,
ExprStruct
,
FnDecl
};
...
...
@@ -87,12 +87,11 @@
use
rustc_front
::
hir
::{
ImplItem
,
Item
,
ItemConst
,
ItemEnum
,
ItemExternCrate
};
use
rustc_front
::
hir
::{
ItemFn
,
ItemForeignMod
,
ItemImpl
,
ItemMod
,
ItemStatic
,
ItemDefaultImpl
};
use
rustc_front
::
hir
::{
ItemStruct
,
ItemTrait
,
ItemTy
,
ItemUse
};
use
rustc_front
::
hir
::
{
Local
,
MethodImplItem
}
;
use
rustc_front
::
hir
::
Local
;
use
rustc_front
::
hir
::{
Pat
,
PatEnum
,
PatIdent
,
PatLit
,
PatQPath
};
use
rustc_front
::
hir
::{
PatRange
,
PatStruct
,
Path
,
PrimTy
};
use
rustc_front
::
hir
::{
TraitRef
,
Ty
,
TyBool
,
TyChar
,
TyFloat
,
TyInt
};
use
rustc_front
::
hir
::{
TyRptr
,
TyStr
,
TyUint
,
TyPath
,
TyPtr
};
use
rustc_front
::
hir
::
TypeImplItem
;
use
rustc_front
::
util
::
walk_pat
;
use
std
::
collections
::{
HashMap
,
HashSet
};
...
...
@@ -2421,7 +2420,7 @@ fn resolve_implementation(&mut self,
this
.with_current_self_type
(
self_type
,
|
this
|
{
for
impl_item
in
impl_items
{
match
impl_item
.node
{
ConstImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
=>
{
// If this is a trait impl, ensure the const
// exists in trait
this
.check_trait_item
(
impl_item
.name
,
...
...
@@ -2431,7 +2430,7 @@ fn resolve_implementation(&mut self,
visit
::
walk_impl_item
(
this
,
impl_item
);
});
}
MethodImplItem
(
ref
sig
,
_
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=>
{
// If this is a trait impl, ensure the method
// exists in trait
this
.check_trait_item
(
impl_item
.name
,
...
...
@@ -2448,7 +2447,7 @@ fn resolve_implementation(&mut self,
visit
::
walk_impl_item
(
this
,
impl_item
);
});
}
TypeImplItem
(
ref
ty
)
=>
{
hir
::
ImplItem_
::
Type
(
ref
ty
)
=>
{
// If this is a trait impl, ensure the type
// exists in trait
this
.check_trait_item
(
impl_item
.name
,
...
...
@@ -3545,7 +3544,7 @@ fn is_static_method(this: &Resolver, did: DefId) -> bool {
_
=>
return
false
,
},
hir_map
::
NodeImplItem
(
impl_item
)
=>
match
impl_item
.node
{
hir
::
MethodImplItem
(
ref
sig
,
_
)
=>
sig
,
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=>
sig
,
_
=>
return
false
,
},
_
=>
return
false
,
...
...
src/librustc_trans/trans/base.rs
浏览文件 @
eaaa60db
...
...
@@ -1326,7 +1326,7 @@ fn build_cfg(tcx: &ty::ctxt, id: ast::NodeId) -> (ast::NodeId, Option<cfg::CFG>)
}
Some
(
hir_map
::
NodeImplItem
(
impl_item
))
=>
{
match
impl_item
.node
{
hir
::
MethodImplItem
(
_
,
ref
body
)
=>
body
,
hir
::
ImplItem_
::
Method
(
_
,
ref
body
)
=>
body
,
_
=>
{
tcx
.sess
.bug
(
"unexpected variant: non-method impl item in
\
has_nested_returns"
)
...
...
@@ -2614,7 +2614,7 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
hir_map
::
NodeImplItem
(
impl_item
)
=>
{
match
impl_item
.node
{
hir
::
MethodImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Method
(
..
)
=>
{
register_method
(
ccx
,
id
,
&
impl_item
.attrs
,
impl_item
.span
)
}
_
=>
{
...
...
src/librustc_trans/trans/debuginfo/mod.rs
浏览文件 @
eaaa60db
...
...
@@ -253,7 +253,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
}
hir_map
::
NodeImplItem
(
impl_item
)
=>
{
match
impl_item
.node
{
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
if
contains_nodebug_attribute
(
&
impl_item
.attrs
)
{
return
FunctionDebugContext
::
FunctionWithoutDebugInfo
;
}
...
...
src/librustc_trans/trans/inline.rs
浏览文件 @
eaaa60db
...
...
@@ -160,7 +160,7 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: DefId)
ccx
.stats
()
.n_inlines
.set
(
ccx
.stats
()
.n_inlines
.get
()
+
1
);
// Translate monomorphic impl methods immediately.
if
let
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=
impl_item
.node
{
if
let
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=
impl_item
.node
{
let
impl_tpt
=
ccx
.tcx
()
.lookup_item_type
(
impl_did
);
if
impl_tpt
.generics.types
.is_empty
()
&&
sig
.generics.ty_params
.is_empty
()
{
...
...
src/librustc_trans/trans/meth.rs
浏览文件 @
eaaa60db
...
...
@@ -70,7 +70,7 @@ pub fn trans_impl(ccx: &CrateContext,
if
!
generics
.ty_params
.is_empty
()
{
for
impl_item
in
impl_items
{
match
impl_item
.node
{
hir
::
MethodImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Method
(
..
)
=>
{
visit
::
walk_impl_item
(
&
mut
v
,
impl_item
);
}
_
=>
{}
...
...
@@ -80,7 +80,7 @@ pub fn trans_impl(ccx: &CrateContext,
}
for
impl_item
in
impl_items
{
match
impl_item
.node
{
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
if
sig
.generics.ty_params
.is_empty
()
{
let
trans_everywhere
=
attr
::
requests_inline
(
&
impl_item
.attrs
);
for
(
ref
ccx
,
is_origin
)
in
ccx
.maybe_iter
(
trans_everywhere
)
{
...
...
src/librustc_trans/trans/monomorphize.rs
浏览文件 @
eaaa60db
...
...
@@ -206,7 +206,7 @@ pub fn monomorphic_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
}
hir_map
::
NodeImplItem
(
impl_item
)
=>
{
match
impl_item
.node
{
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
let
d
=
mk_lldecl
(
abi
::
Rust
);
let
needs_body
=
setup_lldecl
(
d
,
&
impl_item
.attrs
);
if
needs_body
{
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
eaaa60db
...
...
@@ -764,14 +764,14 @@ pub fn check_item_body<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx hir::Item) {
for
impl_item
in
impl_items
{
match
impl_item
.node
{
hir
::
ConstImplItem
(
_
,
ref
expr
)
=>
{
hir
::
ImplItem_
::
Const
(
_
,
ref
expr
)
=>
{
check_const
(
ccx
,
impl_item
.span
,
&*
expr
,
impl_item
.id
)
}
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
check_method_body
(
ccx
,
&
impl_pty
.generics
,
sig
,
body
,
impl_item
.id
,
impl_item
.span
);
}
hir
::
TypeImplItem
(
_
)
=>
{
hir
::
ImplItem_
::
Type
(
_
)
=>
{
// Nothing to do here.
}
}
...
...
@@ -908,7 +908,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
impl_trait_ref
));
});
match
impl_item
.node
{
hir
::
ConstImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
=>
{
let
impl_const
=
match
ty_impl_item
{
ty
::
ConstTraitItem
(
ref
cti
)
=>
cti
,
_
=>
tcx
.sess
.span_bug
(
impl_item
.span
,
"non-const impl-item for const"
)
...
...
@@ -929,7 +929,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
impl_trait_ref
)
}
}
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=>
{
check_trait_fn_not_const
(
ccx
,
impl_item
.span
,
sig
.constness
);
let
impl_method
=
match
ty_impl_item
{
...
...
@@ -952,7 +952,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
impl_trait_ref
)
}
}
hir
::
TypeImplItem
(
_
)
=>
{
hir
::
ImplItem_
::
Type
(
_
)
=>
{
let
impl_type
=
match
ty_impl_item
{
ty
::
TypeTraitItem
(
ref
tti
)
=>
tti
,
_
=>
tcx
.sess
.span_bug
(
impl_item
.span
,
"non-type impl-item for type"
)
...
...
@@ -983,7 +983,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
ty
::
ConstTraitItem
(
ref
associated_const
)
=>
{
let
is_implemented
=
impl_items
.iter
()
.any
(|
ii
|
{
match
ii
.node
{
hir
::
ConstImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
=>
{
ii
.name
==
associated_const
.name
}
_
=>
false
,
...
...
@@ -1003,7 +1003,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
let
is_implemented
=
impl_items
.iter
()
.any
(|
ii
|
{
match
ii
.node
{
hir
::
MethodImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Method
(
..
)
=>
{
ii
.name
==
trait_method
.name
}
_
=>
false
,
...
...
@@ -1022,7 +1022,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
ty
::
TypeTraitItem
(
ref
associated_type
)
=>
{
let
is_implemented
=
impl_items
.iter
()
.any
(|
ii
|
{
match
ii
.node
{
hir
::
TypeImplItem
(
_
)
=>
{
hir
::
ImplItem_
::
Type
(
_
)
=>
{
ii
.name
==
associated_type
.name
}
_
=>
false
,
...
...
src/librustc_typeck/coherence/mod.rs
浏览文件 @
eaaa60db
...
...
@@ -196,13 +196,13 @@ fn create_impl_from_item(&self, item: &Item) -> Vec<ImplOrTraitItemId> {
impl_items
.iter
()
.map
(|
impl_item
|
{
let
impl_def_id
=
self
.crate_context.tcx.map
.local_def_id
(
impl_item
.id
);
match
impl_item
.node
{
hir
::
ConstImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Const
(
..
)
=>
{
ConstTraitItemId
(
impl_def_id
)
}
hir
::
MethodImplItem
(
..
)
=>
{
hir
::
ImplItem_
::
Method
(
..
)
=>
{
MethodTraitItemId
(
impl_def_id
)
}
hir
::
TypeImplItem
(
_
)
=>
{
hir
::
ImplItem_
::
Type
(
_
)
=>
{
TypeTraitItemId
(
impl_def_id
)
}
}
...
...
src/librustc_typeck/collect.rs
浏览文件 @
eaaa60db
...
...
@@ -821,14 +821,14 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
for
impl_item
in
impl_items
{
let
seen_items
=
match
impl_item
.node
{
hir
::
TypeImplItem
(
_
)
=>
&
mut
seen_type_items
,
hir
::
ImplItem_
::
Type
(
_
)
=>
&
mut
seen_type_items
,
_
=>
&
mut
seen_value_items
,
};
if
!
seen_items
.insert
(
impl_item
.name
)
{
let
desc
=
match
impl_item
.node
{
hir
::
ConstImplItem
(
_
,
_
)
=>
"associated constant"
,
hir
::
TypeImplItem
(
_
)
=>
"associated type"
,
hir
::
MethodImplItem
(
ref
sig
,
_
)
=>
hir
::
ImplItem_
::
Const
(
_
,
_
)
=>
"associated constant"
,
hir
::
ImplItem_
::
Type
(
_
)
=>
"associated type"
,
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=>
match
sig
.explicit_self.node
{
hir
::
SelfStatic
=>
"associated function"
,
_
=>
"method"
,
...
...
@@ -838,7 +838,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
span_err!
(
tcx
.sess
,
impl_item
.span
,
E0201
,
"duplicate {}"
,
desc
);
}
if
let
hir
::
ConstImplItem
(
ref
ty
,
_
)
=
impl_item
.node
{
if
let
hir
::
ImplItem_
::
Const
(
ref
ty
,
_
)
=
impl_item
.node
{
let
ty
=
ccx
.icx
(
&
ty_predicates
)
.to_ty
(
&
ExplicitRscope
,
&*
ty
);
tcx
.register_item_type
(
ccx
.tcx.map
.local_def_id
(
impl_item
.id
),
...
...
@@ -855,7 +855,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
// Convert all the associated types.
for
impl_item
in
impl_items
{
if
let
hir
::
TypeImplItem
(
ref
ty
)
=
impl_item
.node
{
if
let
hir
::
ImplItem_
::
Type
(
ref
ty
)
=
impl_item
.node
{
if
opt_trait_ref
.is_none
()
{
span_err!
(
tcx
.sess
,
impl_item
.span
,
E0202
,
"associated types are not allowed in inherent impls"
);
...
...
@@ -870,7 +870,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
}
let
methods
=
impl_items
.iter
()
.filter_map
(|
ii
|
{
if
let
hir
::
MethodImplItem
(
ref
sig
,
_
)
=
ii
.node
{
if
let
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=
ii
.node
{
// if the method specifies a visibility, use that, otherwise
// inherit the visibility from the impl (so `foo` in `pub impl
// { fn foo(); }` is public, but private in `impl { fn
...
...
@@ -889,7 +889,7 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) {
&
ty_predicates
);
for
impl_item
in
impl_items
{
if
let
hir
::
MethodImplItem
(
ref
sig
,
ref
body
)
=
impl_item
.node
{
if
let
hir
::
ImplItem_
::
Method
(
ref
sig
,
ref
body
)
=
impl_item
.node
{
let
body_id
=
body
.id
;
check_method_self_type
(
ccx
,
&
BindingRscope
::
new
(),
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
eaaa60db
...
...
@@ -1271,16 +1271,16 @@ fn clean(&self, cx: &DocContext) -> Item {
impl
Clean
<
Item
>
for
hir
::
ImplItem
{
fn
clean
(
&
self
,
cx
:
&
DocContext
)
->
Item
{
let
inner
=
match
self
.node
{
hir
::
ConstImplItem
(
ref
ty
,
ref
expr
)
=>
{
hir
::
ImplItem_
::
Const
(
ref
ty
,
ref
expr
)
=>
{
ConstantItem
(
Constant
{
type_
:
ty
.clean
(
cx
),
expr
:
expr
.span
.to_src
(
cx
),
})
}
hir
::
MethodImplItem
(
ref
sig
,
_
)
=>
{
hir
::
ImplItem_
::
Method
(
ref
sig
,
_
)
=>
{
MethodItem
(
sig
.clean
(
cx
))
}
hir
::
TypeImplItem
(
ref
ty
)
=>
TypedefItem
(
Typedef
{
hir
::
ImplItem_
::
Type
(
ref
ty
)
=>
TypedefItem
(
Typedef
{
type_
:
ty
.clean
(
cx
),
generics
:
Generics
{
lifetimes
:
Vec
::
new
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录