Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f5bba2c6
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,发现更多精彩内容 >>
提交
f5bba2c6
编写于
2月 15, 2019
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
HirIdification: change some NodeId to HirId calls
上级
36fffa81
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
22 addition
and
23 deletion
+22
-23
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
+1
-2
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/borrowck/mod.rs
+13
-13
src/librustc_privacy/lib.rs
src/librustc_privacy/lib.rs
+2
-2
src/librustdoc/clean/inline.rs
src/librustdoc/clean/inline.rs
+4
-4
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+2
-2
未找到文件。
src/librustc_borrowck/borrowck/gather_loans/move_error.rs
浏览文件 @
f5bba2c6
...
...
@@ -88,8 +88,7 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &[MoveErr
}
}
if
let
NoteClosureEnv
(
upvar_id
)
=
error
.move_from.note
{
let
var_node_id
=
bccx
.tcx
.hir
()
.hir_to_node_id
(
upvar_id
.var_path.hir_id
);
err
.span_label
(
bccx
.tcx
.hir
()
.span
(
var_node_id
),
err
.span_label
(
bccx
.tcx
.hir
()
.span_by_hir_id
(
upvar_id
.var_path.hir_id
),
"captured outer variable"
);
}
err
.emit
();
...
...
src/librustc_borrowck/borrowck/mod.rs
浏览文件 @
f5bba2c6
...
...
@@ -703,20 +703,20 @@ pub fn report_use_of_moved_value(&self,
// Get type of value and span where it was previously
// moved.
let
node_id
=
self
.tcx
.hir
()
.hir_to_node_id
(
hir
::
HirId
{
let
hir_id
=
hir
::
HirId
{
owner
:
self
.body.value.hir_id.owner
,
local_id
:
the_move
.id
}
)
;
};
let
(
move_span
,
move_note
)
=
match
the_move
.kind
{
move_data
::
Declared
=>
{
unreachable!
();
}
move_data
::
MoveExpr
|
move_data
::
MovePat
=>
(
self
.tcx
.hir
()
.span
(
node
_id
),
""
),
move_data
::
MovePat
=>
(
self
.tcx
.hir
()
.span
_by_hir_id
(
hir
_id
),
""
),
move_data
::
Captured
=>
(
match
self
.tcx
.hir
()
.expect_expr
(
node
_id
)
.node
{
(
match
self
.tcx
.hir
()
.expect_expr
_by_hir_id
(
hir
_id
)
.node
{
hir
::
ExprKind
::
Closure
(
..
,
fn_decl_span
,
_
)
=>
fn_decl_span
,
ref
r
=>
bug!
(
"Captured({:?}) maps to non-closure: {:?}"
,
the_move
.id
,
r
),
...
...
@@ -828,8 +828,8 @@ fn report_bckerr(&self, err: &BckError<'a, 'tcx>) {
MutabilityViolation
=>
{
let
mut
db
=
self
.cannot_assign
(
error_span
,
&
descr
,
Origin
::
Ast
);
if
let
mc
::
NoteClosureEnv
(
upvar_id
)
=
err
.cmt.note
{
let
node_id
=
self
.tcx
.hir
()
.hir_to_node_id
(
upvar_id
.var_path.hir_id
)
;
let
sp
=
self
.tcx
.hir
()
.span
(
node
_id
);
let
hir_id
=
upvar_id
.var_path.hir_id
;
let
sp
=
self
.tcx
.hir
()
.span
_by_hir_id
(
hir
_id
);
let
fn_closure_msg
=
"`Fn` closures cannot capture their enclosing
\
environment for modifications"
;
match
(
self
.tcx.sess
.source_map
()
.span_to_snippet
(
sp
),
&
err
.cmt.cat
)
{
...
...
@@ -1120,8 +1120,8 @@ pub fn report_aliasability_violation(&self,
}
else
{
"consider changing this closure to take self by mutable reference"
};
let
node_id
=
self
.tcx
.hir
()
.local_def_id_to_node
_id
(
id
);
let
help_span
=
self
.tcx
.hir
()
.span
(
node
_id
);
let
hir_id
=
self
.tcx
.hir
()
.local_def_id_to_hir
_id
(
id
);
let
help_span
=
self
.tcx
.hir
()
.span
_by_hir_id
(
hir
_id
);
self
.cannot_act_on_capture_in_sharable_fn
(
span
,
prefix
,
(
help_span
,
help_msg
),
...
...
@@ -1362,9 +1362,9 @@ fn note_and_explain_mutbl_error(&self, db: &mut DiagnosticBuilder<'_>, err: &Bck
_
=>
bug!
()
};
if
*
kind
==
ty
::
ClosureKind
::
Fn
{
let
closure_
node
_id
=
self
.tcx
.hir
()
.local_def_id_to_
node
_id
(
upvar_id
.closure_expr_id
);
db
.span_help
(
self
.tcx
.hir
()
.span
(
closure_node
_id
),
let
closure_
hir
_id
=
self
.tcx
.hir
()
.local_def_id_to_
hir
_id
(
upvar_id
.closure_expr_id
);
db
.span_help
(
self
.tcx
.hir
()
.span
_by_hir_id
(
closure_hir
_id
),
"consider changing this closure to take
\
self by mutable reference"
);
}
...
...
@@ -1397,8 +1397,8 @@ pub fn append_loan_path_to_string(&self,
loan_path
:
&
LoanPath
<
'tcx
>
,
out
:
&
mut
String
)
{
match
loan_path
.kind
{
LpUpvar
(
ty
::
UpvarId
{
var_path
:
ty
::
UpvarPath
{
hir_id
:
id
},
closure_expr_id
:
_
})
=>
{
out
.push_str
(
&
self
.tcx
.hir
()
.name
(
self
.tcx
.hir
()
.hir_to_node_id
(
id
)
)
.as_str
());
LpUpvar
(
ty
::
UpvarId
{
var_path
:
ty
::
UpvarPath
{
hir_id
:
id
},
closure_expr_id
:
_
})
=>
{
out
.push_str
(
&
self
.tcx
.hir
()
.name
_by_hir_id
(
id
)
.as_str
());
}
LpVar
(
id
)
=>
{
out
.push_str
(
&
self
.tcx
.hir
()
.name
(
id
)
.as_str
());
...
...
src/librustc_privacy/lib.rs
浏览文件 @
f5bba2c6
...
...
@@ -454,8 +454,8 @@ fn update_visibility_of_intermediate_use_statements(&mut self, segments: &[hir::
if
let
Some
([
module
,
segment
])
=
segments
.rchunks_exact
(
2
)
.next
()
{
if
let
Some
(
item
)
=
module
.def
.and_then
(|
def
|
def
.mod_def_id
())
.and_then
(|
def_id
|
self
.tcx
.hir
()
.as_local_
node
_id
(
def_id
))
.map
(|
module_
node_id
|
self
.tcx
.hir
()
.expect_item
(
module_node
_id
))
.and_then
(|
def_id
|
self
.tcx
.hir
()
.as_local_
hir
_id
(
def_id
))
.map
(|
module_
hir_id
|
self
.tcx
.hir
()
.expect_item_by_hir_id
(
module_hir
_id
))
{
if
let
hir
::
ItemKind
::
Mod
(
m
)
=
&
item
.node
{
for
item_id
in
m
.item_ids
.as_ref
()
{
...
...
src/librustdoc/clean/inline.rs
浏览文件 @
f5bba2c6
...
...
@@ -296,8 +296,8 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
}
}
let
for_
=
if
let
Some
(
nodeid
)
=
tcx
.hir
()
.as_local_node
_id
(
did
)
{
match
tcx
.hir
()
.expect_item
(
node
id
)
.node
{
let
for_
=
if
let
Some
(
hir_id
)
=
tcx
.hir
()
.as_local_hir
_id
(
did
)
{
match
tcx
.hir
()
.expect_item
_by_hir_id
(
hir_
id
)
.node
{
hir
::
ItemKind
::
Impl
(
..
,
ref
t
,
_
)
=>
{
t
.clean
(
cx
)
}
...
...
@@ -318,8 +318,8 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec<clean::Item>) {
}
let
predicates
=
tcx
.predicates_of
(
did
);
let
(
trait_items
,
generics
)
=
if
let
Some
(
nodeid
)
=
tcx
.hir
()
.as_local_node
_id
(
did
)
{
match
tcx
.hir
()
.expect_item
(
node
id
)
.node
{
let
(
trait_items
,
generics
)
=
if
let
Some
(
hir_id
)
=
tcx
.hir
()
.as_local_hir
_id
(
did
)
{
match
tcx
.hir
()
.expect_item
_by_hir_id
(
hir_
id
)
.node
{
hir
::
ItemKind
::
Impl
(
..
,
ref
gen
,
_
,
_
,
ref
item_ids
)
=>
{
(
item_ids
.iter
()
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
f5bba2c6
...
...
@@ -2562,9 +2562,9 @@ fn clean(&self, cx: &DocContext) -> Type {
let
mut
alias
=
None
;
if
let
Def
::
TyAlias
(
def_id
)
=
path
.def
{
// Substitute private type aliases
if
let
Some
(
node_id
)
=
cx
.tcx
.hir
()
.as_local_node
_id
(
def_id
)
{
if
let
Some
(
hir_id
)
=
cx
.tcx
.hir
()
.as_local_hir
_id
(
def_id
)
{
if
!
cx
.renderinfo
.borrow
()
.access_levels
.is_exported
(
def_id
)
{
alias
=
Some
(
&
cx
.tcx
.hir
()
.expect_item
(
node
_id
)
.node
);
alias
=
Some
(
&
cx
.tcx
.hir
()
.expect_item
_by_hir_id
(
hir
_id
)
.node
);
}
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录