Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
8147d17d
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,发现更多精彩内容 >>
提交
8147d17d
编写于
6月 06, 2018
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make `normalize` take ownership of the thing to be normalized
上级
214d7650
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
11 deletion
+12
-11
src/librustc_mir/borrow_check/nll/type_check/input_output.rs
src/librustc_mir/borrow_check/nll/type_check/input_output.rs
+2
-2
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
+9
-9
src/librustc_mir/borrow_check/nll/type_check/type_op.rs
src/librustc_mir/borrow_check/nll/type_check/type_op.rs
+1
-0
未找到文件。
src/librustc_mir/borrow_check/nll/type_check/input_output.rs
浏览文件 @
8147d17d
...
...
@@ -51,7 +51,7 @@ pub(super) fn equate_inputs_and_outputs(
// Equate expected input tys with those in the MIR.
let
argument_locals
=
(
1
..
)
.map
(
Local
::
new
);
for
(
&
unnormalized_input_ty
,
local
)
in
unnormalized_input_tys
.iter
()
.zip
(
argument_locals
)
{
let
input_ty
=
self
.normalize
(
&
unnormalized_input_ty
,
Locations
::
All
);
let
input_ty
=
self
.normalize
(
unnormalized_input_ty
,
Locations
::
All
);
let
mir_input_ty
=
mir
.local_decls
[
local
]
.ty
;
self
.equate_normalized_input_or_output
(
input_ty
,
mir_input_ty
);
}
...
...
@@ -71,7 +71,7 @@ pub(super) fn equate_inputs_and_outputs(
"equate_inputs_and_outputs: unnormalized_output_ty={:?}"
,
unnormalized_output_ty
);
let
output_ty
=
self
.normalize
(
&
unnormalized_output_ty
,
Locations
::
All
);
let
output_ty
=
self
.normalize
(
unnormalized_output_ty
,
Locations
::
All
);
debug!
(
"equate_inputs_and_outputs: normalized output_ty={:?}"
,
output_ty
...
...
src/librustc_mir/borrow_check/nll/type_check/mod.rs
浏览文件 @
8147d17d
...
...
@@ -289,7 +289,7 @@ fn sanitize_constant(&mut self, constant: &Constant<'tcx>, location: Location) {
let
instantiated_predicates
=
tcx
.predicates_of
(
def_id
)
.instantiate
(
tcx
,
substs
);
let
predicates
=
type_checker
.normalize
(
&
instantiated_predicates
.predicates
,
location
);
type_checker
.normalize
(
instantiated_predicates
.predicates
,
location
);
type_checker
.prove_predicates
(
predicates
,
location
);
}
...
...
@@ -346,7 +346,7 @@ fn sanitize_place(
Place
::
Static
(
box
Static
{
def_id
,
ty
:
sty
})
=>
{
let
sty
=
self
.sanitize_type
(
place
,
sty
);
let
ty
=
self
.tcx
()
.type_of
(
def_id
);
let
ty
=
self
.cx
.normalize
(
&
ty
,
location
);
let
ty
=
self
.cx
.normalize
(
ty
,
location
);
if
let
Err
(
terr
)
=
self
.cx
.eq_types
(
ty
,
sty
,
location
.at_self
())
{
span_mirbug!
(
self
,
...
...
@@ -1023,7 +1023,7 @@ fn check_terminator(
LateBoundRegionConversionTime
::
FnCall
,
&
sig
,
);
let
sig
=
self
.normalize
(
&
sig
,
term_location
);
let
sig
=
self
.normalize
(
sig
,
term_location
);
self
.check_call_dest
(
mir
,
term
,
&
sig
,
destination
,
term_location
);
self
.prove_predicates
(
...
...
@@ -1311,7 +1311,7 @@ fn aggregate_field_ty(
let
variant
=
&
def
.variants
[
variant_index
];
let
adj_field_index
=
active_field_index
.unwrap_or
(
field_index
);
if
let
Some
(
field
)
=
variant
.fields
.get
(
adj_field_index
)
{
Ok
(
self
.normalize
(
&
field
.ty
(
tcx
,
substs
),
location
))
Ok
(
self
.normalize
(
field
.ty
(
tcx
,
substs
),
location
))
}
else
{
Err
(
FieldAccessError
::
OutOfRange
{
field_count
:
variant
.fields
.len
(),
...
...
@@ -1385,7 +1385,7 @@ fn check_rvalue(&mut self, mir: &Mir<'tcx>, rvalue: &Rvalue<'tcx>, location: Loc
// function definition. When we extract the
// signature, it comes from the `fn_sig` query,
// and hence may contain unnormalized results.
let
fn_sig
=
self
.normalize
(
&
fn_sig
,
location
);
let
fn_sig
=
self
.normalize
(
fn_sig
,
location
);
let
ty_fn_ptr_from
=
tcx
.mk_fn_ptr
(
fn_sig
);
...
...
@@ -1430,7 +1430,7 @@ fn check_rvalue(&mut self, mir: &Mir<'tcx>, rvalue: &Rvalue<'tcx>, location: Loc
// function definition. When we extract the
// signature, it comes from the `fn_sig` query,
// and hence may contain unnormalized results.
let
fn_sig
=
self
.normalize
(
&
fn_sig
,
location
);
let
fn_sig
=
self
.normalize
(
fn_sig
,
location
);
let
ty_fn_ptr_from
=
tcx
.safe_to_unsafe_fn_ty
(
fn_sig
);
...
...
@@ -1576,7 +1576,7 @@ fn prove_aggregate_predicates(
AggregateKind
::
Array
(
_
)
|
AggregateKind
::
Tuple
=>
ty
::
InstantiatedPredicates
::
empty
(),
};
let
predicates
=
self
.normalize
(
&
instantiated_predicates
.predicates
,
location
);
let
predicates
=
self
.normalize
(
instantiated_predicates
.predicates
,
location
);
debug!
(
"prove_aggregate_predicates: predicates={:?}"
,
predicates
);
self
.prove_predicates
(
predicates
,
location
);
}
...
...
@@ -1644,7 +1644,7 @@ fn typeck_mir(&mut self, mir: &Mir<'tcx>) {
}
}
fn
normalize
<
T
>
(
&
mut
self
,
value
:
&
T
,
location
:
impl
ToLocations
)
->
T
fn
normalize
<
T
>
(
&
mut
self
,
value
:
T
,
location
:
impl
ToLocations
)
->
T
where
T
:
fmt
::
Debug
+
TypeFoldable
<
'tcx
>
,
{
...
...
@@ -1661,7 +1661,7 @@ fn normalize<T>(&mut self, value: &T, location: impl ToLocations) -> T
let
Normalized
{
value
,
obligations
}
=
this
.infcx
.at
(
&
ObligationCause
::
dummy
(),
this
.param_env
)
.normalize
(
value
)
.normalize
(
&
value
)
.unwrap_or_else
(|
NoSolution
|
{
span_bug!
(
this
.last_span
,
...
...
src/librustc_mir/borrow_check/nll/type_check/type_op.rs
浏览文件 @
8147d17d
...
...
@@ -19,6 +19,7 @@ pub(super) trait TypeOp<'gcx, 'tcx> {
/// Micro-optimization point: true if this is trivially true.
fn
trivial_noop
(
&
self
)
->
Option
<
Self
::
Output
>
;
/// Produce a description of the operation for the debug logs.
fn
perform
(
self
,
type_checker
:
&
mut
TypeChecker
<
'_
,
'gcx
,
'tcx
>
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录