Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b4748679
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,发现更多精彩内容 >>
提交
b4748679
编写于
9月 26, 2019
作者:
V
varkor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename `ForeignItem.node` to `ForeignItem.kind`
上级
7bc94cc3
变更
35
显示空白变更内容
内联
并排
Showing
35 changed file
with
52 addition
and
52 deletion
+52
-52
src/librustc/hir/intravisit.rs
src/librustc/hir/intravisit.rs
+1
-1
src/librustc/hir/lowering/item.rs
src/librustc/hir/lowering/item.rs
+1
-1
src/librustc/hir/map/def_collector.rs
src/librustc/hir/map/def_collector.rs
+1
-1
src/librustc/hir/map/mod.rs
src/librustc/hir/map/mod.rs
+2
-2
src/librustc/hir/mod.rs
src/librustc/hir/mod.rs
+1
-1
src/librustc/hir/print.rs
src/librustc/hir/print.rs
+1
-1
src/librustc/middle/dead.rs
src/librustc/middle/dead.rs
+1
-1
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/resolve_lifetime.rs
+1
-1
src/librustc/middle/stability.rs
src/librustc/middle/stability.rs
+1
-1
src/librustc_codegen_llvm/consts.rs
src/librustc_codegen_llvm/consts.rs
+1
-1
src/librustc_lint/types.rs
src/librustc_lint/types.rs
+1
-1
src/librustc_metadata/encoder.rs
src/librustc_metadata/encoder.rs
+2
-2
src/librustc_passes/ast_validation.rs
src/librustc_passes/ast_validation.rs
+1
-1
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/build_reduced_graph.rs
+2
-2
src/librustc_resolve/late.rs
src/librustc_resolve/late.rs
+1
-1
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/dump_visitor.rs
+1
-1
src/librustc_save_analysis/lib.rs
src/librustc_save_analysis/lib.rs
+1
-1
src/librustc_save_analysis/sig.rs
src/librustc_save_analysis/sig.rs
+1
-1
src/librustc_traits/lowering/environment.rs
src/librustc_traits/lowering/environment.rs
+1
-1
src/librustc_typeck/check/intrinsic.rs
src/librustc_typeck/check/intrinsic.rs
+2
-2
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+2
-2
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/check/wfcheck.rs
+1
-1
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+8
-8
src/librustc_typeck/variance/constraints.rs
src/librustc_typeck/variance/constraints.rs
+1
-1
src/librustc_typeck/variance/mod.rs
src/librustc_typeck/variance/mod.rs
+1
-1
src/librustc_typeck/variance/terms.rs
src/librustc_typeck/variance/terms.rs
+1
-1
src/librustdoc/visit_ast.rs
src/librustdoc/visit_ast.rs
+1
-1
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+1
-1
src/libsyntax/ext/expand.rs
src/libsyntax/ext/expand.rs
+1
-1
src/libsyntax/ext/placeholders.rs
src/libsyntax/ext/placeholders.rs
+2
-2
src/libsyntax/feature_gate/check.rs
src/libsyntax/feature_gate/check.rs
+1
-1
src/libsyntax/mut_visit.rs
src/libsyntax/mut_visit.rs
+2
-2
src/libsyntax/parse/parser/item.rs
src/libsyntax/parse/parser/item.rs
+4
-4
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+1
-1
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+1
-1
未找到文件。
src/librustc/hir/intravisit.rs
浏览文件 @
b4748679
...
...
@@ -743,7 +743,7 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
visitor
.visit_vis
(
&
foreign_item
.vis
);
visitor
.visit_ident
(
foreign_item
.ident
);
match
foreign_item
.
node
{
match
foreign_item
.
kind
{
ForeignItemKind
::
Fn
(
ref
function_declaration
,
ref
param_names
,
ref
generics
)
=>
{
visitor
.visit_generics
(
generics
);
visitor
.visit_fn_decl
(
function_declaration
);
...
...
src/librustc/hir/lowering/item.rs
浏览文件 @
b4748679
...
...
@@ -711,7 +711,7 @@ fn lower_foreign_item(&mut self, i: &ForeignItem) -> hir::ForeignItem {
hir_id
:
self
.lower_node_id
(
i
.id
),
ident
:
i
.ident
,
attrs
:
self
.lower_attrs
(
&
i
.attrs
),
node
:
match
i
.node
{
kind
:
match
i
.kind
{
ForeignItemKind
::
Fn
(
ref
fdec
,
ref
generics
)
=>
{
let
(
generics
,
(
fn_dec
,
fn_args
))
=
self
.add_in_band_defs
(
generics
,
...
...
src/librustc/hir/map/def_collector.rs
浏览文件 @
b4748679
...
...
@@ -157,7 +157,7 @@ fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) {
}
fn
visit_foreign_item
(
&
mut
self
,
foreign_item
:
&
'a
ForeignItem
)
{
if
let
ForeignItemKind
::
Macro
(
_
)
=
foreign_item
.
node
{
if
let
ForeignItemKind
::
Macro
(
_
)
=
foreign_item
.
kind
{
return
self
.visit_macro_invoc
(
foreign_item
.id
);
}
...
...
src/librustc/hir/map/mod.rs
浏览文件 @
b4748679
...
...
@@ -313,7 +313,7 @@ pub fn def_kind(&self, hir_id: HirId) -> Option<DefKind> {
}
}
Node
::
ForeignItem
(
item
)
=>
{
match
item
.
node
{
match
item
.
kind
{
ForeignItemKind
::
Fn
(
..
)
=>
DefKind
::
Fn
,
ForeignItemKind
::
Static
(
..
)
=>
DefKind
::
Static
,
ForeignItemKind
::
Type
=>
DefKind
::
ForeignTy
,
...
...
@@ -820,7 +820,7 @@ pub fn get_enclosing_scope(&self, hir_id: HirId) -> Option<HirId> {
}
},
Node
::
ForeignItem
(
fi
)
=>
{
match
fi
.
node
{
match
fi
.
kind
{
ForeignItemKind
::
Fn
(
..
)
=>
true
,
_
=>
false
,
}
...
...
src/librustc/hir/mod.rs
浏览文件 @
b4748679
...
...
@@ -2581,7 +2581,7 @@ pub struct ForeignItem {
#[stable_hasher(project(name))]
pub
ident
:
Ident
,
pub
attrs
:
HirVec
<
Attribute
>
,
pub
node
:
ForeignItemKind
,
pub
kind
:
ForeignItemKind
,
pub
hir_id
:
HirId
,
pub
span
:
Span
,
pub
vis
:
Visibility
,
...
...
src/librustc/hir/print.rs
浏览文件 @
b4748679
...
...
@@ -372,7 +372,7 @@ pub fn print_foreign_item(&mut self, item: &hir::ForeignItem) {
self
.hardbreak_if_not_bol
();
self
.maybe_print_comment
(
item
.span
.lo
());
self
.print_outer_attributes
(
&
item
.attrs
);
match
item
.
node
{
match
item
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
ref
decl
,
ref
arg_names
,
ref
generics
)
=>
{
self
.head
(
""
);
self
.print_fn
(
decl
,
...
...
src/librustc/middle/dead.rs
浏览文件 @
b4748679
...
...
@@ -613,7 +613,7 @@ fn visit_variant(&mut self,
fn
visit_foreign_item
(
&
mut
self
,
fi
:
&
'tcx
hir
::
ForeignItem
)
{
if
self
.should_warn_about_foreign_item
(
fi
)
{
self
.warn_dead_code
(
fi
.hir_id
,
fi
.span
,
fi
.ident.name
,
fi
.
node
.descriptive_variant
(),
"used"
);
fi
.
kind
.descriptive_variant
(),
"used"
);
}
intravisit
::
walk_foreign_item
(
self
,
fi
);
}
...
...
src/librustc/middle/resolve_lifetime.rs
浏览文件 @
b4748679
...
...
@@ -541,7 +541,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
}
fn
visit_foreign_item
(
&
mut
self
,
item
:
&
'tcx
hir
::
ForeignItem
)
{
match
item
.
node
{
match
item
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
ref
decl
,
_
,
ref
generics
)
=>
{
self
.visit_early_late
(
None
,
decl
,
generics
,
|
this
|
{
intravisit
::
walk_foreign_item
(
this
,
item
);
...
...
src/librustc/middle/stability.rs
浏览文件 @
b4748679
...
...
@@ -382,7 +382,7 @@ fn visit_struct_field(&mut self, s: &'tcx StructField) {
}
fn
visit_foreign_item
(
&
mut
self
,
i
:
&
'tcx
hir
::
ForeignItem
)
{
self
.check_missing_stability
(
i
.hir_id
,
i
.span
,
i
.
node
.descriptive_variant
());
self
.check_missing_stability
(
i
.hir_id
,
i
.span
,
i
.
kind
.descriptive_variant
());
intravisit
::
walk_foreign_item
(
self
,
i
);
}
...
...
src/librustc_codegen_llvm/consts.rs
浏览文件 @
b4748679
...
...
@@ -249,7 +249,7 @@ impl CodegenCx<'ll, 'tcx> {
}
Node
::
ForeignItem
(
&
hir
::
ForeignItem
{
ref
attrs
,
span
,
node
:
hir
::
ForeignItemKind
::
Static
(
..
),
..
ref
attrs
,
span
,
kind
:
hir
::
ForeignItemKind
::
Static
(
..
),
..
})
=>
{
let
fn_attrs
=
self
.tcx
.codegen_fn_attrs
(
def_id
);
(
check_and_apply_linkage
(
&
self
,
&
fn_attrs
,
ty
,
sym
,
span
),
attrs
)
...
...
src/librustc_lint/types.rs
浏览文件 @
b4748679
...
...
@@ -978,7 +978,7 @@ fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::ForeignItem
if
let
Abi
::
Rust
|
Abi
::
RustCall
|
Abi
::
RustIntrinsic
|
Abi
::
PlatformIntrinsic
=
abi
{
// Don't worry about types in internal ABIs.
}
else
{
match
it
.
node
{
match
it
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
ref
decl
,
_
,
_
)
=>
{
vis
.check_foreign_fn
(
it
.hir_id
,
decl
);
}
...
...
src/librustc_metadata/encoder.rs
浏览文件 @
b4748679
...
...
@@ -1677,7 +1677,7 @@ fn encode_info_for_foreign_item(&mut self,
debug!
(
"EncodeContext::encode_info_for_foreign_item({:?})"
,
def_id
);
let
kind
=
match
nitem
.
node
{
let
kind
=
match
nitem
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
_
,
ref
names
,
_
)
=>
{
let
data
=
FnData
{
asyncness
:
hir
::
IsAsync
::
NotAsync
,
...
...
@@ -1703,7 +1703,7 @@ fn encode_info_for_foreign_item(&mut self,
ty
:
Some
(
self
.encode_item_type
(
def_id
)),
inherent_impls
:
Lazy
::
empty
(),
variances
:
match
nitem
.
node
{
variances
:
match
nitem
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
..
)
=>
self
.encode_variances_of
(
def_id
),
_
=>
Lazy
::
empty
(),
},
...
...
src/librustc_passes/ast_validation.rs
浏览文件 @
b4748679
...
...
@@ -682,7 +682,7 @@ fn visit_item(&mut self, item: &'a Item) {
}
fn
visit_foreign_item
(
&
mut
self
,
fi
:
&
'a
ForeignItem
)
{
match
fi
.
node
{
match
fi
.
kind
{
ForeignItemKind
::
Fn
(
ref
decl
,
_
)
=>
{
self
.check_fn_decl
(
decl
);
self
.check_decl_no_pat
(
decl
,
|
span
,
_
|
{
...
...
src/librustc_resolve/build_reduced_graph.rs
浏览文件 @
b4748679
...
...
@@ -813,7 +813,7 @@ fn build_reduced_graph_for_item(&mut self, item: &'b Item) {
/// Constructs the reduced graph for one foreign item.
fn
build_reduced_graph_for_foreign_item
(
&
mut
self
,
item
:
&
ForeignItem
)
{
let
(
res
,
ns
)
=
match
item
.
node
{
let
(
res
,
ns
)
=
match
item
.
kind
{
ForeignItemKind
::
Fn
(
..
)
=>
{
(
Res
::
Def
(
DefKind
::
Fn
,
self
.r.definitions
.local_def_id
(
item
.id
)),
ValueNS
)
}
...
...
@@ -1169,7 +1169,7 @@ fn visit_stmt(&mut self, stmt: &'b ast::Stmt) {
}
fn
visit_foreign_item
(
&
mut
self
,
foreign_item
:
&
'b
ForeignItem
)
{
if
let
ForeignItemKind
::
Macro
(
_
)
=
foreign_item
.
node
{
if
let
ForeignItemKind
::
Macro
(
_
)
=
foreign_item
.
kind
{
self
.visit_invoc
(
foreign_item
.id
);
return
;
}
...
...
src/librustc_resolve/late.rs
浏览文件 @
b4748679
...
...
@@ -406,7 +406,7 @@ fn visit_poly_trait_ref(&mut self,
visit
::
walk_poly_trait_ref
(
self
,
tref
,
m
);
}
fn
visit_foreign_item
(
&
mut
self
,
foreign_item
:
&
'tcx
ForeignItem
)
{
let
generic_params
=
match
foreign_item
.
node
{
let
generic_params
=
match
foreign_item
.
kind
{
ForeignItemKind
::
Fn
(
_
,
ref
generics
)
=>
{
HasGenericParams
(
generics
,
ItemRibKind
)
}
...
...
src/librustc_save_analysis/dump_visitor.rs
浏览文件 @
b4748679
...
...
@@ -1570,7 +1570,7 @@ fn visit_foreign_item(&mut self, item: &'l ast::ForeignItem) {
let
hir_id
=
self
.tcx
.hir
()
.node_to_hir_id
(
item
.id
);
let
access
=
access_from!
(
self
.save_ctxt
,
item
,
hir_id
);
match
item
.
node
{
match
item
.
kind
{
ast
::
ForeignItemKind
::
Fn
(
ref
decl
,
ref
generics
)
=>
{
if
let
Some
(
fn_data
)
=
self
.save_ctxt
.get_extern_item_data
(
item
)
{
down_cast_data!
(
fn_data
,
DefData
,
item
.span
);
...
...
src/librustc_save_analysis/lib.rs
浏览文件 @
b4748679
...
...
@@ -130,7 +130,7 @@ pub fn get_external_crates(&self) -> Vec<ExternalCrateData> {
pub
fn
get_extern_item_data
(
&
self
,
item
:
&
ast
::
ForeignItem
)
->
Option
<
Data
>
{
let
qualname
=
format!
(
"::{}"
,
self
.tcx
.def_path_str
(
self
.tcx
.hir
()
.local_def_id_from_node_id
(
item
.id
)));
match
item
.
node
{
match
item
.
kind
{
ast
::
ForeignItemKind
::
Fn
(
ref
decl
,
ref
generics
)
=>
{
filter!
(
self
.span_utils
,
item
.ident.span
);
...
...
src/librustc_save_analysis/sig.rs
浏览文件 @
b4748679
...
...
@@ -765,7 +765,7 @@ fn make(&self, offset: usize, parent_id: Option<NodeId>, scx: &SaveContext<'_, '
impl
Sig
for
ast
::
ForeignItem
{
fn
make
(
&
self
,
offset
:
usize
,
_
parent_id
:
Option
<
NodeId
>
,
scx
:
&
SaveContext
<
'_
,
'_
>
)
->
Result
{
let
id
=
Some
(
self
.id
);
match
self
.
node
{
match
self
.
kind
{
ast
::
ForeignItemKind
::
Fn
(
ref
decl
,
ref
generics
)
=>
{
let
mut
text
=
String
::
new
();
text
.push_str
(
"fn "
);
...
...
src/librustc_traits/lowering/environment.rs
浏览文件 @
b4748679
...
...
@@ -212,7 +212,7 @@ enum NodeKind {
_
=>
NodeKind
::
Other
,
}
Node
::
ForeignItem
(
item
)
=>
match
item
.
node
{
Node
::
ForeignItem
(
item
)
=>
match
item
.
kind
{
ForeignItemKind
::
Fn
(
..
)
=>
NodeKind
::
Fn
,
_
=>
NodeKind
::
Other
,
}
...
...
src/librustc_typeck/check/intrinsic.rs
浏览文件 @
b4748679
...
...
@@ -24,7 +24,7 @@ fn equate_intrinsic_type<'tcx>(
)
{
let
def_id
=
tcx
.hir
()
.local_def_id
(
it
.hir_id
);
match
it
.
node
{
match
it
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
..
)
=>
{}
_
=>
{
struct_span_err!
(
tcx
.sess
,
it
.span
,
E0622
,
...
...
@@ -37,7 +37,7 @@ fn equate_intrinsic_type<'tcx>(
let
i_n_tps
=
tcx
.generics_of
(
def_id
)
.own_counts
()
.types
;
if
i_n_tps
!=
n_tps
{
let
span
=
match
it
.
node
{
let
span
=
match
it
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
_
,
_
,
ref
generics
)
=>
generics
.span
,
_
=>
bug!
()
};
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
b4748679
...
...
@@ -1588,7 +1588,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
)
.emit
();
}
if
let
hir
::
ForeignItemKind
::
Fn
(
ref
fn_decl
,
_
,
_
)
=
item
.
node
{
if
let
hir
::
ForeignItemKind
::
Fn
(
ref
fn_decl
,
_
,
_
)
=
item
.
kind
{
require_c_abi_if_c_variadic
(
tcx
,
fn_decl
,
m
.abi
,
item
.span
);
}
}
...
...
@@ -4242,7 +4242,7 @@ fn suggest_fn_call(
}
}
Some
(
Node
::
ForeignItem
(
hir
::
ForeignItem
{
node
:
hir
::
ForeignItemKind
::
Fn
(
_
,
idents
,
_
),
kind
:
hir
::
ForeignItemKind
::
Fn
(
_
,
idents
,
_
),
..
}))
|
Some
(
Node
::
TraitItem
(
hir
::
TraitItem
{
...
...
src/librustc_typeck/check/wfcheck.rs
浏览文件 @
b4748679
...
...
@@ -128,7 +128,7 @@ pub fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: DefId) {
check_item_type
(
tcx
,
item
.hir_id
,
ty
.span
,
false
);
}
hir
::
ItemKind
::
ForeignMod
(
ref
module
)
=>
for
it
in
module
.items
.iter
()
{
if
let
hir
::
ForeignItemKind
::
Static
(
ref
ty
,
..
)
=
it
.
node
{
if
let
hir
::
ForeignItemKind
::
Static
(
ref
ty
,
..
)
=
it
.
kind
{
check_item_type
(
tcx
,
it
.hir_id
,
ty
.span
,
true
);
}
},
...
...
src/librustc_typeck/collect.rs
浏览文件 @
b4748679
...
...
@@ -312,7 +312,7 @@ fn type_param_predicates(
}
}
Node
::
ForeignItem
(
item
)
=>
match
item
.
node
{
Node
::
ForeignItem
(
item
)
=>
match
item
.
kind
{
ForeignItemKind
::
Fn
(
_
,
_
,
ref
generics
)
=>
generics
,
_
=>
return
result
,
},
...
...
@@ -415,7 +415,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
tcx
.generics_of
(
def_id
);
tcx
.type_of
(
def_id
);
tcx
.predicates_of
(
def_id
);
if
let
hir
::
ForeignItemKind
::
Fn
(
..
)
=
item
.
node
{
if
let
hir
::
ForeignItemKind
::
Fn
(
..
)
=
item
.
kind
{
tcx
.fn_sig
(
def_id
);
}
}
...
...
@@ -872,7 +872,7 @@ fn has_late_bound_regions<'tcx>(
}
_
=>
None
,
},
Node
::
ForeignItem
(
item
)
=>
match
item
.
node
{
Node
::
ForeignItem
(
item
)
=>
match
item
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
ref
fn_decl
,
_
,
ref
generics
)
=>
{
has_late_bound_regions
(
tcx
,
generics
,
fn_decl
)
}
...
...
@@ -977,7 +977,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
}
}
Node
::
ForeignItem
(
item
)
=>
match
item
.
node
{
Node
::
ForeignItem
(
item
)
=>
match
item
.
kind
{
ForeignItemKind
::
Static
(
..
)
=>
&
no_generics
,
ForeignItemKind
::
Fn
(
_
,
_
,
ref
generics
)
=>
generics
,
ForeignItemKind
::
Type
=>
&
no_generics
,
...
...
@@ -1331,7 +1331,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
}
}
Node
::
ForeignItem
(
foreign_item
)
=>
match
foreign_item
.
node
{
Node
::
ForeignItem
(
foreign_item
)
=>
match
foreign_item
.
kind
{
ForeignItemKind
::
Fn
(
..
)
=>
{
let
substs
=
InternalSubsts
::
identity_for_item
(
tcx
,
def_id
);
tcx
.mk_fn_def
(
def_id
,
substs
)
...
...
@@ -1823,7 +1823,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
},
ForeignItem
(
&
hir
::
ForeignItem
{
node
:
ForeignItemKind
::
Fn
(
ref
fn_decl
,
_
,
_
),
kind
:
ForeignItemKind
::
Fn
(
ref
fn_decl
,
_
,
_
),
..
})
=>
{
let
abi
=
tcx
.hir
()
.get_foreign_abi
(
hir_id
);
...
...
@@ -2133,7 +2133,7 @@ fn extend<I: IntoIterator<Item = (ty::Predicate<'tcx>, Span)>>(&mut self, iter:
}
}
Node
::
ForeignItem
(
item
)
=>
match
item
.
node
{
Node
::
ForeignItem
(
item
)
=>
match
item
.
kind
{
ForeignItemKind
::
Static
(
..
)
=>
NO_GENERICS
,
ForeignItemKind
::
Fn
(
_
,
_
,
ref
generics
)
=>
generics
,
ForeignItemKind
::
Type
=>
NO_GENERICS
,
...
...
@@ -2420,7 +2420,7 @@ fn static_mutability(tcx: TyCtxt<'_>, def_id: DefId) -> Option<hir::Mutability>
kind
:
hir
::
ItemKind
::
Static
(
_
,
mutbl
,
_
),
..
}))
|
Some
(
Node
::
ForeignItem
(
&
hir
::
ForeignItem
{
node
:
hir
::
ForeignItemKind
::
Static
(
_
,
mutbl
),
..
kind
:
hir
::
ForeignItemKind
::
Static
(
_
,
mutbl
),
..
}))
=>
Some
(
mutbl
),
Some
(
_
)
=>
None
,
_
=>
bug!
(
"static_mutability applied to non-local def-id {:?}"
,
def_id
),
...
...
src/librustc_typeck/variance/constraints.rs
浏览文件 @
b4748679
...
...
@@ -94,7 +94,7 @@ fn visit_item(&mut self, item: &hir::Item) {
hir
::
ItemKind
::
ForeignMod
(
ref
foreign_mod
)
=>
{
for
foreign_item
in
&
foreign_mod
.items
{
if
let
hir
::
ForeignItemKind
::
Fn
(
..
)
=
foreign_item
.
node
{
if
let
hir
::
ForeignItemKind
::
Fn
(
..
)
=
foreign_item
.
kind
{
self
.visit_node_helper
(
foreign_item
.hir_id
);
}
}
...
...
src/librustc_typeck/variance/mod.rs
浏览文件 @
b4748679
...
...
@@ -70,7 +70,7 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[ty::Variance] {
_
=>
unsupported
()
},
Node
::
ForeignItem
(
item
)
=>
match
item
.
node
{
Node
::
ForeignItem
(
item
)
=>
match
item
.
kind
{
hir
::
ForeignItemKind
::
Fn
(
..
)
=>
{}
_
=>
unsupported
()
...
...
src/librustc_typeck/variance/terms.rs
浏览文件 @
b4748679
...
...
@@ -157,7 +157,7 @@ fn visit_item(&mut self, item: &hir::Item) {
hir
::
ItemKind
::
ForeignMod
(
ref
foreign_mod
)
=>
{
for
foreign_item
in
&
foreign_mod
.items
{
if
let
hir
::
ForeignItemKind
::
Fn
(
..
)
=
foreign_item
.
node
{
if
let
hir
::
ForeignItemKind
::
Fn
(
..
)
=
foreign_item
.
kind
{
self
.add_inferreds_for_item
(
foreign_item
.hir_id
);
}
}
...
...
src/librustdoc/visit_ast.rs
浏览文件 @
b4748679
...
...
@@ -561,7 +561,7 @@ fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem,
om
.foreigns
.push
(
ForeignItem
{
id
:
item
.hir_id
,
name
:
renamed
.unwrap_or
(
item
.ident
)
.name
,
kind
:
&
item
.
node
,
kind
:
&
item
.
kind
,
vis
:
&
item
.vis
,
attrs
:
&
item
.attrs
,
whence
:
item
.span
...
...
src/libsyntax/ast.rs
浏览文件 @
b4748679
...
...
@@ -2421,7 +2421,7 @@ pub fn descriptive_variant(&self) -> &str {
pub
struct
ForeignItem
{
pub
ident
:
Ident
,
pub
attrs
:
Vec
<
Attribute
>
,
pub
node
:
ForeignItemKind
,
pub
kind
:
ForeignItemKind
,
pub
id
:
NodeId
,
pub
span
:
Span
,
pub
vis
:
Visibility
,
...
...
src/libsyntax/ext/expand.rs
浏览文件 @
b4748679
...
...
@@ -1378,7 +1378,7 @@ fn flat_map_foreign_item(&mut self, mut foreign_item: ast::ForeignItem)
.make_foreign_items
();
}
if
let
ast
::
ForeignItemKind
::
Macro
(
mac
)
=
foreign_item
.
node
{
if
let
ast
::
ForeignItemKind
::
Macro
(
mac
)
=
foreign_item
.
kind
{
self
.check_attributes
(
&
foreign_item
.attrs
);
return
self
.collect_bang
(
mac
,
foreign_item
.span
,
AstFragmentKind
::
ForeignItems
)
.make_foreign_items
();
...
...
src/libsyntax/ext/placeholders.rs
浏览文件 @
b4748679
...
...
@@ -65,7 +65,7 @@ fn mac_placeholder() -> ast::Mac {
AstFragmentKind
::
ForeignItems
=>
AstFragment
::
ForeignItems
(
smallvec!
[
ast
::
ForeignItem
{
id
,
span
,
ident
,
vis
,
attrs
,
node
:
ast
::
ForeignItemKind
::
Macro
(
mac_placeholder
()),
kind
:
ast
::
ForeignItemKind
::
Macro
(
mac_placeholder
()),
}]),
AstFragmentKind
::
Pat
=>
AstFragment
::
Pat
(
P
(
ast
::
Pat
{
id
,
span
,
kind
:
ast
::
PatKind
::
Mac
(
mac_placeholder
()),
...
...
@@ -275,7 +275,7 @@ fn flat_map_generic_param(
}
fn
flat_map_foreign_item
(
&
mut
self
,
item
:
ast
::
ForeignItem
)
->
SmallVec
<
[
ast
::
ForeignItem
;
1
]
>
{
match
item
.
node
{
match
item
.
kind
{
ast
::
ForeignItemKind
::
Macro
(
_
)
=>
self
.remove
(
item
.id
)
.make_foreign_items
(),
_
=>
noop_flat_map_foreign_item
(
item
,
self
),
}
...
...
src/libsyntax/feature_gate/check.rs
浏览文件 @
b4748679
...
...
@@ -408,7 +408,7 @@ fn visit_item(&mut self, i: &'a ast::Item) {
}
fn
visit_foreign_item
(
&
mut
self
,
i
:
&
'a
ast
::
ForeignItem
)
{
match
i
.
node
{
match
i
.
kind
{
ast
::
ForeignItemKind
::
Fn
(
..
)
|
ast
::
ForeignItemKind
::
Static
(
..
)
=>
{
let
link_name
=
attr
::
first_attr_value_str_by_name
(
&
i
.attrs
,
sym
::
link_name
);
...
...
src/libsyntax/mut_visit.rs
浏览文件 @
b4748679
...
...
@@ -1035,10 +1035,10 @@ pub fn noop_flat_map_item<T: MutVisitor>(mut item: P<Item>, visitor: &mut T)
pub
fn
noop_flat_map_foreign_item
<
T
:
MutVisitor
>
(
mut
item
:
ForeignItem
,
visitor
:
&
mut
T
)
->
SmallVec
<
[
ForeignItem
;
1
]
>
{
let
ForeignItem
{
ident
,
attrs
,
node
,
id
,
span
,
vis
}
=
&
mut
item
;
let
ForeignItem
{
ident
,
attrs
,
kind
,
id
,
span
,
vis
}
=
&
mut
item
;
visitor
.visit_ident
(
ident
);
visit_attrs
(
attrs
,
visitor
);
match
node
{
match
kind
{
ForeignItemKind
::
Fn
(
fdec
,
generics
)
=>
{
visitor
.visit_fn_decl
(
fdec
);
visitor
.visit_generics
(
generics
);
...
...
src/libsyntax/parse/parser/item.rs
浏览文件 @
b4748679
...
...
@@ -1383,7 +1383,7 @@ fn parse_item_foreign_mod(
id
:
DUMMY_NODE_ID
,
attrs
,
vis
:
visibility
,
node
:
ForeignItemKind
::
Macro
(
mac
),
kind
:
ForeignItemKind
::
Macro
(
mac
),
}
)
}
...
...
@@ -1415,7 +1415,7 @@ fn parse_item_foreign_fn(
Ok
(
ast
::
ForeignItem
{
ident
,
attrs
,
node
:
ForeignItemKind
::
Fn
(
decl
,
generics
),
kind
:
ForeignItemKind
::
Fn
(
decl
,
generics
),
id
:
DUMMY_NODE_ID
,
span
:
lo
.to
(
hi
),
vis
,
...
...
@@ -1435,7 +1435,7 @@ fn parse_item_foreign_static(&mut self, vis: ast::Visibility, lo: Span, attrs: V
Ok
(
ForeignItem
{
ident
,
attrs
,
node
:
ForeignItemKind
::
Static
(
ty
,
mutbl
),
kind
:
ForeignItemKind
::
Static
(
ty
,
mutbl
),
id
:
DUMMY_NODE_ID
,
span
:
lo
.to
(
hi
),
vis
,
...
...
@@ -1453,7 +1453,7 @@ fn parse_item_foreign_type(&mut self, vis: ast::Visibility, lo: Span, attrs: Vec
Ok
(
ast
::
ForeignItem
{
ident
,
attrs
,
node
:
ForeignItemKind
::
Ty
,
kind
:
ForeignItemKind
::
Ty
,
id
:
DUMMY_NODE_ID
,
span
:
lo
.to
(
hi
),
vis
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
b4748679
...
...
@@ -1060,7 +1060,7 @@ pub fn synth_comment(&mut self, text: String) {
self
.hardbreak_if_not_bol
();
self
.maybe_print_comment
(
item
.span
.lo
());
self
.print_outer_attributes
(
&
item
.attrs
);
match
item
.
node
{
match
item
.
kind
{
ast
::
ForeignItemKind
::
Fn
(
ref
decl
,
ref
generics
)
=>
{
self
.head
(
""
);
self
.print_fn
(
decl
,
ast
::
FnHeader
::
default
(),
...
...
src/libsyntax/visit.rs
浏览文件 @
b4748679
...
...
@@ -486,7 +486,7 @@ pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, foreign_item: &'a
visitor
.visit_vis
(
&
foreign_item
.vis
);
visitor
.visit_ident
(
foreign_item
.ident
);
match
foreign_item
.
node
{
match
foreign_item
.
kind
{
ForeignItemKind
::
Fn
(
ref
function_declaration
,
ref
generics
)
=>
{
walk_fn_decl
(
visitor
,
function_declaration
);
visitor
.visit_generics
(
generics
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录