Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1767d971
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,发现更多精彩内容 >>
提交
1767d971
编写于
1月 27, 2017
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
差异文件
Rollup merge of #39351 - nikomatsakis:incr-comp-skip-typeck-1, r=eddyb
move `cast_kinds` into `TypeckTables` where it belongs r?
@EddyB
上级
9eb00687
f4010d7e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
11 deletion
+21
-11
src/librustc/ty/context.rs
src/librustc/ty/context.rs
+7
-7
src/librustc_mir/hair/cx/expr.rs
src/librustc_mir/hair/cx/expr.rs
+1
-1
src/librustc_passes/consts.rs
src/librustc_passes/consts.rs
+1
-1
src/librustc_typeck/check/cast.rs
src/librustc_typeck/check/cast.rs
+2
-2
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/check/writeback.rs
+10
-0
未找到文件。
src/librustc/ty/context.rs
浏览文件 @
1767d971
...
...
@@ -231,7 +231,11 @@ pub struct TypeckTables<'tcx> {
/// of the struct - this is needed because it is non-trivial to
/// normalize while preserving regions. This table is used only in
/// MIR construction and hence is not serialized to metadata.
pub
fru_field_types
:
NodeMap
<
Vec
<
Ty
<
'tcx
>>>
pub
fru_field_types
:
NodeMap
<
Vec
<
Ty
<
'tcx
>>>
,
/// Maps a cast expression to its kind. This is keyed on the
/// *from* expression of the cast, not the cast itself.
pub
cast_kinds
:
NodeMap
<
ty
::
cast
::
CastKind
>
,
}
impl
<
'tcx
>
TypeckTables
<
'tcx
>
{
...
...
@@ -246,7 +250,8 @@ pub fn empty() -> TypeckTables<'tcx> {
closure_tys
:
NodeMap
(),
closure_kinds
:
NodeMap
(),
liberated_fn_sigs
:
NodeMap
(),
fru_field_types
:
NodeMap
()
fru_field_types
:
NodeMap
(),
cast_kinds
:
NodeMap
(),
}
}
...
...
@@ -533,10 +538,6 @@ pub struct GlobalCtxt<'tcx> {
/// expression defining the closure.
pub
closure_kinds
:
RefCell
<
DepTrackingMap
<
maps
::
ClosureKinds
<
'tcx
>>>
,
/// Maps a cast expression to its kind. This is keyed on the
/// *from* expression of the cast, not the cast itself.
pub
cast_kinds
:
RefCell
<
NodeMap
<
ty
::
cast
::
CastKind
>>
,
/// Maps Fn items to a collection of fragment infos.
///
/// The main goal is to identify data (each of which may be moved
...
...
@@ -792,7 +793,6 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
custom_coerce_unsized_kinds
:
RefCell
::
new
(
DefIdMap
()),
closure_tys
:
RefCell
::
new
(
DepTrackingMap
::
new
(
dep_graph
.clone
())),
closure_kinds
:
RefCell
::
new
(
DepTrackingMap
::
new
(
dep_graph
.clone
())),
cast_kinds
:
RefCell
::
new
(
NodeMap
()),
fragment_infos
:
RefCell
::
new
(
DefIdMap
()),
crate_name
:
Symbol
::
intern
(
crate_name
),
data_layout
:
data_layout
,
...
...
src/librustc_mir/hair/cx/expr.rs
浏览文件 @
1767d971
...
...
@@ -663,7 +663,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
hir
::
ExprCast
(
ref
source
,
_
)
=>
{
// Check to see if this cast is a "coercion cast", where the cast is actually done
// using a coercion (or is a no-op).
if
let
Some
(
&
TyCastKind
::
CoercionCast
)
=
cx
.t
cx.cast_kinds
.borrow
()
.get
(
&
source
.id
)
{
if
let
Some
(
&
TyCastKind
::
CoercionCast
)
=
cx
.t
ables
()
.cast_kinds
.get
(
&
source
.id
)
{
// Convert the lexpr to a vexpr.
ExprKind
::
Use
{
source
:
source
.to_ref
()
}
}
else
{
...
...
src/librustc_passes/consts.rs
浏览文件 @
1767d971
...
...
@@ -314,7 +314,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node
}
hir
::
ExprCast
(
ref
from
,
_
)
=>
{
debug!
(
"Checking const cast(id={})"
,
from
.id
);
match
v
.t
cx.cast_kinds
.borrow
()
.get
(
&
from
.id
)
{
match
v
.t
ables.cast_kinds
.get
(
&
from
.id
)
{
None
=>
span_bug!
(
e
.span
,
"no kind for cast"
),
Some
(
&
CastKind
::
PtrAddrCast
)
|
Some
(
&
CastKind
::
FnPtrAddrCast
)
=>
{
v
.promotable
=
false
;
...
...
src/librustc_typeck/check/cast.rs
浏览文件 @
1767d971
...
...
@@ -348,12 +348,12 @@ pub fn check(mut self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) {
}
else
if
self
.try_coercion_cast
(
fcx
)
{
self
.trivial_cast_lint
(
fcx
);
debug!
(
" -> CoercionCast"
);
fcx
.t
cx.cast_kinds
.borrow_mut
()
.insert
(
self
.expr.id
,
CastKind
::
CoercionCast
);
fcx
.t
ables
.borrow_mut
()
.cast_kinds
.insert
(
self
.expr.id
,
CastKind
::
CoercionCast
);
}
else
{
match
self
.do_check
(
fcx
)
{
Ok
(
k
)
=>
{
debug!
(
" -> {:?}"
,
k
);
fcx
.t
cx.cast_kinds
.borrow_mut
()
.insert
(
self
.expr.id
,
k
);
fcx
.t
ables
.borrow_mut
()
.cast_kinds
.insert
(
self
.expr.id
,
k
);
}
Err
(
e
)
=>
self
.report_cast_error
(
fcx
,
e
),
};
...
...
src/librustc_typeck/check/writeback.rs
浏览文件 @
1767d971
...
...
@@ -51,6 +51,7 @@ pub fn resolve_type_vars_in_body(&self, body: &'gcx hir::Body) {
wbcx
.visit_anon_types
();
wbcx
.visit_deferred_obligations
(
item_id
);
wbcx
.visit_type_nodes
();
wbcx
.visit_cast_types
();
let
tables
=
self
.tcx
.alloc_tables
(
wbcx
.tables
);
self
.tcx.tables
.borrow_mut
()
.insert
(
item_def_id
,
tables
);
...
...
@@ -291,6 +292,15 @@ fn visit_closures(&self) {
}
}
fn
visit_cast_types
(
&
mut
self
)
{
if
self
.fcx.writeback_errors
.get
()
{
return
}
self
.tables.cast_kinds
.extend
(
self
.fcx.tables
.borrow
()
.cast_kinds
.iter
()
.map
(|(
&
key
,
&
value
)|
(
key
,
value
)));
}
fn
visit_anon_types
(
&
self
)
{
if
self
.fcx.writeback_errors
.get
()
{
return
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录