Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3b5a7276
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
3b5a7276
编写于
6月 05, 2019
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
construct pick-constraints and give them to region inference
上级
d9596692
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
4 deletion
+33
-4
src/librustc_mir/borrow_check/nll/mod.rs
src/librustc_mir/borrow_check/nll/mod.rs
+2
-0
src/librustc_mir/borrow_check/nll/pick_constraints.rs
src/librustc_mir/borrow_check/nll/pick_constraints.rs
+5
-3
src/librustc_mir/borrow_check/nll/region_infer/mod.rs
src/librustc_mir/borrow_check/nll/region_infer/mod.rs
+6
-0
src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs
..._mir/borrow_check/nll/type_check/constraint_conversion.rs
+16
-1
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
+4
-0
未找到文件。
src/librustc_mir/borrow_check/nll/mod.rs
浏览文件 @
3b5a7276
...
...
@@ -130,6 +130,7 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>(
placeholder_index_to_region
:
_
,
mut
liveness_constraints
,
outlives_constraints
,
pick_constraints
,
closure_bounds_mapping
,
type_tests
,
}
=
constraints
;
...
...
@@ -151,6 +152,7 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>(
universal_region_relations
,
body
,
outlives_constraints
,
pick_constraints
,
closure_bounds_mapping
,
type_tests
,
liveness_constraints
,
...
...
src/librustc_mir/borrow_check/nll/pick_constraints.rs
浏览文件 @
3b5a7276
...
...
@@ -55,18 +55,20 @@
}
}
impl
<
'tcx
>
PickConstraintSet
<
'tcx
,
ty
::
RegionVid
>
{
crate
fn
new
()
->
Self
{
impl
Default
for
PickConstraintSet
<
'tcx
,
ty
::
RegionVid
>
{
fn
default
()
->
Self
{
Self
{
first_constraints
:
Default
::
default
(),
constraints
:
Default
::
default
(),
option_regions
:
Default
::
default
(),
}
}
}
impl
<
'tcx
>
PickConstraintSet
<
'tcx
,
ty
::
RegionVid
>
{
crate
fn
push_constraint
(
&
mut
self
,
p_c
:
PickConstraint
<
'tcx
>
,
p_c
:
&
PickConstraint
<
'tcx
>
,
mut
to_region_vid
:
impl
FnMut
(
ty
::
Region
<
'tcx
>
)
->
ty
::
RegionVid
,
)
{
let
pick_region_vid
:
ty
::
RegionVid
=
to_region_vid
(
p_c
.pick_region
);
...
...
src/librustc_mir/borrow_check/nll/region_infer/mod.rs
浏览文件 @
3b5a7276
use
super
::
universal_regions
::
UniversalRegions
;
use
crate
::
borrow_check
::
nll
::
constraints
::
graph
::
NormalConstraintGraph
;
use
crate
::
borrow_check
::
nll
::
constraints
::{
ConstraintSccIndex
,
OutlivesConstraintSet
,
OutlivesConstraint
};
use
crate
::
borrow_check
::
nll
::
pick_constraints
::
PickConstraintSet
;
use
crate
::
borrow_check
::
nll
::
region_infer
::
values
::{
PlaceholderIndices
,
RegionElement
,
ToElementIndex
};
...
...
@@ -187,6 +188,7 @@ pub(crate) fn new(
universal_region_relations
:
Rc
<
UniversalRegionRelations
<
'tcx
>>
,
_
body
:
&
Body
<
'tcx
>
,
outlives_constraints
:
OutlivesConstraintSet
,
pick_constraints
:
PickConstraintSet
<
'tcx
,
RegionVid
>
,
closure_bounds_mapping
:
FxHashMap
<
Location
,
FxHashMap
<
(
RegionVid
,
RegionVid
),
(
ConstraintCategory
,
Span
)
>
,
...
...
@@ -218,6 +220,10 @@ pub(crate) fn new(
let
scc_representatives
=
Self
::
compute_scc_representatives
(
&
constraint_sccs
,
&
definitions
);
let
_
pick_constraints_scc
=
pick_constraints
.into_mapped
(
// TODO
|
r
|
constraint_sccs
.scc
(
r
),
);
let
mut
result
=
Self
{
definitions
,
liveness_constraints
,
...
...
src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs
浏览文件 @
3b5a7276
...
...
@@ -51,7 +51,22 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
}
pub
(
super
)
fn
convert_all
(
&
mut
self
,
query_constraints
:
&
QueryRegionConstraints
<
'tcx
>
)
{
for
query_constraint
in
&
query_constraints
.outlives
{
let
QueryRegionConstraints
{
outlives
,
pick_constraints
}
=
query_constraints
;
// Annoying: to invoke `self.to_region_vid`, we need access to
// `self.constraints`, but we also want to be mutating
// `self.pick_constraints`. For now, just swap out the value
// we want and replace at the end.
let
mut
tmp
=
std
::
mem
::
replace
(
&
mut
self
.constraints.pick_constraints
,
Default
::
default
());
for
pick_constraint
in
pick_constraints
{
tmp
.push_constraint
(
pick_constraint
,
|
r
|
self
.to_region_vid
(
r
),
);
}
self
.constraints.pick_constraints
=
tmp
;
for
query_constraint
in
outlives
{
self
.convert
(
query_constraint
);
}
}
...
...
src/librustc_mir/borrow_check/nll/type_check/mod.rs
浏览文件 @
3b5a7276
...
...
@@ -5,6 +5,7 @@
use
crate
::
borrow_check
::
borrow_set
::
BorrowSet
;
use
crate
::
borrow_check
::
location
::
LocationTable
;
use
crate
::
borrow_check
::
nll
::
constraints
::{
OutlivesConstraintSet
,
OutlivesConstraint
};
use
crate
::
borrow_check
::
nll
::
pick_constraints
::
PickConstraintSet
;
use
crate
::
borrow_check
::
nll
::
facts
::
AllFacts
;
use
crate
::
borrow_check
::
nll
::
region_infer
::
values
::
LivenessValues
;
use
crate
::
borrow_check
::
nll
::
region_infer
::
values
::
PlaceholderIndex
;
...
...
@@ -128,6 +129,7 @@ pub(crate) fn type_check<'tcx>(
placeholder_index_to_region
:
IndexVec
::
default
(),
liveness_constraints
:
LivenessValues
::
new
(
elements
.clone
()),
outlives_constraints
:
OutlivesConstraintSet
::
default
(),
pick_constraints
:
PickConstraintSet
::
default
(),
closure_bounds_mapping
:
Default
::
default
(),
type_tests
:
Vec
::
default
(),
};
...
...
@@ -886,6 +888,8 @@ struct BorrowCheckContext<'a, 'tcx> {
crate
outlives_constraints
:
OutlivesConstraintSet
,
crate
pick_constraints
:
PickConstraintSet
<
'tcx
,
RegionVid
>
,
crate
closure_bounds_mapping
:
FxHashMap
<
Location
,
FxHashMap
<
(
RegionVid
,
RegionVid
),
(
ConstraintCategory
,
Span
)
>>
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录