Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5474f170
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,发现更多精彩内容 >>
提交
5474f170
编写于
11月 27, 2020
作者:
C
Camille GILLOT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove hir::ImplItem::attrs.
上级
c49359ad
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
23 addition
and
36 deletion
+23
-36
compiler/rustc_ast_lowering/src/item.rs
compiler/rustc_ast_lowering/src/item.rs
+1
-1
compiler/rustc_hir/src/hir.rs
compiler/rustc_hir/src/hir.rs
+1
-2
compiler/rustc_hir/src/intravisit.rs
compiler/rustc_hir/src/intravisit.rs
+2
-10
compiler/rustc_hir/src/stable_hash_impls.rs
compiler/rustc_hir/src/stable_hash_impls.rs
+2
-11
compiler/rustc_hir_pretty/src/lib.rs
compiler/rustc_hir_pretty/src/lib.rs
+1
-1
compiler/rustc_save_analysis/src/dump_visitor.rs
compiler/rustc_save_analysis/src/dump_visitor.rs
+2
-1
compiler/rustc_save_analysis/src/lib.rs
compiler/rustc_save_analysis/src/lib.rs
+3
-3
src/tools/clippy/clippy_lints/src/attrs.rs
src/tools/clippy/clippy_lints/src/attrs.rs
+1
-1
src/tools/clippy/clippy_lints/src/doc.rs
src/tools/clippy/clippy_lints/src/doc.rs
+2
-1
src/tools/clippy/clippy_lints/src/functions.rs
src/tools/clippy/clippy_lints/src/functions.rs
+3
-2
src/tools/clippy/clippy_lints/src/missing_doc.rs
src/tools/clippy/clippy_lints/src/missing_doc.rs
+2
-1
src/tools/clippy/clippy_lints/src/missing_inline.rs
src/tools/clippy/clippy_lints/src/missing_inline.rs
+2
-1
src/tools/clippy/clippy_lints/src/utils/inspector.rs
src/tools/clippy/clippy_lints/src/utils/inspector.rs
+1
-1
未找到文件。
compiler/rustc_ast_lowering/src/item.rs
浏览文件 @
5474f170
...
...
@@ -931,10 +931,10 @@ fn lower_impl_item(&mut self, i: &AssocItem) -> hir::ImplItem<'hir> {
let
has_value
=
true
;
let
(
defaultness
,
_
)
=
self
.lower_defaultness
(
i
.kind
.defaultness
(),
has_value
);
let
hir_id
=
self
.lower_node_id
(
i
.id
);
self
.lower_attrs
(
hir_id
,
&
i
.attrs
);
hir
::
ImplItem
{
def_id
:
hir_id
.expect_owner
(),
ident
:
i
.ident
,
attrs
:
self
.lower_attrs
(
hir_id
,
&
i
.attrs
),
generics
,
vis
:
self
.lower_visibility
(
&
i
.vis
,
None
),
defaultness
,
...
...
compiler/rustc_hir/src/hir.rs
浏览文件 @
5474f170
...
...
@@ -2090,7 +2090,6 @@ pub struct ImplItem<'hir> {
pub
def_id
:
LocalDefId
,
pub
vis
:
Visibility
<
'hir
>
,
pub
defaultness
:
Defaultness
,
pub
attrs
:
&
'hir
[
Attribute
],
pub
generics
:
Generics
<
'hir
>
,
pub
kind
:
ImplItemKind
<
'hir
>
,
pub
span
:
Span
,
...
...
@@ -3080,6 +3079,6 @@ mod size_asserts {
rustc_data_structures
::
static_assert_size!
(
super
::
Item
<
'static
>
,
200
);
rustc_data_structures
::
static_assert_size!
(
super
::
TraitItem
<
'static
>
,
128
);
rustc_data_structures
::
static_assert_size!
(
super
::
ImplItem
<
'static
>
,
1
68
);
rustc_data_structures
::
static_assert_size!
(
super
::
ImplItem
<
'static
>
,
1
52
);
rustc_data_structures
::
static_assert_size!
(
super
::
ForeignItem
<
'static
>
,
136
);
}
compiler/rustc_hir/src/intravisit.rs
浏览文件 @
5474f170
...
...
@@ -988,16 +988,8 @@ 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
<
'v
>
)
{
// N.B., deliberately force a compilation error if/when new fields are added.
let
ImplItem
{
def_id
:
_
,
ident
,
ref
vis
,
ref
defaultness
,
attrs
:
_
,
ref
generics
,
ref
kind
,
span
:
_
,
}
=
*
impl_item
;
let
ImplItem
{
def_id
:
_
,
ident
,
ref
vis
,
ref
defaultness
,
ref
generics
,
ref
kind
,
span
:
_
}
=
*
impl_item
;
visitor
.visit_ident
(
ident
);
visitor
.visit_vis
(
vis
);
...
...
compiler/rustc_hir/src/stable_hash_impls.rs
浏览文件 @
5474f170
...
...
@@ -152,22 +152,13 @@ fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
impl
<
HirCtx
:
crate
::
HashStableContext
>
HashStable
<
HirCtx
>
for
ImplItem
<
'_
>
{
fn
hash_stable
(
&
self
,
hcx
:
&
mut
HirCtx
,
hasher
:
&
mut
StableHasher
)
{
let
ImplItem
{
def_id
:
_
,
ident
,
ref
vis
,
defaultness
,
ref
attrs
,
ref
generics
,
ref
kind
,
span
,
}
=
*
self
;
let
ImplItem
{
def_id
:
_
,
ident
,
ref
vis
,
defaultness
,
ref
generics
,
ref
kind
,
span
}
=
*
self
;
hcx
.hash_hir_item_like
(|
hcx
|
{
ident
.name
.hash_stable
(
hcx
,
hasher
);
vis
.hash_stable
(
hcx
,
hasher
);
defaultness
.hash_stable
(
hcx
,
hasher
);
attrs
.hash_stable
(
hcx
,
hasher
);
generics
.hash_stable
(
hcx
,
hasher
);
kind
.hash_stable
(
hcx
,
hasher
);
span
.hash_stable
(
hcx
,
hasher
);
...
...
compiler/rustc_hir_pretty/src/lib.rs
浏览文件 @
5474f170
...
...
@@ -988,7 +988,7 @@ pub fn print_impl_item(&mut self, ii: &hir::ImplItem<'_>) {
self
.ann
.pre
(
self
,
AnnNode
::
SubItem
(
ii
.hir_id
()));
self
.hardbreak_if_not_bol
();
self
.maybe_print_comment
(
ii
.span
.lo
());
self
.print_outer_attributes
(
&
ii
.attrs
);
self
.print_outer_attributes
(
self
.attrs
(
ii
.hir_id
())
);
self
.print_defaultness
(
ii
.defaultness
);
match
ii
.kind
{
...
...
compiler/rustc_save_analysis/src/dump_visitor.rs
浏览文件 @
5474f170
...
...
@@ -1067,6 +1067,7 @@ fn process_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>, impl_id: D
match
impl_item
.kind
{
hir
::
ImplItemKind
::
Const
(
ref
ty
,
body
)
=>
{
let
body
=
self
.tcx
.hir
()
.body
(
body
);
let
attrs
=
self
.tcx
.hir
()
.attrs
(
impl_item
.hir_id
());
self
.process_assoc_const
(
impl_item
.hir_id
(),
impl_item
.ident
,
...
...
@@ -1074,7 +1075,7 @@ fn process_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>, impl_id: D
Some
(
&
body
.value
),
impl_id
,
&
impl_item
.vis
,
&
impl_item
.
attrs
,
attrs
,
);
}
hir
::
ImplItemKind
::
Fn
(
ref
sig
,
body
)
=>
{
...
...
compiler/rustc_save_analysis/src/lib.rs
浏览文件 @
5474f170
...
...
@@ -426,9 +426,9 @@ pub fn get_method_data(&self, hir_id: hir::HirId, ident: Ident, span: Span) -> O
let
trait_id
=
self
.tcx
.trait_id_of_impl
(
impl_id
);
let
mut
docs
=
String
::
new
();
let
mut
attrs
=
vec!
[];
if
let
Some
(
Node
::
ImplItem
(
item
))
=
hir
.find
(
hir_id
)
{
docs
=
self
.docs_for_attrs
(
&
item
.attrs
);
attrs
=
item
.attrs
.to_vec
(
);
if
let
Some
(
Node
::
ImplItem
(
_
))
=
hir
.find
(
hir_id
)
{
attrs
=
self
.tcx
.hir
()
.attrs
(
hir_id
)
.to_vec
(
);
docs
=
self
.docs_for_attrs
(
&
attrs
);
}
let
mut
decl_id
=
None
;
...
...
src/tools/clippy/clippy_lints/src/attrs.rs
浏览文件 @
5474f170
...
...
@@ -353,7 +353,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
fn
check_impl_item
(
&
mut
self
,
cx
:
&
LateContext
<
'tcx
>
,
item
:
&
'tcx
ImplItem
<
'_
>
)
{
if
is_relevant_impl
(
cx
,
item
)
{
check_attrs
(
cx
,
item
.span
,
item
.ident.name
,
&
item
.attrs
)
check_attrs
(
cx
,
item
.span
,
item
.ident.name
,
cx
.tcx
.hir
()
.attrs
(
item
.hir_id
())
)
}
}
...
...
src/tools/clippy/clippy_lints/src/doc.rs
浏览文件 @
5474f170
...
...
@@ -260,7 +260,8 @@ fn check_trait_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::TraitIte
}
fn
check_impl_item
(
&
mut
self
,
cx
:
&
LateContext
<
'tcx
>
,
item
:
&
'tcx
hir
::
ImplItem
<
'_
>
)
{
let
headers
=
check_attrs
(
cx
,
&
self
.valid_idents
,
&
item
.attrs
);
let
attrs
=
cx
.tcx
.hir
()
.attrs
(
item
.hir_id
());
let
headers
=
check_attrs
(
cx
,
&
self
.valid_idents
,
attrs
);
if
self
.in_trait_impl
||
in_external_macro
(
cx
.tcx.sess
,
item
.span
)
{
return
;
}
...
...
src/tools/clippy/clippy_lints/src/functions.rs
浏览文件 @
5474f170
...
...
@@ -312,11 +312,12 @@ fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<
if
is_public
&&
trait_ref_of_method
(
cx
,
item
.hir_id
())
.is_none
()
{
check_result_unit_err
(
cx
,
&
sig
.decl
,
item
.span
,
fn_header_span
);
}
let
attr
=
must_use_attr
(
&
item
.attrs
);
let
attrs
=
cx
.tcx
.hir
()
.attrs
(
item
.hir_id
());
let
attr
=
must_use_attr
(
attrs
);
if
let
Some
(
attr
)
=
attr
{
check_needless_must_use
(
cx
,
&
sig
.decl
,
item
.hir_id
(),
item
.span
,
fn_header_span
,
attr
);
}
else
if
is_public
&&
!
is_proc_macro
(
cx
.sess
(),
&
item
.
attrs
)
&&
!
is_proc_macro
(
cx
.sess
(),
attrs
)
&&
trait_ref_of_method
(
cx
,
item
.hir_id
())
.is_none
()
{
check_must_use_candidate
(
...
...
src/tools/clippy/clippy_lints/src/missing_doc.rs
浏览文件 @
5474f170
...
...
@@ -183,7 +183,8 @@ fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::Impl
}
let
(
article
,
desc
)
=
cx
.tcx
.article_and_description
(
impl_item
.def_id
.to_def_id
());
self
.check_missing_docs_attrs
(
cx
,
&
impl_item
.attrs
,
impl_item
.span
,
article
,
desc
);
let
attrs
=
cx
.tcx
.hir
()
.attrs
(
impl_item
.hir_id
());
self
.check_missing_docs_attrs
(
cx
,
attrs
,
impl_item
.span
,
article
,
desc
);
}
fn
check_struct_field
(
&
mut
self
,
cx
:
&
LateContext
<
'tcx
>
,
sf
:
&
'tcx
hir
::
StructField
<
'_
>
)
{
...
...
src/tools/clippy/clippy_lints/src/missing_inline.rs
浏览文件 @
5474f170
...
...
@@ -161,6 +161,7 @@ fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::Impl
}
}
check_missing_inline_attrs
(
cx
,
&
impl_item
.attrs
,
impl_item
.span
,
desc
);
let
attrs
=
cx
.tcx
.hir
()
.attrs
(
impl_item
.hir_id
());
check_missing_inline_attrs
(
cx
,
attrs
,
impl_item
.span
,
desc
);
}
}
src/tools/clippy/clippy_lints/src/utils/inspector.rs
浏览文件 @
5474f170
...
...
@@ -40,7 +40,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>) {
}
fn
check_impl_item
(
&
mut
self
,
cx
:
&
LateContext
<
'tcx
>
,
item
:
&
'tcx
hir
::
ImplItem
<
'_
>
)
{
if
!
has_attr
(
cx
.sess
(),
&
item
.attrs
)
{
if
!
has_attr
(
cx
.sess
(),
cx
.tcx
.hir
()
.attrs
(
item
.hir_id
())
)
{
return
;
}
println!
(
"impl item `{}`"
,
item
.ident.name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录