Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f8e0e78d
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,发现更多精彩内容 >>
提交
f8e0e78d
编写于
1月 28, 2021
作者:
H
Hirochika Matsumoto
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename NLL* to Nll* accordingly to C-CASE
上级
e32f372c
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
71 addition
and
71 deletion
+71
-71
compiler/rustc_infer/src/infer/canonical/query_response.rs
compiler/rustc_infer/src/infer/canonical/query_response.rs
+3
-3
compiler/rustc_infer/src/infer/error_reporting/mod.rs
compiler/rustc_infer/src/infer/error_reporting/mod.rs
+1
-1
compiler/rustc_infer/src/infer/mod.rs
compiler/rustc_infer/src/infer/mod.rs
+7
-7
compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
.../rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
+2
-2
compiler/rustc_mir/src/borrow_check/diagnostics/region_errors.rs
...r/rustc_mir/src/borrow_check/diagnostics/region_errors.rs
+4
-4
compiler/rustc_mir/src/borrow_check/region_infer/dump_mir.rs
compiler/rustc_mir/src/borrow_check/region_infer/dump_mir.rs
+2
-2
compiler/rustc_mir/src/borrow_check/region_infer/mod.rs
compiler/rustc_mir/src/borrow_check/region_infer/mod.rs
+34
-34
compiler/rustc_mir/src/borrow_check/renumber.rs
compiler/rustc_mir/src/borrow_check/renumber.rs
+6
-6
compiler/rustc_mir/src/borrow_check/type_check/mod.rs
compiler/rustc_mir/src/borrow_check/type_check/mod.rs
+2
-2
compiler/rustc_mir/src/borrow_check/type_check/relate_tys.rs
compiler/rustc_mir/src/borrow_check/type_check/relate_tys.rs
+3
-3
compiler/rustc_mir/src/borrow_check/universal_regions.rs
compiler/rustc_mir/src/borrow_check/universal_regions.rs
+7
-7
未找到文件。
compiler/rustc_infer/src/infer/canonical/query_response.rs
浏览文件 @
f8e0e78d
...
...
@@ -14,7 +14,7 @@
};
use
crate
::
infer
::
nll_relate
::{
NormalizationStrategy
,
TypeRelating
,
TypeRelatingDelegate
};
use
crate
::
infer
::
region_constraints
::{
Constraint
,
RegionConstraintData
};
use
crate
::
infer
::{
InferCtxt
,
InferOk
,
InferResult
,
N
LL
RegionVariableOrigin
};
use
crate
::
infer
::{
InferCtxt
,
InferOk
,
InferResult
,
N
ll
RegionVariableOrigin
};
use
crate
::
traits
::
query
::{
Fallible
,
NoSolution
};
use
crate
::
traits
::
TraitEngine
;
use
crate
::
traits
::{
Obligation
,
ObligationCause
,
PredicateObligation
};
...
...
@@ -644,7 +644,7 @@ fn create_next_universe(&mut self) -> ty::UniverseIndex {
}
fn
next_existential_region_var
(
&
mut
self
,
from_forall
:
bool
)
->
ty
::
Region
<
'tcx
>
{
let
origin
=
N
LL
RegionVariableOrigin
::
Existential
{
from_forall
};
let
origin
=
N
ll
RegionVariableOrigin
::
Existential
{
from_forall
};
self
.infcx
.next_nll_region_var
(
origin
)
}
...
...
@@ -654,7 +654,7 @@ fn next_placeholder_region(&mut self, placeholder: ty::PlaceholderRegion) -> ty:
fn
generalize_existential
(
&
mut
self
,
universe
:
ty
::
UniverseIndex
)
->
ty
::
Region
<
'tcx
>
{
self
.infcx
.next_nll_region_var_in_universe
(
N
LL
RegionVariableOrigin
::
Existential
{
from_forall
:
false
},
N
ll
RegionVariableOrigin
::
Existential
{
from_forall
:
false
},
universe
,
)
}
...
...
compiler/rustc_infer/src/infer/error_reporting/mod.rs
浏览文件 @
f8e0e78d
...
...
@@ -2342,7 +2342,7 @@ fn report_inference_failure(
let
var_name
=
self
.tcx
.hir
()
.name
(
upvar_id
.var_path.hir_id
);
format!
(
" for capture of `{}` by closure"
,
var_name
)
}
infer
::
N
LL
(
..
)
=>
bug!
(
"NLL variable found in lexical phase"
),
infer
::
N
ll
(
..
)
=>
bug!
(
"NLL variable found in lexical phase"
),
};
struct_span_err!
(
...
...
compiler/rustc_infer/src/infer/mod.rs
浏览文件 @
f8e0e78d
...
...
@@ -458,11 +458,11 @@ pub enum RegionVariableOrigin {
/// This origin is used for the inference variables that we create
/// during NLL region processing.
N
LL
(
NLL
RegionVariableOrigin
),
N
ll
(
Nll
RegionVariableOrigin
),
}
#[derive(Copy,
Clone,
Debug)]
pub
enum
N
LL
RegionVariableOrigin
{
pub
enum
N
ll
RegionVariableOrigin
{
/// During NLL region processing, we create variables for free
/// regions that we encounter in the function signature and
/// elsewhere. This origin indices we've got one of those.
...
...
@@ -1078,17 +1078,17 @@ pub fn num_region_vars(&self) -> usize {
}
/// Just a convenient wrapper of `next_region_var` for using during NLL.
pub
fn
next_nll_region_var
(
&
self
,
origin
:
N
LL
RegionVariableOrigin
)
->
ty
::
Region
<
'tcx
>
{
self
.next_region_var
(
RegionVariableOrigin
::
N
LL
(
origin
))
pub
fn
next_nll_region_var
(
&
self
,
origin
:
N
ll
RegionVariableOrigin
)
->
ty
::
Region
<
'tcx
>
{
self
.next_region_var
(
RegionVariableOrigin
::
N
ll
(
origin
))
}
/// Just a convenient wrapper of `next_region_var` for using during NLL.
pub
fn
next_nll_region_var_in_universe
(
&
self
,
origin
:
N
LL
RegionVariableOrigin
,
origin
:
N
ll
RegionVariableOrigin
,
universe
:
ty
::
UniverseIndex
,
)
->
ty
::
Region
<
'tcx
>
{
self
.next_region_var_in_universe
(
RegionVariableOrigin
::
N
LL
(
origin
),
universe
)
self
.next_region_var_in_universe
(
RegionVariableOrigin
::
N
ll
(
origin
),
universe
)
}
pub
fn
var_for_def
(
&
self
,
span
:
Span
,
param
:
&
ty
::
GenericParamDef
)
->
GenericArg
<
'tcx
>
{
...
...
@@ -1770,7 +1770,7 @@ pub fn span(&self) -> Span {
|
LateBoundRegion
(
a
,
..
)
|
UpvarRegion
(
_
,
a
)
=>
a
,
BoundRegionInCoherence
(
_
)
=>
rustc_span
::
DUMMY_SP
,
N
LL
(
..
)
=>
bug!
(
"NLL variable used with `span`"
),
N
ll
(
..
)
=>
bug!
(
"NLL variable used with `span`"
),
}
}
}
...
...
compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
浏览文件 @
f8e0e78d
...
...
@@ -5,7 +5,7 @@
use
rustc_data_structures
::
fx
::
FxHashSet
;
use
rustc_errors
::{
Applicability
,
DiagnosticBuilder
};
use
rustc_index
::
vec
::
IndexVec
;
use
rustc_infer
::
infer
::
N
LL
RegionVariableOrigin
;
use
rustc_infer
::
infer
::
N
ll
RegionVariableOrigin
;
use
rustc_middle
::
mir
::{
Body
,
CastKind
,
ConstraintCategory
,
FakeReadCause
,
Local
,
Location
,
Operand
,
Place
,
Rvalue
,
Statement
,
StatementKind
,
TerminatorKind
,
...
...
@@ -258,7 +258,7 @@ fn free_region_constraint_info(
let
(
category
,
from_closure
,
span
)
=
self
.regioncx
.best_blame_constraint
(
&
self
.body
,
borrow_region
,
N
LL
RegionVariableOrigin
::
FreeRegion
,
N
ll
RegionVariableOrigin
::
FreeRegion
,
|
r
|
self
.regioncx
.provides_universal_region
(
r
,
borrow_region
,
outlived_region
),
);
...
...
compiler/rustc_mir/src/borrow_check/diagnostics/region_errors.rs
浏览文件 @
f8e0e78d
...
...
@@ -3,7 +3,7 @@
use
rustc_errors
::{
Applicability
,
DiagnosticBuilder
};
use
rustc_infer
::
infer
::{
error_reporting
::
nice_region_error
::
NiceRegionError
,
error_reporting
::
unexpected_hidden_region_diagnostic
,
N
LL
RegionVariableOrigin
,
error_reporting
::
unexpected_hidden_region_diagnostic
,
N
ll
RegionVariableOrigin
,
};
use
rustc_middle
::
mir
::{
ConstraintCategory
,
ReturnConstraint
};
use
rustc_middle
::
ty
::
subst
::
Subst
;
...
...
@@ -75,13 +75,13 @@ fn description(&self) -> &'static str {
/// The region element that erroneously must be outlived by `longer_fr`.
error_element
:
RegionElement
,
/// The origin of the placeholder region.
fr_origin
:
N
LL
RegionVariableOrigin
,
fr_origin
:
N
ll
RegionVariableOrigin
,
},
/// Any other lifetime error.
RegionError
{
/// The origin of the region.
fr_origin
:
N
LL
RegionVariableOrigin
,
fr_origin
:
N
ll
RegionVariableOrigin
,
/// The region that should outlive `shorter_fr`.
longer_fr
:
RegionVid
,
/// The region that should be shorter, but we can't prove it.
...
...
@@ -269,7 +269,7 @@ pub(in crate::borrow_check) fn report_region_errors(&mut self, nll_errors: Regio
pub
(
in
crate
::
borrow_check
)
fn
report_region_error
(
&
mut
self
,
fr
:
RegionVid
,
fr_origin
:
N
LL
RegionVariableOrigin
,
fr_origin
:
N
ll
RegionVariableOrigin
,
outlived_fr
:
RegionVid
,
outlives_suggestion
:
&
mut
OutlivesSuggestionBuilder
,
)
{
...
...
compiler/rustc_mir/src/borrow_check/region_infer/dump_mir.rs
浏览文件 @
f8e0e78d
...
...
@@ -5,7 +5,7 @@
use
super
::{
OutlivesConstraint
,
RegionInferenceContext
};
use
crate
::
borrow_check
::
type_check
::
Locations
;
use
rustc_infer
::
infer
::
N
LL
RegionVariableOrigin
;
use
rustc_infer
::
infer
::
N
ll
RegionVariableOrigin
;
use
rustc_middle
::
ty
::
TyCtxt
;
use
std
::
io
::{
self
,
Write
};
...
...
@@ -20,7 +20,7 @@ pub(crate) fn dump_mir(&self, tcx: TyCtxt<'tcx>, out: &mut dyn Write) -> io::Res
writeln!
(
out
,
"| Free Region Mapping"
)
?
;
for
region
in
self
.regions
()
{
if
let
N
LL
RegionVariableOrigin
::
FreeRegion
=
self
.definitions
[
region
]
.origin
{
if
let
N
ll
RegionVariableOrigin
::
FreeRegion
=
self
.definitions
[
region
]
.origin
{
let
classification
=
self
.universal_regions
.region_classification
(
region
)
.unwrap
();
let
outlived_by
=
self
.universal_region_relations
.regions_outlived_by
(
region
);
writeln!
(
...
...
compiler/rustc_mir/src/borrow_check/region_infer/mod.rs
浏览文件 @
f8e0e78d
...
...
@@ -9,7 +9,7 @@
use
rustc_index
::
vec
::
IndexVec
;
use
rustc_infer
::
infer
::
canonical
::
QueryOutlivesConstraint
;
use
rustc_infer
::
infer
::
region_constraints
::{
GenericKind
,
VarInfos
,
VerifyBound
};
use
rustc_infer
::
infer
::{
InferCtxt
,
N
LL
RegionVariableOrigin
,
RegionVariableOrigin
};
use
rustc_infer
::
infer
::{
InferCtxt
,
N
ll
RegionVariableOrigin
,
RegionVariableOrigin
};
use
rustc_middle
::
mir
::{
Body
,
ClosureOutlivesRequirement
,
ClosureOutlivesSubject
,
ClosureRegionRequirements
,
ConstraintCategory
,
Local
,
Location
,
ReturnConstraint
,
...
...
@@ -143,9 +143,9 @@ pub(crate) struct AppliedMemberConstraint {
pub
(
crate
)
struct
RegionDefinition
<
'tcx
>
{
/// What kind of variable is this -- a free region? existential
/// variable? etc. (See the `N
LL
RegionVariableOrigin` for more
/// variable? etc. (See the `N
ll
RegionVariableOrigin` for more
/// info.)
pub
(
in
crate
::
borrow_check
)
origin
:
N
LL
RegionVariableOrigin
,
pub
(
in
crate
::
borrow_check
)
origin
:
N
ll
RegionVariableOrigin
,
/// Which universe is this region variable defined in? This is
/// most often `ty::UniverseIndex::ROOT`, but when we encounter
...
...
@@ -451,7 +451,7 @@ fn init_free_and_bound_regions(&mut self) {
let
scc
=
self
.constraint_sccs
.scc
(
variable
);
match
self
.definitions
[
variable
]
.origin
{
N
LL
RegionVariableOrigin
::
FreeRegion
=>
{
N
ll
RegionVariableOrigin
::
FreeRegion
=>
{
// For each free, universally quantified region X:
// Add all nodes in the CFG to liveness constraints
...
...
@@ -462,7 +462,7 @@ fn init_free_and_bound_regions(&mut self) {
self
.scc_values
.add_element
(
scc
,
variable
);
}
N
LL
RegionVariableOrigin
::
Placeholder
(
placeholder
)
=>
{
N
ll
RegionVariableOrigin
::
Placeholder
(
placeholder
)
=>
{
// Each placeholder region is only visible from
// its universe `ui` and its extensions. So we
// can't just add it into `scc` unless the
...
...
@@ -480,8 +480,8 @@ fn init_free_and_bound_regions(&mut self) {
}
}
N
LL
RegionVariableOrigin
::
RootEmptyRegion
|
N
LL
RegionVariableOrigin
::
Existential
{
..
}
=>
{
N
ll
RegionVariableOrigin
::
RootEmptyRegion
|
N
ll
RegionVariableOrigin
::
Existential
{
..
}
=>
{
// For existential, regions, nothing to do.
}
}
...
...
@@ -1348,7 +1348,7 @@ fn check_universal_regions(
)
{
for
(
fr
,
fr_definition
)
in
self
.definitions
.iter_enumerated
()
{
match
fr_definition
.origin
{
N
LL
RegionVariableOrigin
::
FreeRegion
=>
{
N
ll
RegionVariableOrigin
::
FreeRegion
=>
{
// Go through each of the universal regions `fr` and check that
// they did not grow too large, accumulating any requirements
// for our caller into the `outlives_requirements` vector.
...
...
@@ -1360,12 +1360,12 @@ fn check_universal_regions(
);
}
N
LL
RegionVariableOrigin
::
Placeholder
(
placeholder
)
=>
{
N
ll
RegionVariableOrigin
::
Placeholder
(
placeholder
)
=>
{
self
.check_bound_universal_region
(
fr
,
placeholder
,
errors_buffer
);
}
N
LL
RegionVariableOrigin
::
RootEmptyRegion
|
N
LL
RegionVariableOrigin
::
Existential
{
..
}
=>
{
N
ll
RegionVariableOrigin
::
RootEmptyRegion
|
N
ll
RegionVariableOrigin
::
Existential
{
..
}
=>
{
// nothing to check here
}
}
...
...
@@ -1449,7 +1449,7 @@ fn check_polonius_subset_errors(
errors_buffer
.push
(
RegionErrorKind
::
RegionError
{
longer_fr
:
*
longer_fr
,
shorter_fr
:
*
shorter_fr
,
fr_origin
:
N
LL
RegionVariableOrigin
::
FreeRegion
,
fr_origin
:
N
ll
RegionVariableOrigin
::
FreeRegion
,
is_reported
:
true
,
});
}
...
...
@@ -1459,16 +1459,16 @@ fn check_polonius_subset_errors(
// a more complete picture on how to separate this responsibility.
for
(
fr
,
fr_definition
)
in
self
.definitions
.iter_enumerated
()
{
match
fr_definition
.origin
{
N
LL
RegionVariableOrigin
::
FreeRegion
=>
{
N
ll
RegionVariableOrigin
::
FreeRegion
=>
{
// handled by polonius above
}
N
LL
RegionVariableOrigin
::
Placeholder
(
placeholder
)
=>
{
N
ll
RegionVariableOrigin
::
Placeholder
(
placeholder
)
=>
{
self
.check_bound_universal_region
(
fr
,
placeholder
,
errors_buffer
);
}
N
LL
RegionVariableOrigin
::
RootEmptyRegion
|
N
LL
RegionVariableOrigin
::
Existential
{
..
}
=>
{
N
ll
RegionVariableOrigin
::
RootEmptyRegion
|
N
ll
RegionVariableOrigin
::
Existential
{
..
}
=>
{
// nothing to check here
}
}
...
...
@@ -1516,7 +1516,7 @@ fn check_universal_region(
errors_buffer
.push
(
RegionErrorKind
::
RegionError
{
longer_fr
,
shorter_fr
:
representative
,
fr_origin
:
N
LL
RegionVariableOrigin
::
FreeRegion
,
fr_origin
:
N
ll
RegionVariableOrigin
::
FreeRegion
,
is_reported
:
true
,
});
}
...
...
@@ -1539,7 +1539,7 @@ fn check_universal_region(
errors_buffer
.push
(
RegionErrorKind
::
RegionError
{
longer_fr
,
shorter_fr
,
fr_origin
:
N
LL
RegionVariableOrigin
::
FreeRegion
,
fr_origin
:
N
ll
RegionVariableOrigin
::
FreeRegion
,
is_reported
:
!
error_reported
,
});
...
...
@@ -1597,7 +1597,7 @@ fn try_propagate_universal_region_error(
let
blame_span_category
=
self
.find_outlives_blame_span
(
body
,
longer_fr
,
N
LL
RegionVariableOrigin
::
FreeRegion
,
N
ll
RegionVariableOrigin
::
FreeRegion
,
shorter_fr
,
);
...
...
@@ -1656,7 +1656,7 @@ fn check_bound_universal_region(
errors_buffer
.push
(
RegionErrorKind
::
BoundUniversalRegionError
{
longer_fr
,
error_element
,
fr_origin
:
N
LL
RegionVariableOrigin
::
Placeholder
(
placeholder
),
fr_origin
:
N
ll
RegionVariableOrigin
::
Placeholder
(
placeholder
),
});
}
...
...
@@ -1732,7 +1732,7 @@ fn check_member_constraints(
debug!
(
"cannot_name_value_of(r1={:?}, r2={:?})"
,
r1
,
r2
);
match
self
.definitions
[
r2
]
.origin
{
N
LL
RegionVariableOrigin
::
Placeholder
(
placeholder
)
=>
{
N
ll
RegionVariableOrigin
::
Placeholder
(
placeholder
)
=>
{
let
universe1
=
self
.definitions
[
r1
]
.universe
;
debug!
(
"cannot_name_value_of: universe1={:?} placeholder={:?}"
,
...
...
@@ -1741,9 +1741,9 @@ fn check_member_constraints(
universe1
.cannot_name
(
placeholder
.universe
)
}
N
LL
RegionVariableOrigin
::
RootEmptyRegion
|
N
LL
RegionVariableOrigin
::
FreeRegion
|
N
LL
RegionVariableOrigin
::
Existential
{
..
}
=>
false
,
N
ll
RegionVariableOrigin
::
RootEmptyRegion
|
N
ll
RegionVariableOrigin
::
FreeRegion
|
N
ll
RegionVariableOrigin
::
Existential
{
..
}
=>
false
,
}
}
...
...
@@ -1771,7 +1771,7 @@ fn check_member_constraints(
&
self
,
body
:
&
Body
<
'tcx
>
,
fr1
:
RegionVid
,
fr1_origin
:
N
LL
RegionVariableOrigin
,
fr1_origin
:
N
ll
RegionVariableOrigin
,
fr2
:
RegionVid
,
)
->
(
ConstraintCategory
,
Span
)
{
let
(
category
,
_
,
span
)
=
self
.best_blame_constraint
(
body
,
fr1
,
fr1_origin
,
|
r
|
{
...
...
@@ -1933,7 +1933,7 @@ fn check_member_constraints(
.definitions
.iter_enumerated
()
.find_map
(|(
r
,
definition
)|
match
definition
.origin
{
N
LL
RegionVariableOrigin
::
Placeholder
(
p
)
if
p
==
error_placeholder
=>
Some
(
r
),
N
ll
RegionVariableOrigin
::
Placeholder
(
p
)
if
p
==
error_placeholder
=>
Some
(
r
),
_
=>
None
,
})
.unwrap
(),
...
...
@@ -1965,7 +1965,7 @@ fn check_member_constraints(
&
self
,
body
:
&
Body
<
'tcx
>
,
from_region
:
RegionVid
,
from_region_origin
:
N
LL
RegionVariableOrigin
,
from_region_origin
:
N
ll
RegionVariableOrigin
,
target_test
:
impl
Fn
(
RegionVid
)
->
bool
,
)
->
(
ConstraintCategory
,
bool
,
Span
)
{
debug!
(
...
...
@@ -2059,11 +2059,11 @@ fn check_member_constraints(
//
// and here we prefer to blame the source (the y = x statement).
let
blame_source
=
match
from_region_origin
{
N
LL
RegionVariableOrigin
::
FreeRegion
|
N
LL
RegionVariableOrigin
::
Existential
{
from_forall
:
false
}
=>
true
,
N
LL
RegionVariableOrigin
::
RootEmptyRegion
|
N
LL
RegionVariableOrigin
::
Placeholder
(
_
)
|
N
LL
RegionVariableOrigin
::
Existential
{
from_forall
:
true
}
=>
false
,
N
ll
RegionVariableOrigin
::
FreeRegion
|
N
ll
RegionVariableOrigin
::
Existential
{
from_forall
:
false
}
=>
true
,
N
ll
RegionVariableOrigin
::
RootEmptyRegion
|
N
ll
RegionVariableOrigin
::
Placeholder
(
_
)
|
N
ll
RegionVariableOrigin
::
Existential
{
from_forall
:
true
}
=>
false
,
};
let
find_region
=
|
i
:
&
usize
|
{
...
...
@@ -2144,8 +2144,8 @@ fn new(universe: ty::UniverseIndex, rv_origin: RegionVariableOrigin) -> Self {
// `init_universal_regions`.
let
origin
=
match
rv_origin
{
RegionVariableOrigin
::
N
LL
(
origin
)
=>
origin
,
_
=>
N
LL
RegionVariableOrigin
::
Existential
{
from_forall
:
false
},
RegionVariableOrigin
::
N
ll
(
origin
)
=>
origin
,
_
=>
N
ll
RegionVariableOrigin
::
Existential
{
from_forall
:
false
},
};
Self
{
origin
,
universe
,
external_name
:
None
}
...
...
compiler/rustc_mir/src/borrow_check/renumber.rs
浏览文件 @
f8e0e78d
use
rustc_index
::
vec
::
IndexVec
;
use
rustc_infer
::
infer
::{
InferCtxt
,
N
LL
RegionVariableOrigin
};
use
rustc_infer
::
infer
::{
InferCtxt
,
N
ll
RegionVariableOrigin
};
use
rustc_middle
::
mir
::
visit
::{
MutVisitor
,
TyContext
};
use
rustc_middle
::
mir
::{
Body
,
Location
,
PlaceElem
,
Promoted
};
use
rustc_middle
::
ty
::
subst
::
SubstsRef
;
...
...
@@ -15,7 +15,7 @@ pub fn renumber_mir<'tcx>(
debug!
(
"renumber_mir()"
);
debug!
(
"renumber_mir: body.arg_count={:?}"
,
body
.arg_count
);
let
mut
visitor
=
N
LL
Visitor
{
infcx
};
let
mut
visitor
=
N
ll
Visitor
{
infcx
};
for
body
in
promoted
.iter_mut
()
{
visitor
.visit_body
(
body
);
...
...
@@ -33,16 +33,16 @@ pub fn renumber_regions<'tcx, T>(infcx: &InferCtxt<'_, 'tcx>, value: T) -> T
debug!
(
"renumber_regions(value={:?})"
,
value
);
infcx
.tcx
.fold_regions
(
value
,
&
mut
false
,
|
_
region
,
_
depth
|
{
let
origin
=
N
LL
RegionVariableOrigin
::
Existential
{
from_forall
:
false
};
let
origin
=
N
ll
RegionVariableOrigin
::
Existential
{
from_forall
:
false
};
infcx
.next_nll_region_var
(
origin
)
})
}
struct
N
LL
Visitor
<
'a
,
'tcx
>
{
struct
N
ll
Visitor
<
'a
,
'tcx
>
{
infcx
:
&
'a
InferCtxt
<
'a
,
'tcx
>
,
}
impl
<
'a
,
'tcx
>
N
LL
Visitor
<
'a
,
'tcx
>
{
impl
<
'a
,
'tcx
>
N
ll
Visitor
<
'a
,
'tcx
>
{
fn
renumber_regions
<
T
>
(
&
mut
self
,
value
:
T
)
->
T
where
T
:
TypeFoldable
<
'tcx
>
,
...
...
@@ -51,7 +51,7 @@ fn renumber_regions<T>(&mut self, value: T) -> T
}
}
impl
<
'a
,
'tcx
>
MutVisitor
<
'tcx
>
for
N
LL
Visitor
<
'a
,
'tcx
>
{
impl
<
'a
,
'tcx
>
MutVisitor
<
'tcx
>
for
N
ll
Visitor
<
'a
,
'tcx
>
{
fn
tcx
(
&
self
)
->
TyCtxt
<
'tcx
>
{
self
.infcx.tcx
}
...
...
compiler/rustc_mir/src/borrow_check/type_check/mod.rs
浏览文件 @
f8e0e78d
...
...
@@ -16,7 +16,7 @@
use
rustc_infer
::
infer
::
outlives
::
env
::
RegionBoundPairs
;
use
rustc_infer
::
infer
::
type_variable
::{
TypeVariableOrigin
,
TypeVariableOriginKind
};
use
rustc_infer
::
infer
::{
InferCtxt
,
InferOk
,
LateBoundRegionConversionTime
,
N
LL
RegionVariableOrigin
,
InferCtxt
,
InferOk
,
LateBoundRegionConversionTime
,
N
ll
RegionVariableOrigin
,
};
use
rustc_middle
::
mir
::
tcx
::
PlaceTy
;
use
rustc_middle
::
mir
::
visit
::{
NonMutatingUseContext
,
PlaceContext
,
Visitor
};
...
...
@@ -876,7 +876,7 @@ fn placeholder_region(
match
self
.placeholder_index_to_region
.get
(
placeholder_index
)
{
Some
(
&
v
)
=>
v
,
None
=>
{
let
origin
=
N
LL
RegionVariableOrigin
::
Placeholder
(
placeholder
);
let
origin
=
N
ll
RegionVariableOrigin
::
Placeholder
(
placeholder
);
let
region
=
infcx
.next_nll_region_var_in_universe
(
origin
,
placeholder
.universe
);
self
.placeholder_index_to_region
.push
(
region
);
region
...
...
compiler/rustc_mir/src/borrow_check/type_check/relate_tys.rs
浏览文件 @
f8e0e78d
use
rustc_infer
::
infer
::
nll_relate
::{
NormalizationStrategy
,
TypeRelating
,
TypeRelatingDelegate
};
use
rustc_infer
::
infer
::{
InferCtxt
,
N
LL
RegionVariableOrigin
};
use
rustc_infer
::
infer
::{
InferCtxt
,
N
ll
RegionVariableOrigin
};
use
rustc_middle
::
mir
::
ConstraintCategory
;
use
rustc_middle
::
ty
::
relate
::
TypeRelation
;
use
rustc_middle
::
ty
::{
self
,
Const
,
Ty
};
...
...
@@ -64,7 +64,7 @@ fn create_next_universe(&mut self) -> ty::UniverseIndex {
fn
next_existential_region_var
(
&
mut
self
,
from_forall
:
bool
)
->
ty
::
Region
<
'tcx
>
{
if
self
.borrowck_context
.is_some
()
{
let
origin
=
N
LL
RegionVariableOrigin
::
Existential
{
from_forall
};
let
origin
=
N
ll
RegionVariableOrigin
::
Existential
{
from_forall
};
self
.infcx
.next_nll_region_var
(
origin
)
}
else
{
self
.infcx.tcx.lifetimes.re_erased
...
...
@@ -81,7 +81,7 @@ fn next_placeholder_region(&mut self, placeholder: ty::PlaceholderRegion) -> ty:
fn
generalize_existential
(
&
mut
self
,
universe
:
ty
::
UniverseIndex
)
->
ty
::
Region
<
'tcx
>
{
self
.infcx
.next_nll_region_var_in_universe
(
N
LL
RegionVariableOrigin
::
Existential
{
from_forall
:
false
},
N
ll
RegionVariableOrigin
::
Existential
{
from_forall
:
false
},
universe
,
)
}
...
...
compiler/rustc_mir/src/borrow_check/universal_regions.rs
浏览文件 @
f8e0e78d
...
...
@@ -20,7 +20,7 @@
use
rustc_hir
::
lang_items
::
LangItem
;
use
rustc_hir
::{
BodyOwnerKind
,
HirId
};
use
rustc_index
::
vec
::{
Idx
,
IndexVec
};
use
rustc_infer
::
infer
::{
InferCtxt
,
N
LL
RegionVariableOrigin
};
use
rustc_infer
::
infer
::{
InferCtxt
,
N
ll
RegionVariableOrigin
};
use
rustc_middle
::
ty
::
fold
::
TypeFoldable
;
use
rustc_middle
::
ty
::
subst
::{
InternalSubsts
,
Subst
,
SubstsRef
};
use
rustc_middle
::
ty
::{
self
,
RegionVid
,
Ty
,
TyCtxt
};
...
...
@@ -393,7 +393,7 @@ struct UniversalRegionsBuilder<'cx, 'tcx> {
param_env
:
ty
::
ParamEnv
<
'tcx
>
,
}
const
FR
:
N
LLRegionVariableOrigin
=
NLL
RegionVariableOrigin
::
FreeRegion
;
const
FR
:
N
llRegionVariableOrigin
=
Nll
RegionVariableOrigin
::
FreeRegion
;
impl
<
'cx
,
'tcx
>
UniversalRegionsBuilder
<
'cx
,
'tcx
>
{
fn
build
(
self
)
->
UniversalRegions
<
'tcx
>
{
...
...
@@ -486,7 +486,7 @@ fn build(self) -> UniversalRegions<'tcx> {
let
root_empty
=
self
.infcx
.next_nll_region_var
(
N
LL
RegionVariableOrigin
::
RootEmptyRegion
)
.next_nll_region_var
(
N
ll
RegionVariableOrigin
::
RootEmptyRegion
)
.to_region_vid
();
UniversalRegions
{
...
...
@@ -647,7 +647,7 @@ fn compute_inputs_and_output(
trait
InferCtxtExt
<
'tcx
>
{
fn
replace_free_regions_with_nll_infer_vars
<
T
>
(
&
self
,
origin
:
N
LL
RegionVariableOrigin
,
origin
:
N
ll
RegionVariableOrigin
,
value
:
T
,
)
->
T
where
...
...
@@ -655,7 +655,7 @@ fn replace_free_regions_with_nll_infer_vars<T>(
fn
replace_bound_regions_with_nll_infer_vars
<
T
>
(
&
self
,
origin
:
N
LL
RegionVariableOrigin
,
origin
:
N
ll
RegionVariableOrigin
,
all_outlive_scope
:
LocalDefId
,
value
:
ty
::
Binder
<
T
>
,
indices
:
&
mut
UniversalRegionIndices
<
'tcx
>
,
...
...
@@ -673,7 +673,7 @@ fn replace_late_bound_regions_with_nll_infer_vars(
impl
<
'cx
,
'tcx
>
InferCtxtExt
<
'tcx
>
for
InferCtxt
<
'cx
,
'tcx
>
{
fn
replace_free_regions_with_nll_infer_vars
<
T
>
(
&
self
,
origin
:
N
LL
RegionVariableOrigin
,
origin
:
N
ll
RegionVariableOrigin
,
value
:
T
,
)
->
T
where
...
...
@@ -684,7 +684,7 @@ fn replace_free_regions_with_nll_infer_vars<T>(
fn
replace_bound_regions_with_nll_infer_vars
<
T
>
(
&
self
,
origin
:
N
LL
RegionVariableOrigin
,
origin
:
N
ll
RegionVariableOrigin
,
all_outlive_scope
:
LocalDefId
,
value
:
ty
::
Binder
<
T
>
,
indices
:
&
mut
UniversalRegionIndices
<
'tcx
>
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录