Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ec48b4eb
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,发现更多精彩内容 >>
提交
ec48b4eb
编写于
6月 07, 2019
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
preliminary integration of "pick constraints" into nll solver
上级
3b5a7276
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
231 addition
and
127 deletion
+231
-127
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/error_reporting/mod.rs
+2
-2
src/librustc/infer/opaque_types/mod.rs
src/librustc/infer/opaque_types/mod.rs
+6
-5
src/librustc_mir/borrow_check/nll/pick_constraints.rs
src/librustc_mir/borrow_check/nll/pick_constraints.rs
+8
-0
src/librustc_mir/borrow_check/nll/region_infer/mod.rs
src/librustc_mir/borrow_check/nll/region_infer/mod.rs
+213
-120
src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs
..._mir/borrow_check/nll/type_check/constraint_conversion.rs
+2
-0
未找到文件。
src/librustc/infer/error_reporting/mod.rs
浏览文件 @
ec48b4eb
...
...
@@ -385,13 +385,13 @@ pub fn report_region_errors(
option_regions
:
_
,
}
=>
{
let
hidden_ty
=
self
.resolve_vars_if_possible
(
&
hidden_ty
);
opaque_types
::
report_unexpected_hidden_region
(
opaque_types
::
unexpected_hidden_region_diagnostic
(
self
.tcx
,
Some
(
region_scope_tree
),
opaque_type_def_id
,
hidden_ty
,
pick_region
,
);
)
.emit
()
;
}
}
}
...
...
src/librustc/infer/opaque_types/mod.rs
浏览文件 @
ec48b4eb
...
...
@@ -9,6 +9,7 @@
use
crate
::
ty
::
subst
::{
InternalSubsts
,
Kind
,
SubstsRef
,
UnpackedKind
};
use
crate
::
ty
::{
self
,
GenericParamDefKind
,
Ty
,
TyCtxt
};
use
crate
::
util
::
nodemap
::
DefIdMap
;
use
errors
::
DiagnosticBuilder
;
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
std
::
rc
::
Rc
;
...
...
@@ -499,13 +500,13 @@ pub fn infer_opaque_definition_from_instantiation(
}
}
pub
fn
report_unexpected_hidden_region
(
pub
fn
unexpected_hidden_region_diagnostic
(
tcx
:
TyCtxt
<
'tcx
>
,
region_scope_tree
:
Option
<&
region
::
ScopeTree
>
,
opaque_type_def_id
:
DefId
,
hidden_ty
:
Ty
<
'tcx
>
,
hidden_region
:
ty
::
Region
<
'tcx
>
,
)
{
)
->
DiagnosticBuilder
<
'tcx
>
{
let
span
=
tcx
.def_span
(
opaque_type_def_id
);
let
mut
err
=
struct_span_err!
(
tcx
.sess
,
...
...
@@ -573,7 +574,7 @@ pub fn report_unexpected_hidden_region(
}
}
err
.emit
();
err
}
// Visitor that requires that (almost) all regions in the type visited outlive
...
...
@@ -724,13 +725,13 @@ fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
None
=>
{
if
!
self
.map_missing_regions_to_empty
&&
!
self
.tainted_by_errors
{
if
let
Some
(
hidden_ty
)
=
self
.hidden_ty
.take
()
{
report_unexpected_hidden_region
(
unexpected_hidden_region_diagnostic
(
self
.tcx
,
None
,
self
.opaque_type_def_id
,
hidden_ty
,
r
,
);
)
.emit
()
;
}
}
self
.tcx.lifetimes.re_empty
...
...
src/librustc_mir/borrow_check/nll/pick_constraints.rs
浏览文件 @
ec48b4eb
...
...
@@ -71,10 +71,12 @@ impl<'tcx> PickConstraintSet<'tcx, ty::RegionVid> {
p_c
:
&
PickConstraint
<
'tcx
>
,
mut
to_region_vid
:
impl
FnMut
(
ty
::
Region
<
'tcx
>
)
->
ty
::
RegionVid
,
)
{
debug!
(
"push_constraint(p_c={:?})"
,
p_c
);
let
pick_region_vid
:
ty
::
RegionVid
=
to_region_vid
(
p_c
.pick_region
);
let
next_constraint
=
self
.first_constraints
.get
(
&
pick_region_vid
)
.cloned
();
let
start_index
=
self
.option_regions
.len
();
let
end_index
=
start_index
+
p_c
.option_regions
.len
();
debug!
(
"push_constraint: pick_region_vid={:?}"
,
pick_region_vid
);
let
constraint_index
=
self
.constraints
.push
(
NllPickConstraint
{
next_constraint
,
pick_region_vid
,
...
...
@@ -136,6 +138,12 @@ impl<'tcx, R> PickConstraintSet<'tcx, R>
where
R
:
Copy
+
Hash
+
Eq
,
{
crate
fn
all_indices
(
&
self
,
)
->
impl
Iterator
<
Item
=
NllPickConstraintIndex
>
{
self
.constraints
.indices
()
}
/// Iterate down the constraint indices associated with a given
/// peek-region. You can then use `option_regions` and other
/// methods to access data.
...
...
src/librustc_mir/borrow_check/nll/region_infer/mod.rs
浏览文件 @
ec48b4eb
此差异已折叠。
点击以展开。
src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs
浏览文件 @
ec48b4eb
...
...
@@ -51,6 +51,8 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
}
pub
(
super
)
fn
convert_all
(
&
mut
self
,
query_constraints
:
&
QueryRegionConstraints
<
'tcx
>
)
{
debug!
(
"convert_all(query_constraints={:#?})"
,
query_constraints
);
let
QueryRegionConstraints
{
outlives
,
pick_constraints
}
=
query_constraints
;
// Annoying: to invoke `self.to_region_vid`, we need access to
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录