Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a29ceb9f
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,发现更多精彩内容 >>
提交
a29ceb9f
编写于
2月 26, 2019
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hir: remove NodeId from ImplItem
上级
c2e517e0
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
30 addition
and
27 deletion
+30
-27
src/librustc/hir/intravisit.rs
src/librustc/hir/intravisit.rs
+0
-1
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+0
-1
src/librustc/hir/map/collector.rs
src/librustc/hir/map/collector.rs
+1
-1
src/librustc/hir/map/mod.rs
src/librustc/hir/map/mod.rs
+1
-1
src/librustc/hir/mod.rs
src/librustc/hir/mod.rs
+0
-1
src/librustc/ich/impls_hir.rs
src/librustc/ich/impls_hir.rs
+0
-1
src/librustc/middle/reachable.rs
src/librustc/middle/reachable.rs
+1
-1
src/librustc/middle/stability.rs
src/librustc/middle/stability.rs
+2
-1
src/librustc_lint/builtin.rs
src/librustc_lint/builtin.rs
+7
-6
src/librustc_mir/monomorphize/collector.rs
src/librustc_mir/monomorphize/collector.rs
+1
-1
src/librustc_privacy/lib.rs
src/librustc_privacy/lib.rs
+5
-2
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+2
-1
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/check/wfcheck.rs
+1
-1
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+5
-5
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+4
-3
未找到文件。
src/librustc/hir/intravisit.rs
浏览文件 @
a29ceb9f
...
...
@@ -878,7 +878,6 @@ pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref:
pub
fn
walk_impl_item
<
'v
,
V
:
Visitor
<
'v
>>
(
visitor
:
&
mut
V
,
impl_item
:
&
'v
ImplItem
)
{
// N.B., deliberately force a compilation error if/when new fields are added.
let
ImplItem
{
id
:
_
,
hir_id
:
_
,
ident
,
ref
vis
,
...
...
src/librustc/hir/lowering.rs
浏览文件 @
a29ceb9f
...
...
@@ -3426,7 +3426,6 @@ fn lower_impl_item(&mut self, i: &ImplItem) -> hir::ImplItem {
};
hir
::
ImplItem
{
id
:
node_id
,
hir_id
,
ident
:
i
.ident
,
attrs
:
self
.lower_attrs
(
&
i
.attrs
),
...
...
src/librustc/hir/map/collector.rs
浏览文件 @
a29ceb9f
...
...
@@ -398,7 +398,7 @@ fn visit_trait_item(&mut self, ti: &'hir TraitItem) {
fn
visit_impl_item
(
&
mut
self
,
ii
:
&
'hir
ImplItem
)
{
debug_assert_eq!
(
ii
.hir_id.owner
,
self
.definitions
.opt_def_index
(
ii
.id
)
.unwrap
());
self
.definitions
.opt_def_index
(
self
.hir_to_node_id
[
&
ii
.hir_id
]
)
.unwrap
());
self
.with_dep_node_owner
(
ii
.hir_id.owner
,
ii
,
|
this
|
{
this
.insert
(
ii
.span
,
ii
.hir_id
,
Node
::
ImplItem
(
ii
));
...
...
src/librustc/hir/map/mod.rs
浏览文件 @
a29ceb9f
...
...
@@ -357,7 +357,7 @@ pub fn describe_def(&self, node_id: NodeId) -> Option<Def> {
}
}
Node
::
ImplItem
(
item
)
=>
{
let
def_id
=
self
.local_def_id
(
item
.
id
);
let
def_id
=
self
.local_def_id
_from_hir_id
(
item
.hir_
id
);
match
item
.node
{
ImplItemKind
::
Const
(
..
)
=>
Some
(
Def
::
AssociatedConst
(
def_id
)),
ImplItemKind
::
Method
(
..
)
=>
Some
(
Def
::
Method
(
def_id
)),
...
...
src/librustc/hir/mod.rs
浏览文件 @
a29ceb9f
...
...
@@ -1710,7 +1710,6 @@ pub struct ImplItemId {
/// Represents anything within an `impl` block
#[derive(Clone,
RustcEncodable,
RustcDecodable,
Debug)]
pub
struct
ImplItem
{
pub
id
:
NodeId
,
pub
ident
:
Ident
,
pub
hir_id
:
HirId
,
pub
vis
:
Visibility
,
...
...
src/librustc/ich/impls_hir.rs
浏览文件 @
a29ceb9f
...
...
@@ -703,7 +703,6 @@ fn hash_stable<W: StableHasherResult>(&self,
hcx
:
&
mut
StableHashingContext
<
'a
>
,
hasher
:
&
mut
StableHasher
<
W
>
)
{
let
hir
::
ImplItem
{
id
:
_
,
hir_id
:
_
,
ident
,
ref
vis
,
...
...
src/librustc/middle/reachable.rs
浏览文件 @
a29ceb9f
...
...
@@ -48,7 +48,7 @@ fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
impl_item
:
&
hir
::
ImplItem
,
impl_src
:
DefId
)
->
bool
{
let
codegen_fn_attrs
=
tcx
.codegen_fn_attrs
(
impl_item
.hir_id
.owner_def_id
());
let
generics
=
tcx
.generics_of
(
tcx
.hir
()
.local_def_id
(
impl_item
.
id
));
let
generics
=
tcx
.generics_of
(
tcx
.hir
()
.local_def_id
_from_hir_id
(
impl_item
.hir_
id
));
if
codegen_fn_attrs
.requests_inline
()
||
generics
.requires_monomorphization
(
tcx
)
{
return
true
}
...
...
src/librustc/middle/stability.rs
浏览文件 @
a29ceb9f
...
...
@@ -355,7 +355,8 @@ fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) {
}
fn
visit_impl_item
(
&
mut
self
,
ii
:
&
'tcx
hir
::
ImplItem
)
{
let
impl_def_id
=
self
.tcx
.hir
()
.local_def_id
(
self
.tcx
.hir
()
.get_parent
(
ii
.id
));
let
impl_def_id
=
self
.tcx
.hir
()
.local_def_id_from_hir_id
(
self
.tcx
.hir
()
.get_parent_item
(
ii
.hir_id
));
if
self
.tcx
.impl_trait_ref
(
impl_def_id
)
.is_none
()
{
self
.check_missing_stability
(
ii
.hir_id
,
ii
.span
,
"item"
);
}
...
...
src/librustc_lint/builtin.rs
浏览文件 @
a29ceb9f
...
...
@@ -1112,11 +1112,12 @@ fn get_lints(&self) -> LintArray {
}
impl
UnreachablePub
{
fn
perform_lint
(
&
self
,
cx
:
&
LateContext
<
'_
,
'_
>
,
what
:
&
str
,
id
:
ast
::
Node
Id
,
fn
perform_lint
(
&
self
,
cx
:
&
LateContext
<
'_
,
'_
>
,
what
:
&
str
,
id
:
hir
::
Hir
Id
,
vis
:
&
hir
::
Visibility
,
span
:
Span
,
exportable
:
bool
)
{
let
mut
applicability
=
Applicability
::
MachineApplicable
;
let
node_id
=
cx
.tcx
.hir
()
.hir_to_node_id
(
id
);
match
vis
.node
{
hir
::
VisibilityKind
::
Public
if
!
cx
.access_levels
.is_reachable
(
id
)
=>
{
hir
::
VisibilityKind
::
Public
if
!
cx
.access_levels
.is_reachable
(
node_
id
)
=>
{
if
span
.ctxt
()
.outer
()
.expn_info
()
.is_some
()
{
applicability
=
Applicability
::
MaybeIncorrect
;
}
...
...
@@ -1148,20 +1149,20 @@ fn perform_lint(&self, cx: &LateContext<'_, '_>, what: &str, id: ast::NodeId,
impl
<
'a
,
'tcx
>
LateLintPass
<
'a
,
'tcx
>
for
UnreachablePub
{
fn
check_item
(
&
mut
self
,
cx
:
&
LateContext
<
'_
,
'_
>
,
item
:
&
hir
::
Item
)
{
self
.perform_lint
(
cx
,
"item"
,
item
.id
,
&
item
.vis
,
item
.span
,
true
);
self
.perform_lint
(
cx
,
"item"
,
item
.
hir_
id
,
&
item
.vis
,
item
.span
,
true
);
}
fn
check_foreign_item
(
&
mut
self
,
cx
:
&
LateContext
<
'_
,
'_
>
,
foreign_item
:
&
hir
::
ForeignItem
)
{
self
.perform_lint
(
cx
,
"item"
,
foreign_item
.id
,
&
foreign_item
.vis
,
self
.perform_lint
(
cx
,
"item"
,
foreign_item
.
hir_
id
,
&
foreign_item
.vis
,
foreign_item
.span
,
true
);
}
fn
check_struct_field
(
&
mut
self
,
cx
:
&
LateContext
<
'_
,
'_
>
,
field
:
&
hir
::
StructField
)
{
self
.perform_lint
(
cx
,
"field"
,
field
.id
,
&
field
.vis
,
field
.span
,
false
);
self
.perform_lint
(
cx
,
"field"
,
field
.
hir_
id
,
&
field
.vis
,
field
.span
,
false
);
}
fn
check_impl_item
(
&
mut
self
,
cx
:
&
LateContext
<
'_
,
'_
>
,
impl_item
:
&
hir
::
ImplItem
)
{
self
.perform_lint
(
cx
,
"item"
,
impl_item
.id
,
&
impl_item
.vis
,
impl_item
.span
,
false
);
self
.perform_lint
(
cx
,
"item"
,
impl_item
.
hir_
id
,
&
impl_item
.vis
,
impl_item
.span
,
false
);
}
}
...
...
src/librustc_mir/monomorphize/collector.rs
浏览文件 @
a29ceb9f
...
...
@@ -1006,7 +1006,7 @@ fn visit_trait_item(&mut self, _: &'v hir::TraitItem) {
fn
visit_impl_item
(
&
mut
self
,
ii
:
&
'v
hir
::
ImplItem
)
{
match
ii
.node
{
hir
::
ImplItemKind
::
Method
(
hir
::
MethodSig
{
..
},
_
)
=>
{
let
def_id
=
self
.tcx
.hir
()
.local_def_id
(
ii
.
id
);
let
def_id
=
self
.tcx
.hir
()
.local_def_id
_from_hir_id
(
ii
.hir_
id
);
self
.push_if_root
(
def_id
);
}
_
=>
{
/* Nothing to do here */
}
...
...
src/librustc_privacy/lib.rs
浏览文件 @
a29ceb9f
...
...
@@ -1318,7 +1318,9 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
match
impl_item
.node
{
hir
::
ImplItemKind
::
Const
(
..
)
|
hir
::
ImplItemKind
::
Method
(
..
)
=>
{
self
.access_levels
.is_reachable
(
impl_item
.id
)
let
node_id
=
self
.tcx
.hir
()
.hir_to_node_id
(
impl_item
.hir_id
);
self
.access_levels
.is_reachable
(
node_id
)
}
hir
::
ImplItemKind
::
Existential
(
..
)
|
hir
::
ImplItemKind
::
Type
(
_
)
=>
false
,
...
...
@@ -1340,10 +1342,11 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
// don't erroneously report errors for private
// types in private items.
let
impl_item
=
self
.tcx
.hir
()
.impl_item
(
impl_item_ref
.id
);
let
node_id
=
self
.tcx
.hir
()
.hir_to_node_id
(
impl_item
.hir_id
);
match
impl_item
.node
{
hir
::
ImplItemKind
::
Const
(
..
)
|
hir
::
ImplItemKind
::
Method
(
..
)
if
self
.item_is_public
(
&
impl_item
.
id
,
&
impl_item
.vis
)
=>
if
self
.item_is_public
(
&
node_
id
,
&
impl_item
.vis
)
=>
{
intravisit
::
walk_impl_item
(
self
,
impl_item
)
}
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
a29ceb9f
...
...
@@ -1554,7 +1554,8 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// Check existing impl methods to see if they are both present in trait
// and compatible with trait signature
for
impl_item
in
impl_items
()
{
let
ty_impl_item
=
tcx
.associated_item
(
tcx
.hir
()
.local_def_id
(
impl_item
.id
));
let
ty_impl_item
=
tcx
.associated_item
(
tcx
.hir
()
.local_def_id_from_hir_id
(
impl_item
.hir_id
));
let
ty_trait_item
=
tcx
.associated_items
(
impl_trait_ref
.def_id
)
.find
(|
ac
|
Namespace
::
from
(
&
impl_item
.node
)
==
Namespace
::
from
(
ac
.kind
)
&&
tcx
.hygienic_eq
(
ty_impl_item
.ident
,
ac
.ident
,
impl_trait_ref
.def_id
))
...
...
src/librustc_typeck/check/wfcheck.rs
浏览文件 @
a29ceb9f
...
...
@@ -1030,7 +1030,7 @@ fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
fn
visit_impl_item
(
&
mut
self
,
impl_item
:
&
'tcx
hir
::
ImplItem
)
{
debug!
(
"visit_impl_item: {:?}"
,
impl_item
);
let
def_id
=
self
.tcx
.hir
()
.local_def_id
(
impl_item
.
id
);
let
def_id
=
self
.tcx
.hir
()
.local_def_id
_from_hir_id
(
impl_item
.hir_
id
);
self
.tcx
.ensure
()
.check_impl_item_well_formed
(
def_id
);
}
}
...
...
src/librustc_typeck/collect.rs
浏览文件 @
a29ceb9f
...
...
@@ -157,7 +157,7 @@ fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
}
fn
visit_impl_item
(
&
mut
self
,
impl_item
:
&
'tcx
hir
::
ImplItem
)
{
convert_impl_item
(
self
.tcx
,
impl_item
.id
);
convert_impl_item
(
self
.tcx
,
impl_item
.
hir_
id
);
intravisit
::
walk_impl_item
(
self
,
impl_item
);
}
}
...
...
@@ -500,12 +500,12 @@ fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: hir:
tcx
.predicates_of
(
def_id
);
}
fn
convert_impl_item
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
impl_item_id
:
ast
::
Node
Id
)
{
let
def_id
=
tcx
.hir
()
.local_def_id
(
impl_item_id
);
fn
convert_impl_item
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
impl_item_id
:
hir
::
Hir
Id
)
{
let
def_id
=
tcx
.hir
()
.local_def_id
_from_hir_id
(
impl_item_id
);
tcx
.generics_of
(
def_id
);
tcx
.type_of
(
def_id
);
tcx
.predicates_of
(
def_id
);
if
let
hir
::
ImplItemKind
::
Method
(
..
)
=
tcx
.hir
()
.expect_impl_item
(
impl_item_id
)
.node
{
if
let
hir
::
ImplItemKind
::
Method
(
..
)
=
tcx
.hir
()
.expect_impl_item
_by_hir_id
(
impl_item_id
)
.node
{
tcx
.fn_sig
(
def_id
);
}
}
...
...
@@ -1485,7 +1485,7 @@ fn visit_item(&mut self, it: &'tcx Item) {
}
}
fn
visit_impl_item
(
&
mut
self
,
it
:
&
'tcx
ImplItem
)
{
let
def_id
=
self
.tcx
.hir
()
.local_def_id
(
it
.
id
);
let
def_id
=
self
.tcx
.hir
()
.local_def_id
_from_hir_id
(
it
.hir_
id
);
// the existential type itself or its children are not within its reveal scope
if
def_id
!=
self
.def_id
{
self
.check
(
def_id
);
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
a29ceb9f
...
...
@@ -2055,14 +2055,15 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item {
generics
:
Generics
::
default
(),
},
true
),
};
let
local_did
=
cx
.tcx
.hir
()
.local_def_id_from_hir_id
(
self
.hir_id
);
Item
{
name
:
Some
(
self
.ident.name
.clean
(
cx
)),
source
:
self
.span
.clean
(
cx
),
attrs
:
self
.attrs
.clean
(
cx
),
def_id
:
cx
.tcx
.hir
()
.local_def_id
(
self
.id
)
,
def_id
:
local_did
,
visibility
:
self
.vis
.clean
(
cx
),
stability
:
get_stability
(
cx
,
cx
.tcx
.hir
()
.local_def_id
(
self
.id
)
),
deprecation
:
get_deprecation
(
cx
,
cx
.tcx
.hir
()
.local_def_id
(
self
.id
)
),
stability
:
get_stability
(
cx
,
local_did
),
deprecation
:
get_deprecation
(
cx
,
local_did
),
inner
,
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录