Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ae45f170
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,发现更多精彩内容 >>
提交
ae45f170
编写于
2月 27, 2019
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hir: remove NodeId from StructField
上级
7e277d96
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
26 addition
and
25 deletion
+26
-25
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+1
-2
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/dead.rs
src/librustc/middle/dead.rs
+1
-1
src/librustc/middle/stability.rs
src/librustc/middle/stability.rs
+1
-2
src/librustc_codegen_ssa/back/symbol_export.rs
src/librustc_codegen_ssa/back/symbol_export.rs
+6
-6
src/librustc_lint/builtin.rs
src/librustc_lint/builtin.rs
+7
-4
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/check/wfcheck.rs
+1
-1
src/librustc_typeck/collect.rs
src/librustc_typeck/collect.rs
+4
-4
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+5
-3
未找到文件。
src/librustc/hir/lowering.rs
浏览文件 @
ae45f170
...
...
@@ -2743,11 +2743,10 @@ fn lower_poly_trait_ref(
}
fn
lower_struct_field
(
&
mut
self
,
(
index
,
f
):
(
usize
,
&
StructField
))
->
hir
::
StructField
{
let
LoweredNodeId
{
node_id
,
hir_id
}
=
self
.lower_node_id
(
f
.id
);
let
LoweredNodeId
{
node_id
:
_
,
hir_id
}
=
self
.lower_node_id
(
f
.id
);
hir
::
StructField
{
span
:
f
.span
,
id
:
node_id
,
hir_id
,
ident
:
match
f
.ident
{
Some
(
ident
)
=>
ident
,
...
...
src/librustc/hir/mod.rs
浏览文件 @
ae45f170
...
...
@@ -2132,7 +2132,6 @@ pub struct StructField {
pub
span
:
Span
,
pub
ident
:
Ident
,
pub
vis
:
Visibility
,
pub
id
:
NodeId
,
pub
hir_id
:
HirId
,
pub
ty
:
P
<
Ty
>
,
pub
attrs
:
HirVec
<
Attribute
>
,
...
...
src/librustc/ich/impls_hir.rs
浏览文件 @
ae45f170
...
...
@@ -838,7 +838,6 @@ fn hash_stable<W: StableHasherResult>(&self,
span
,
ident
->
(
ident
.name
),
vis
,
id
,
hir_id
,
ty
,
attrs
...
...
src/librustc/middle/dead.rs
浏览文件 @
ae45f170
...
...
@@ -465,7 +465,7 @@ fn should_warn_about_item(&mut self, item: &hir::Item) -> bool {
}
fn
should_warn_about_field
(
&
mut
self
,
field
:
&
hir
::
StructField
)
->
bool
{
let
field_type
=
self
.tcx
.type_of
(
self
.tcx
.hir
()
.local_def_id
(
field
.
id
));
let
field_type
=
self
.tcx
.type_of
(
self
.tcx
.hir
()
.local_def_id
_from_hir_id
(
field
.hir_
id
));
!
field
.is_positional
()
&&
!
self
.symbol_is_live
(
field
.hir_id
)
&&
!
field_type
.is_phantom_data
()
...
...
src/librustc/middle/stability.rs
浏览文件 @
ae45f170
...
...
@@ -317,10 +317,9 @@ struct MissingStabilityAnnotations<'a, 'tcx: 'a> {
impl
<
'a
,
'tcx
:
'a
>
MissingStabilityAnnotations
<
'a
,
'tcx
>
{
fn
check_missing_stability
(
&
self
,
hir_id
:
HirId
,
span
:
Span
,
name
:
&
str
)
{
let
stab
=
self
.tcx
.stability
()
.local_stability
(
hir_id
);
let
node_id
=
self
.tcx
.hir
()
.hir_to_node_id
(
hir_id
);
let
is_error
=
!
self
.tcx.sess.opts.test
&&
stab
.is_none
()
&&
self
.access_levels
.is_reachable
(
node_id
);
self
.access_levels
.is_reachable
(
self
.tcx
.hir
()
.hir_to_node_id
(
hir_id
)
);
if
is_error
{
self
.tcx.sess
.span_err
(
span
,
...
...
src/librustc_codegen_ssa/back/symbol_export.rs
浏览文件 @
ae45f170
...
...
@@ -69,7 +69,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let
mut
reachable_non_generics
:
DefIdMap
<
_
>
=
tcx
.reachable_set
(
LOCAL_CRATE
)
.0
.iter
()
.filter_map
(|
&
node
_id
|
{
.filter_map
(|
&
hir
_id
|
{
// We want to ignore some FFI functions that are not exposed from
// this crate. Reachable FFI functions can be lumped into two
// categories:
...
...
@@ -83,9 +83,9 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
//
// As a result, if this id is an FFI item (foreign item) then we only
// let it through if it's included statically.
match
tcx
.hir
()
.get
(
node
_id
)
{
match
tcx
.hir
()
.get
_by_hir_id
(
hir
_id
)
{
Node
::
ForeignItem
(
..
)
=>
{
let
def_id
=
tcx
.hir
()
.local_def_id
(
node
_id
);
let
def_id
=
tcx
.hir
()
.local_def_id
_from_hir_id
(
hir
_id
);
if
tcx
.is_statically_included_foreign_item
(
def_id
)
{
Some
(
def_id
)
}
else
{
...
...
@@ -105,7 +105,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
node
:
hir
::
ImplItemKind
::
Method
(
..
),
..
})
=>
{
let
def_id
=
tcx
.hir
()
.local_def_id
(
node
_id
);
let
def_id
=
tcx
.hir
()
.local_def_id
_from_hir_id
(
hir
_id
);
let
generics
=
tcx
.generics_of
(
def_id
);
if
!
generics
.requires_monomorphization
(
tcx
)
&&
// Functions marked with #[inline] are only ever codegened
...
...
@@ -343,8 +343,8 @@ fn upstream_monomorphizations_for_provider<'a, 'tcx>(
}
fn
is_unreachable_local_definition_provider
(
tcx
:
TyCtxt
<
'_
,
'_
,
'_
>
,
def_id
:
DefId
)
->
bool
{
if
let
Some
(
node_id
)
=
tcx
.hir
()
.as_local_node
_id
(
def_id
)
{
!
tcx
.reachable_set
(
LOCAL_CRATE
)
.0
.contains
(
&
node
_id
)
if
let
Some
(
hir_id
)
=
tcx
.hir
()
.as_local_hir
_id
(
def_id
)
{
!
tcx
.reachable_set
(
LOCAL_CRATE
)
.0
.contains
(
&
hir
_id
)
}
else
{
bug!
(
"is_unreachable_local_definition called with non-local DefId: {:?}"
,
def_id
)
...
...
src/librustc_lint/builtin.rs
浏览文件 @
ae45f170
...
...
@@ -148,7 +148,7 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
hir
::
ItemKind
::
Struct
(
ref
struct_def
,
_
)
|
hir
::
ItemKind
::
Union
(
ref
struct_def
,
_
)
=>
{
for
struct_field
in
struct_def
.fields
()
{
let
def_id
=
cx
.tcx
.hir
()
.local_def_id
(
struct_field
.
id
);
let
def_id
=
cx
.tcx
.hir
()
.local_def_id
_from_hir_id
(
struct_field
.hir_
id
);
self
.check_heap_type
(
cx
,
struct_field
.span
,
cx
.tcx
.type_of
(
def_id
));
}
...
...
@@ -560,7 +560,8 @@ fn get_lints(&self) -> LintArray {
impl
<
'a
,
'tcx
>
LateLintPass
<
'a
,
'tcx
>
for
MissingCopyImplementations
{
fn
check_item
(
&
mut
self
,
cx
:
&
LateContext
<
'_
,
'_
>
,
item
:
&
hir
::
Item
)
{
if
!
cx
.access_levels
.is_reachable
(
item
.id
)
{
let
node_id
=
cx
.tcx
.hir
()
.hir_to_node_id
(
item
.hir_id
);
if
!
cx
.access_levels
.is_reachable
(
node_id
)
{
return
;
}
let
(
def
,
ty
)
=
match
item
.node
{
...
...
@@ -631,7 +632,8 @@ fn get_lints(&self) -> LintArray {
impl
<
'a
,
'tcx
>
LateLintPass
<
'a
,
'tcx
>
for
MissingDebugImplementations
{
fn
check_item
(
&
mut
self
,
cx
:
&
LateContext
<
'_
,
'_
>
,
item
:
&
hir
::
Item
)
{
if
!
cx
.access_levels
.is_reachable
(
item
.id
)
{
let
node_id
=
cx
.tcx
.hir
()
.hir_to_node_id
(
item
.hir_id
);
if
!
cx
.access_levels
.is_reachable
(
node_id
)
{
return
;
}
...
...
@@ -1078,7 +1080,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnionsWithDropFields {
fn
check_item
(
&
mut
self
,
ctx
:
&
LateContext
<
'_
,
'_
>
,
item
:
&
hir
::
Item
)
{
if
let
hir
::
ItemKind
::
Union
(
ref
vdata
,
_
)
=
item
.node
{
for
field
in
vdata
.fields
()
{
let
field_ty
=
ctx
.tcx
.type_of
(
ctx
.tcx
.hir
()
.local_def_id
(
field
.id
));
let
field_ty
=
ctx
.tcx
.type_of
(
ctx
.tcx
.hir
()
.local_def_id_from_hir_id
(
field
.hir_id
));
if
field_ty
.needs_drop
(
ctx
.tcx
,
ctx
.param_env
)
{
ctx
.span_lint
(
UNIONS_WITH_DROP_FIELDS
,
field
.span
,
...
...
src/librustc_typeck/check/wfcheck.rs
浏览文件 @
ae45f170
...
...
@@ -1050,7 +1050,7 @@ struct AdtField<'tcx> {
impl
<
'a
,
'gcx
,
'tcx
>
FnCtxt
<
'a
,
'gcx
,
'tcx
>
{
fn
non_enum_variant
(
&
self
,
struct_def
:
&
hir
::
VariantData
)
->
AdtVariant
<
'tcx
>
{
let
fields
=
struct_def
.fields
()
.iter
()
.map
(|
field
|
{
let
field_ty
=
self
.tcx
.type_of
(
self
.tcx
.hir
()
.local_def_id
(
field
.
id
));
let
field_ty
=
self
.tcx
.type_of
(
self
.tcx
.hir
()
.local_def_id
_from_hir_id
(
field
.hir_
id
));
let
field_ty
=
self
.normalize_associated_types_in
(
field
.span
,
&
field_ty
);
AdtField
{
ty
:
field_ty
,
span
:
field
.span
}
...
...
src/librustc_typeck/collect.rs
浏览文件 @
ae45f170
...
...
@@ -447,7 +447,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) {
tcx
.predicates_of
(
def_id
);
for
f
in
struct_def
.fields
()
{
let
def_id
=
tcx
.hir
()
.local_def_id
(
f
.
id
);
let
def_id
=
tcx
.hir
()
.local_def_id
_from_hir_id
(
f
.hir_
id
);
tcx
.generics_of
(
def_id
);
tcx
.type_of
(
def_id
);
tcx
.predicates_of
(
def_id
);
...
...
@@ -555,7 +555,7 @@ fn convert_enum_variant_types<'a, 'tcx>(
);
for
f
in
variant
.node.data
.fields
()
{
let
def_id
=
tcx
.hir
()
.local_def_id
(
f
.
id
);
let
def_id
=
tcx
.hir
()
.local_def_id
_from_hir_id
(
f
.hir_
id
);
tcx
.generics_of
(
def_id
);
tcx
.type_of
(
def_id
);
tcx
.predicates_of
(
def_id
);
...
...
@@ -582,7 +582,7 @@ fn convert_variant<'a, 'tcx>(
.fields
()
.iter
()
.map
(|
f
|
{
let
fid
=
tcx
.hir
()
.local_def_id
(
f
.
id
);
let
fid
=
tcx
.hir
()
.local_def_id
_from_hir_id
(
f
.hir_
id
);
let
dup_span
=
seen_fields
.get
(
&
f
.ident
.modern
())
.cloned
();
if
let
Some
(
prev_span
)
=
dup_span
{
struct_span_err!
(
...
...
@@ -1577,7 +1577,7 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig
let
ty
=
tcx
.type_of
(
tcx
.hir
()
.get_parent_did
(
node_id
));
let
inputs
=
fields
.iter
()
.map
(|
f
|
tcx
.type_of
(
tcx
.hir
()
.local_def_id
(
f
.
id
)));
.map
(|
f
|
tcx
.type_of
(
tcx
.hir
()
.local_def_id
_from_hir_id
(
f
.hir_
id
)));
ty
::
Binder
::
bind
(
tcx
.mk_fn_sig
(
inputs
,
ty
,
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
ae45f170
...
...
@@ -2913,14 +2913,16 @@ fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type {
impl
Clean
<
Item
>
for
hir
::
StructField
{
fn
clean
(
&
self
,
cx
:
&
DocContext
<
'_
,
'_
,
'_
>
)
->
Item
{
let
local_did
=
cx
.tcx
.hir
()
.local_def_id_from_hir_id
(
self
.hir_id
);
Item
{
name
:
Some
(
self
.ident.name
)
.clean
(
cx
),
attrs
:
self
.attrs
.clean
(
cx
),
source
:
self
.span
.clean
(
cx
),
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
)
),
def_id
:
cx
.tcx
.hir
()
.local_def_id
(
self
.id
)
,
stability
:
get_stability
(
cx
,
local_did
),
deprecation
:
get_deprecation
(
cx
,
local_did
),
def_id
:
local_did
,
inner
:
StructFieldItem
(
self
.ty
.clean
(
cx
)),
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录