Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
bca294da
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,发现更多精彩内容 >>
提交
bca294da
编写于
9月 24, 2018
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename `QueryResult` to `QueryResponse`
`Result` really sounds like the rustc result type
上级
fd046a2e
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
158 addition
and
158 deletion
+158
-158
src/librustc/ich/impls_ty.rs
src/librustc/ich/impls_ty.rs
+1
-1
src/librustc/infer/canonical/mod.rs
src/librustc/infer/canonical/mod.rs
+10
-10
src/librustc/infer/canonical/query_response.rs
src/librustc/infer/canonical/query_response.rs
+52
-52
src/librustc/traits/query/dropck_outlives.rs
src/librustc/traits/query/dropck_outlives.rs
+1
-1
src/librustc/traits/query/normalize.rs
src/librustc/traits/query/normalize.rs
+1
-1
src/librustc/traits/query/outlives_bounds.rs
src/librustc/traits/query/outlives_bounds.rs
+1
-1
src/librustc/traits/query/type_op/custom.rs
src/librustc/traits/query/type_op/custom.rs
+2
-2
src/librustc/traits/query/type_op/eq.rs
src/librustc/traits/query/type_op/eq.rs
+6
-6
src/librustc/traits/query/type_op/implied_outlives_bounds.rs
src/librustc/traits/query/type_op/implied_outlives_bounds.rs
+6
-6
src/librustc/traits/query/type_op/mod.rs
src/librustc/traits/query/type_op/mod.rs
+14
-14
src/librustc/traits/query/type_op/normalize.rs
src/librustc/traits/query/type_op/normalize.rs
+20
-20
src/librustc/traits/query/type_op/outlives.rs
src/librustc/traits/query/type_op/outlives.rs
+6
-6
src/librustc/traits/query/type_op/prove_predicate.rs
src/librustc/traits/query/type_op/prove_predicate.rs
+6
-6
src/librustc/traits/query/type_op/subtype.rs
src/librustc/traits/query/type_op/subtype.rs
+5
-5
src/librustc/ty/query/mod.rs
src/librustc/ty/query/mod.rs
+10
-10
src/librustc_traits/chalk_context.rs
src/librustc_traits/chalk_context.rs
+3
-3
src/librustc_traits/dropck_outlives.rs
src/librustc_traits/dropck_outlives.rs
+3
-3
src/librustc_traits/implied_outlives_bounds.rs
src/librustc_traits/implied_outlives_bounds.rs
+1
-1
src/librustc_traits/normalize_projection_ty.rs
src/librustc_traits/normalize_projection_ty.rs
+2
-2
src/librustc_traits/type_op.rs
src/librustc_traits/type_op.rs
+8
-8
未找到文件。
src/librustc/ich/impls_ty.rs
浏览文件 @
bca294da
...
...
@@ -1297,7 +1297,7 @@ impl<'tcx> for struct infer::canonical::CanonicalVarValues<'tcx> {
});
impl_stable_hash_for!
(
impl
<
'tcx
,
R
>
for
struct
infer
::
canonical
::
QueryRes
ult
<
'tcx
,
R
>
{
impl
<
'tcx
,
R
>
for
struct
infer
::
canonical
::
QueryRes
ponse
<
'tcx
,
R
>
{
var_values
,
region_constraints
,
certainty
,
value
}
);
...
...
src/librustc/infer/canonical/mod.rs
浏览文件 @
bca294da
...
...
@@ -44,7 +44,7 @@
mod
canonicalizer
;
pub
mod
query_res
ult
;
pub
mod
query_res
ponse
;
mod
substitute
;
...
...
@@ -118,10 +118,10 @@ pub enum CanonicalTyVarKind {
}
/// After we execute a query with a canonicalized key, we get back a
/// `Canonical<QueryRes
ult
<..>>`. You can use
/// `Canonical<QueryRes
ponse
<..>>`. You can use
/// `instantiate_query_result` to access the data in this result.
#[derive(Clone,
Debug)]
pub
struct
QueryRes
ult
<
'tcx
,
R
>
{
pub
struct
QueryRes
ponse
<
'tcx
,
R
>
{
pub
var_values
:
CanonicalVarValues
<
'tcx
>
,
pub
region_constraints
:
Vec
<
QueryRegionConstraint
<
'tcx
>>
,
pub
certainty
:
Certainty
,
...
...
@@ -130,8 +130,8 @@ pub struct QueryResult<'tcx, R> {
pub
type
Canonicalized
<
'gcx
,
V
>
=
Canonical
<
'gcx
,
<
V
as
Lift
<
'gcx
>>
::
Lifted
>
;
pub
type
CanonicalizedQueryRes
ult
<
'gcx
,
T
>
=
Lrc
<
Canonical
<
'gcx
,
QueryRes
ult
<
'gcx
,
<
T
as
Lift
<
'gcx
>>
::
Lifted
>>>
;
pub
type
CanonicalizedQueryRes
ponse
<
'gcx
,
T
>
=
Lrc
<
Canonical
<
'gcx
,
QueryRes
ponse
<
'gcx
,
<
T
as
Lift
<
'gcx
>>
::
Lifted
>>>
;
/// Indicates whether or not we were able to prove the query to be
/// true.
...
...
@@ -168,7 +168,7 @@ pub fn is_ambiguous(&self) -> bool {
}
}
impl
<
'tcx
,
R
>
QueryRes
ult
<
'tcx
,
R
>
{
impl
<
'tcx
,
R
>
QueryRes
ponse
<
'tcx
,
R
>
{
pub
fn
is_proven
(
&
self
)
->
bool
{
self
.certainty
.is_proven
()
}
...
...
@@ -178,7 +178,7 @@ pub fn is_ambiguous(&self) -> bool {
}
}
impl
<
'tcx
,
R
>
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
R
>>
{
impl
<
'tcx
,
R
>
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
R
>>
{
pub
fn
is_proven
(
&
self
)
->
bool
{
self
.value
.is_proven
()
}
...
...
@@ -351,14 +351,14 @@ impl<'tcx> TypeFoldable<'tcx> for CanonicalVarValues<'tcx> {
}
BraceStructTypeFoldableImpl!
{
impl
<
'tcx
,
R
>
TypeFoldable
<
'tcx
>
for
QueryRes
ult
<
'tcx
,
R
>
{
impl
<
'tcx
,
R
>
TypeFoldable
<
'tcx
>
for
QueryRes
ponse
<
'tcx
,
R
>
{
var_values
,
region_constraints
,
certainty
,
value
}
where
R
:
TypeFoldable
<
'tcx
>
,
}
BraceStructLiftImpl!
{
impl
<
'a
,
'tcx
,
R
>
Lift
<
'tcx
>
for
QueryRes
ult
<
'a
,
R
>
{
type
Lifted
=
QueryRes
ult
<
'tcx
,
R
::
Lifted
>
;
impl
<
'a
,
'tcx
,
R
>
Lift
<
'tcx
>
for
QueryRes
ponse
<
'a
,
R
>
{
type
Lifted
=
QueryRes
ponse
<
'tcx
,
R
::
Lifted
>
;
var_values
,
region_constraints
,
certainty
,
value
}
where
R
:
Lift
<
'tcx
>
}
...
...
src/librustc/infer/canonical/query_res
ult
.rs
→
src/librustc/infer/canonical/query_res
ponse
.rs
浏览文件 @
bca294da
...
...
@@ -19,8 +19,8 @@
use
infer
::
canonical
::
substitute
::
substitute_value
;
use
infer
::
canonical
::{
Canonical
,
CanonicalVarKind
,
CanonicalVarValues
,
CanonicalizedQueryRes
ult
,
Certainty
,
QueryRegionConstraint
,
QueryRes
ult
,
SmallCanonicalVarValues
,
Canonical
,
CanonicalVarKind
,
CanonicalVarValues
,
CanonicalizedQueryRes
ponse
,
Certainty
,
QueryRegionConstraint
,
QueryRes
ponse
,
SmallCanonicalVarValues
,
};
use
infer
::
region_constraints
::{
Constraint
,
RegionConstraintData
};
use
infer
::
InferCtxtBuilder
;
...
...
@@ -59,7 +59,7 @@ pub fn enter_canonical_trait_query<K, R>(
canonical_key
:
&
Canonical
<
'tcx
,
K
>
,
operation
:
impl
FnOnce
(
&
InferCtxt
<
'_
,
'gcx
,
'tcx
>
,
&
mut
FulfillmentContext
<
'tcx
>
,
K
)
->
Fallible
<
R
>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
R
>>
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
R
>>
where
K
:
TypeFoldable
<
'tcx
>
,
R
:
Debug
+
Lift
<
'gcx
>
+
TypeFoldable
<
'tcx
>
,
...
...
@@ -67,7 +67,7 @@ pub fn enter_canonical_trait_query<K, R>(
self
.enter_with_canonical
(
DUMMY_SP
,
canonical_key
,
|
ref
infcx
,
key
,
canonical_inference_vars
|
{
let
fulfill_cx
=
&
mut
FulfillmentContext
::
new
();
let
value
=
operation
(
infcx
,
fulfill_cx
,
key
)
?
;
infcx
.make_canonicalized_query_res
ult
(
canonical_inference_vars
,
value
,
fulfill_cx
)
infcx
.make_canonicalized_query_res
ponse
(
canonical_inference_vars
,
value
,
fulfill_cx
)
})
}
}
...
...
@@ -92,41 +92,41 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// the same thing happens, but the resulting query is marked as ambiguous.
/// - Finally, if any of the obligations result in a hard error,
/// then `Err(NoSolution)` is returned.
pub
fn
make_canonicalized_query_res
ult
<
T
>
(
pub
fn
make_canonicalized_query_res
ponse
<
T
>
(
&
self
,
inference_vars
:
CanonicalVarValues
<
'tcx
>
,
answer
:
T
,
fulfill_cx
:
&
mut
FulfillmentContext
<
'tcx
>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
T
>>
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
T
>>
where
T
:
Debug
+
Lift
<
'gcx
>
+
TypeFoldable
<
'tcx
>
,
{
let
query_res
ult
=
self
.make_query_result
(
inference_vars
,
answer
,
fulfill_cx
)
?
;
let
canonical_result
=
self
.canonicalize_response
(
&
query_res
ult
);
let
query_res
ponse
=
self
.make_query_response
(
inference_vars
,
answer
,
fulfill_cx
)
?
;
let
canonical_result
=
self
.canonicalize_response
(
&
query_res
ponse
);
debug!
(
"make_canonicalized_query_res
ult
: canonical_result = {:#?}"
,
"make_canonicalized_query_res
ponse
: canonical_result = {:#?}"
,
canonical_result
);
Ok
(
Lrc
::
new
(
canonical_result
))
}
/// Helper for `make_canonicalized_query_res
ult
` that does
/// Helper for `make_canonicalized_query_res
ponse
` that does
/// everything up until the final canonicalization.
fn
make_query_res
ult
<
T
>
(
fn
make_query_res
ponse
<
T
>
(
&
self
,
inference_vars
:
CanonicalVarValues
<
'tcx
>
,
answer
:
T
,
fulfill_cx
:
&
mut
FulfillmentContext
<
'tcx
>
,
)
->
Result
<
QueryRes
ult
<
'tcx
,
T
>
,
NoSolution
>
)
->
Result
<
QueryRes
ponse
<
'tcx
,
T
>
,
NoSolution
>
where
T
:
Debug
+
TypeFoldable
<
'tcx
>
+
Lift
<
'gcx
>
,
{
let
tcx
=
self
.tcx
;
debug!
(
"make_query_res
ult
(
\
"make_query_res
ponse
(
\
inference_vars={:?},
\
answer={:?})"
,
inference_vars
,
answer
,
...
...
@@ -138,7 +138,7 @@ fn make_query_result<T>(
if
!
true_errors
.is_empty
()
{
// FIXME -- we don't indicate *why* we failed to solve
debug!
(
"make_query_res
ult
: true_errors={:#?}"
,
true_errors
);
debug!
(
"make_query_res
ponse
: true_errors={:#?}"
,
true_errors
);
return
Err
(
NoSolution
);
}
...
...
@@ -162,7 +162,7 @@ fn make_query_result<T>(
Certainty
::
Ambiguous
};
Ok
(
QueryRes
ult
{
Ok
(
QueryRes
ponse
{
var_values
:
inference_vars
,
region_constraints
,
certainty
,
...
...
@@ -180,12 +180,12 @@ fn make_query_result<T>(
/// out the [chapter in the rustc guide][c].
///
/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#processing-the-canonicalized-query-result
pub
fn
instantiate_query_res
ult
_and_region_obligations
<
R
>
(
pub
fn
instantiate_query_res
ponse
_and_region_obligations
<
R
>
(
&
self
,
cause
:
&
ObligationCause
<
'tcx
>
,
param_env
:
ty
::
ParamEnv
<
'tcx
>
,
original_values
:
&
SmallCanonicalVarValues
<
'tcx
>
,
query_res
ult
:
&
Canonical
<
'tcx
,
QueryResult
<
'tcx
,
R
>>
,
query_res
ponse
:
&
Canonical
<
'tcx
,
QueryResponse
<
'tcx
,
R
>>
,
)
->
InferResult
<
'tcx
,
R
>
where
R
:
Debug
+
TypeFoldable
<
'tcx
>
,
...
...
@@ -193,17 +193,17 @@ pub fn instantiate_query_result_and_region_obligations<R>(
let
InferOk
{
value
:
result_subst
,
mut
obligations
,
}
=
self
.query_res
ult_substitution
(
cause
,
param_env
,
original_values
,
query_result
)
?
;
}
=
self
.query_res
ponse_substitution
(
cause
,
param_env
,
original_values
,
query_response
)
?
;
obligations
.extend
(
self
.query_region_constraints_into_obligations
(
cause
,
param_env
,
&
query_res
ult
.value.region_constraints
,
&
query_res
ponse
.value.region_constraints
,
&
result_subst
,
));
let
user_result
:
R
=
query_res
ult
.substitute_projected
(
self
.tcx
,
&
result_subst
,
|
q_r
|
&
q_r
.value
);
query_res
ponse
.substitute_projected
(
self
.tcx
,
&
result_subst
,
|
q_r
|
&
q_r
.value
);
Ok
(
InferOk
{
value
:
user_result
,
...
...
@@ -212,7 +212,7 @@ pub fn instantiate_query_result_and_region_obligations<R>(
}
/// An alternative to
/// `instantiate_query_res
ult
_and_region_obligations` that is more
/// `instantiate_query_res
ponse
_and_region_obligations` that is more
/// efficient for NLL. NLL is a bit more advanced in the
/// "transition to chalk" than the rest of the compiler. During
/// the NLL type check, all of the "processing" of types and
...
...
@@ -227,8 +227,8 @@ pub fn instantiate_query_result_and_region_obligations<R>(
/// into the older infcx-style constraints (e.g., calls to
/// `sub_regions` or `register_region_obligation`).
///
/// Therefore, `instantiate_nll_query_res
ult
_and_region_obligations` performs the same
/// basic operations as `instantiate_query_res
ult
_and_region_obligations` but
/// Therefore, `instantiate_nll_query_res
ponse
_and_region_obligations` performs the same
/// basic operations as `instantiate_query_res
ponse
_and_region_obligations` but
/// it returns its result differently:
///
/// - It creates a substitution `S` that maps from the original
...
...
@@ -246,12 +246,12 @@ pub fn instantiate_query_result_and_region_obligations<R>(
/// are propagated back in the return value.
/// - Finally, the query result (of type `R`) is propagated back,
/// after applying the substitution `S`.
pub
fn
instantiate_nll_query_res
ult
_and_region_obligations
<
R
>
(
pub
fn
instantiate_nll_query_res
ponse
_and_region_obligations
<
R
>
(
&
self
,
cause
:
&
ObligationCause
<
'tcx
>
,
param_env
:
ty
::
ParamEnv
<
'tcx
>
,
original_values
:
&
SmallCanonicalVarValues
<
'tcx
>
,
query_res
ult
:
&
Canonical
<
'tcx
,
QueryResult
<
'tcx
,
R
>>
,
query_res
ponse
:
&
Canonical
<
'tcx
,
QueryResponse
<
'tcx
,
R
>>
,
output_query_region_constraints
:
&
mut
Vec
<
QueryRegionConstraint
<
'tcx
>>
,
)
->
InferResult
<
'tcx
,
R
>
where
...
...
@@ -259,13 +259,13 @@ pub fn instantiate_nll_query_result_and_region_obligations<R>(
{
// In an NLL query, there should be no type variables in the
// query, only region variables.
debug_assert!
(
query_res
ult
.variables
.iter
()
.all
(|
v
|
match
v
.kind
{
debug_assert!
(
query_res
ponse
.variables
.iter
()
.all
(|
v
|
match
v
.kind
{
CanonicalVarKind
::
Ty
(
_
)
=>
false
,
CanonicalVarKind
::
Region
=>
true
,
}));
let
result_subst
=
self
.query_res
ult_substitution_guess
(
cause
,
original_values
,
query_result
);
self
.query_res
ponse_substitution_guess
(
cause
,
original_values
,
query_response
);
// Compute `QueryRegionConstraint` values that unify each of
// the original values `v_o` that was canonicalized into a
...
...
@@ -274,7 +274,7 @@ pub fn instantiate_nll_query_result_and_region_obligations<R>(
for
(
index
,
original_value
)
in
original_values
.iter
()
.enumerate
()
{
// ...with the value `v_r` of that variable from the query.
let
result_value
=
query_res
ult
.substitute_projected
(
self
.tcx
,
&
result_subst
,
|
v
|
{
let
result_value
=
query_res
ponse
.substitute_projected
(
self
.tcx
,
&
result_subst
,
|
v
|
{
&
v
.var_values
[
CanonicalVar
::
new
(
index
)]
});
match
(
original_value
.unpack
(),
result_value
.unpack
())
{
...
...
@@ -309,7 +309,7 @@ pub fn instantiate_nll_query_result_and_region_obligations<R>(
// ...also include the other query region constraints from the query.
output_query_region_constraints
.extend
(
query_res
ult
.value.region_constraints
.iter
()
.filter_map
(|
r_c
|
{
query_res
ponse
.value.region_constraints
.iter
()
.filter_map
(|
r_c
|
{
let
&
ty
::
OutlivesPredicate
(
k1
,
r2
)
=
r_c
.skip_binder
();
// reconstructed below
let
k1
=
substitute_value
(
self
.tcx
,
&
result_subst
,
&
k1
);
let
r2
=
substitute_value
(
self
.tcx
,
&
result_subst
,
&
r2
);
...
...
@@ -322,7 +322,7 @@ pub fn instantiate_nll_query_result_and_region_obligations<R>(
);
let
user_result
:
R
=
query_res
ult
.substitute_projected
(
self
.tcx
,
&
result_subst
,
|
q_r
|
&
q_r
.value
);
query_res
ponse
.substitute_projected
(
self
.tcx
,
&
result_subst
,
|
q_r
|
&
q_r
.value
);
Ok
(
InferOk
{
value
:
user_result
,
...
...
@@ -340,30 +340,30 @@ pub fn instantiate_nll_query_result_and_region_obligations<R>(
/// example) we are doing lazy normalization and the value
/// assigned to a type variable is unified with an unnormalized
/// projection.
fn
query_res
ult
_substitution
<
R
>
(
fn
query_res
ponse
_substitution
<
R
>
(
&
self
,
cause
:
&
ObligationCause
<
'tcx
>
,
param_env
:
ty
::
ParamEnv
<
'tcx
>
,
original_values
:
&
SmallCanonicalVarValues
<
'tcx
>
,
query_res
ult
:
&
Canonical
<
'tcx
,
QueryResult
<
'tcx
,
R
>>
,
query_res
ponse
:
&
Canonical
<
'tcx
,
QueryResponse
<
'tcx
,
R
>>
,
)
->
InferResult
<
'tcx
,
CanonicalVarValues
<
'tcx
>>
where
R
:
Debug
+
TypeFoldable
<
'tcx
>
,
{
debug!
(
"query_res
ult_substitution(original_values={:#?}, query_result
={:#?})"
,
original_values
,
query_res
ult
,
"query_res
ponse_substitution(original_values={:#?}, query_response
={:#?})"
,
original_values
,
query_res
ponse
,
);
let
result_subst
=
self
.query_res
ult_substitution_guess
(
cause
,
original_values
,
query_result
);
self
.query_res
ponse_substitution_guess
(
cause
,
original_values
,
query_response
);
let
obligations
=
self
.unify_query_res
ult
_substitution_guess
(
let
obligations
=
self
.unify_query_res
ponse
_substitution_guess
(
cause
,
param_env
,
original_values
,
&
result_subst
,
query_res
ult
,
query_res
ponse
,
)
?
.into_obligations
();
...
...
@@ -382,25 +382,25 @@ fn query_result_substitution<R>(
/// will instantiate fresh inference variables for each canonical
/// variable instead. Therefore, the result of this method must be
/// properly unified
fn
query_res
ult
_substitution_guess
<
R
>
(
fn
query_res
ponse
_substitution_guess
<
R
>
(
&
self
,
cause
:
&
ObligationCause
<
'tcx
>
,
original_values
:
&
SmallCanonicalVarValues
<
'tcx
>
,
query_res
ult
:
&
Canonical
<
'tcx
,
QueryResult
<
'tcx
,
R
>>
,
query_res
ponse
:
&
Canonical
<
'tcx
,
QueryResponse
<
'tcx
,
R
>>
,
)
->
CanonicalVarValues
<
'tcx
>
where
R
:
Debug
+
TypeFoldable
<
'tcx
>
,
{
debug!
(
"query_res
ult_substitution_guess(original_values={:#?}, query_result
={:#?})"
,
original_values
,
query_res
ult
,
"query_res
ponse_substitution_guess(original_values={:#?}, query_response
={:#?})"
,
original_values
,
query_res
ponse
,
);
// Every canonical query result includes values for each of
// the inputs to the query. Therefore, we begin by unifying
// these values with the original inputs that were
// canonicalized.
let
result_values
=
&
query_res
ult
.value.var_values
;
let
result_values
=
&
query_res
ponse
.value.var_values
;
assert_eq!
(
original_values
.len
(),
result_values
.len
());
// Quickly try to find initial values for the canonical
...
...
@@ -411,7 +411,7 @@ fn query_result_substitution_guess<R>(
// result, then we can type the corresponding value from the
// input. See the example above.
let
mut
opt_values
:
IndexVec
<
CanonicalVar
,
Option
<
Kind
<
'tcx
>>>
=
IndexVec
::
from_elem_n
(
None
,
query_res
ult
.variables
.len
());
IndexVec
::
from_elem_n
(
None
,
query_res
ponse
.variables
.len
());
// In terms of our example above, we are iterating over pairs like:
// [(?A, Vec<?0>), ('static, '?1), (?B, ?0)]
...
...
@@ -438,7 +438,7 @@ fn query_result_substitution_guess<R>(
// given variable in the loop above, use that. Otherwise, use
// a fresh inference variable.
let
result_subst
=
CanonicalVarValues
{
var_values
:
query_res
ult
var_values
:
query_res
ponse
.variables
.iter
()
.enumerate
()
...
...
@@ -456,29 +456,29 @@ fn query_result_substitution_guess<R>(
/// query result. Often, but not always, this is a no-op, because
/// we already found the mapping in the "guessing" step.
///
/// See also: `query_res
ult
_substitution_guess`
fn
unify_query_res
ult
_substitution_guess
<
R
>
(
/// See also: `query_res
ponse
_substitution_guess`
fn
unify_query_res
ponse
_substitution_guess
<
R
>
(
&
self
,
cause
:
&
ObligationCause
<
'tcx
>
,
param_env
:
ty
::
ParamEnv
<
'tcx
>
,
original_values
:
&
SmallCanonicalVarValues
<
'tcx
>
,
result_subst
:
&
CanonicalVarValues
<
'tcx
>
,
query_res
ult
:
&
Canonical
<
'tcx
,
QueryResult
<
'tcx
,
R
>>
,
query_res
ponse
:
&
Canonical
<
'tcx
,
QueryResponse
<
'tcx
,
R
>>
,
)
->
InferResult
<
'tcx
,
()
>
where
R
:
Debug
+
TypeFoldable
<
'tcx
>
,
{
// A closure that yields the result value for the given
// canonical variable; this is taken from
// `query_res
ult
.var_values` after applying the substitution
// `query_res
ponse
.var_values` after applying the substitution
// `result_subst`.
let
substituted_query_res
ult
=
|
index
:
CanonicalVar
|
->
Kind
<
'tcx
>
{
query_res
ult
.substitute_projected
(
self
.tcx
,
&
result_subst
,
|
v
|
&
v
.var_values
[
index
])
let
substituted_query_res
ponse
=
|
index
:
CanonicalVar
|
->
Kind
<
'tcx
>
{
query_res
ponse
.substitute_projected
(
self
.tcx
,
&
result_subst
,
|
v
|
&
v
.var_values
[
index
])
};
// Unify the original value for each variable with the value
// taken from `query_res
ult
` (after applying `result_subst`).
Ok
(
self
.unify_canonical_vars
(
cause
,
param_env
,
original_values
,
substituted_query_res
ult
)
?
)
// taken from `query_res
ponse
` (after applying `result_subst`).
Ok
(
self
.unify_canonical_vars
(
cause
,
param_env
,
original_values
,
substituted_query_res
ponse
)
?
)
}
/// Converts the region constraints resulting from a query into an
...
...
src/librustc/traits/query/dropck_outlives.rs
浏览文件 @
bca294da
...
...
@@ -58,7 +58,7 @@ pub fn dropck_outlives(&self, ty: Ty<'tcx>) -> InferOk<'tcx, Vec<Kind<'tcx>>> {
match
&
gcx
.dropck_outlives
(
c_ty
)
{
Ok
(
result
)
if
result
.is_proven
()
=>
{
if
let
Ok
(
InferOk
{
value
,
obligations
})
=
self
.infcx
.instantiate_query_res
ult
_and_region_obligations
(
self
.infcx
.instantiate_query_res
ponse
_and_region_obligations
(
self
.cause
,
self
.param_env
,
&
orig_values
,
...
...
src/librustc/traits/query/normalize.rs
浏览文件 @
bca294da
...
...
@@ -167,7 +167,7 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
return
ty
;
}
match
self
.infcx
.instantiate_query_res
ult
_and_region_obligations
(
match
self
.infcx
.instantiate_query_res
ponse
_and_region_obligations
(
self
.cause
,
self
.param_env
,
&
orig_values
,
...
...
src/librustc/traits/query/outlives_bounds.rs
浏览文件 @
bca294da
...
...
@@ -119,7 +119,7 @@ pub fn implied_outlives_bounds(
};
assert
!
(
result
.value
.is_proven
());
let
result
=
self
.instantiate_query_res
ult
_and_region_obligations
(
let
result
=
self
.instantiate_query_res
ponse
_and_region_obligations
(
&
ObligationCause
::
misc
(
span
,
body_id
),
param_env
,
&
orig_values
,
&
result
);
debug!
(
"implied_outlives_bounds for {:?}: {:#?}"
,
ty
,
result
);
let
result
=
match
result
{
...
...
src/librustc/traits/query/type_op/custom.rs
浏览文件 @
bca294da
...
...
@@ -12,7 +12,7 @@
use
std
::
fmt
;
use
traits
::
query
::
Fallible
;
use
infer
::
canonical
::
query_res
ult
;
use
infer
::
canonical
::
query_res
ponse
;
use
infer
::
canonical
::
QueryRegionConstraint
;
use
std
::
rc
::
Rc
;
use
syntax
::
source_map
::
DUMMY_SP
;
...
...
@@ -102,7 +102,7 @@ fn scrape_region_constraints<'gcx, 'tcx, R>(
let
region_constraint_data
=
infcx
.take_and_reset_region_constraints
();
let
outlives
=
query_res
ult
::
make_query_outlives
(
let
outlives
=
query_res
ponse
::
make_query_outlives
(
infcx
.tcx
,
region_obligations
.iter
()
...
...
src/librustc/traits/query/type_op/eq.rs
浏览文件 @
bca294da
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ult
,
QueryResult
};
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ponse
,
QueryResponse
};
use
traits
::
query
::
Fallible
;
use
ty
::{
ParamEnvAnd
,
Ty
,
TyCtxt
};
...
...
@@ -25,12 +25,12 @@ pub fn new(a: Ty<'tcx>, b: Ty<'tcx>) -> Self {
}
impl
<
'gcx
:
'tcx
,
'tcx
>
super
::
QueryTypeOp
<
'gcx
,
'tcx
>
for
Eq
<
'tcx
>
{
type
QueryRes
ult
=
();
type
QueryRes
ponse
=
();
fn
try_fast_path
(
_
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
key
:
&
ParamEnvAnd
<
'tcx
,
Eq
<
'tcx
>>
,
)
->
Option
<
Self
::
QueryRes
ult
>
{
)
->
Option
<
Self
::
QueryRes
ponse
>
{
if
key
.value.a
==
key
.value.b
{
Some
(())
}
else
{
...
...
@@ -41,13 +41,13 @@ fn try_fast_path(
fn
perform_query
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Self
>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
()
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
()
>>
{
tcx
.type_op_eq
(
canonicalized
)
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
()
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
()
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
()
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
()
>>
{
v
}
}
...
...
src/librustc/traits/query/type_op/implied_outlives_bounds.rs
浏览文件 @
bca294da
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ult
,
QueryResult
};
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ponse
,
QueryResponse
};
use
traits
::
query
::
outlives_bounds
::
OutlivesBound
;
use
traits
::
query
::
Fallible
;
use
ty
::{
ParamEnvAnd
,
Ty
,
TyCtxt
};
...
...
@@ -25,19 +25,19 @@ pub fn new(ty: Ty<'tcx>) -> Self {
}
impl
<
'gcx
:
'tcx
,
'tcx
>
super
::
QueryTypeOp
<
'gcx
,
'tcx
>
for
ImpliedOutlivesBounds
<
'tcx
>
{
type
QueryRes
ult
=
Vec
<
OutlivesBound
<
'tcx
>>
;
type
QueryRes
ponse
=
Vec
<
OutlivesBound
<
'tcx
>>
;
fn
try_fast_path
(
_
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
_
key
:
&
ParamEnvAnd
<
'tcx
,
Self
>
,
)
->
Option
<
Self
::
QueryRes
ult
>
{
)
->
Option
<
Self
::
QueryRes
ponse
>
{
None
}
fn
perform_query
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Self
>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
::
QueryResult
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
::
QueryResponse
>>
{
// FIXME the query should take a `ImpliedOutlivesBounds`
let
Canonical
{
variables
,
...
...
@@ -56,8 +56,8 @@ fn perform_query(
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
Self
::
QueryResult
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Self
::
QueryResult
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
::
QueryResponse
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Self
::
QueryResponse
>>
{
v
}
}
...
...
src/librustc/traits/query/type_op/mod.rs
浏览文件 @
bca294da
...
...
@@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ult
,
QueryRegionConstraint
,
QueryRes
ult
};
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ponse
,
QueryRegionConstraint
,
QueryRes
ponse
};
use
infer
::{
InferCtxt
,
InferOk
};
use
smallvec
::
SmallVec
;
use
std
::
fmt
;
...
...
@@ -55,7 +55,7 @@ fn fully_perform(
pub
trait
QueryTypeOp
<
'gcx
:
'tcx
,
'tcx
>
:
fmt
::
Debug
+
Sized
+
TypeFoldable
<
'tcx
>
+
Lift
<
'gcx
>
{
type
QueryRes
ult
:
TypeFoldable
<
'tcx
>
+
Lift
<
'gcx
>
;
type
QueryRes
ponse
:
TypeFoldable
<
'tcx
>
+
Lift
<
'gcx
>
;
/// Give query the option for a simple fast path that never
/// actually hits the tcx cache lookup etc. Return `Some(r)` with
...
...
@@ -63,7 +63,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>:
fn
try_fast_path
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
key
:
&
ParamEnvAnd
<
'tcx
,
Self
>
,
)
->
Option
<
Self
::
QueryRes
ult
>
;
)
->
Option
<
Self
::
QueryRes
ponse
>
;
/// Performs the actual query with the canonicalized key -- the
/// real work happens here. This method is not given an `infcx`
...
...
@@ -74,29 +74,29 @@ fn try_fast_path(
fn
perform_query
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Self
>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
::
QueryResult
>>
;
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
::
QueryResponse
>>
;
/// Casts a lifted query result (which is in the gcx lifetime)
/// into the tcx lifetime. This is always just an identity cast,
/// but the generic code doesn't realize it -- put another way, in
/// the generic code, we have a `Lifted<'gcx, Self::QueryRes
ult
>`
/// and we want to convert that to a `Self::QueryRes
ult
`. This is
/// the generic code, we have a `Lifted<'gcx, Self::QueryRes
ponse
>`
/// and we want to convert that to a `Self::QueryRes
ponse
`. This is
/// not a priori valid, so we can't do it -- but in practice, it
/// is always a no-op (e.g., the lifted form of a type,
/// `Ty<'gcx>`, is a subtype of `Ty<'tcx>`). So we have to push
/// the operation into the impls that know more specifically what
/// `QueryRes
ult
` is. This operation would (maybe) be nicer with
/// `QueryRes
ponse
` is. This operation would (maybe) be nicer with
/// something like HKTs or GATs, since then we could make
/// `QueryRes
ult
` parametric and `'gcx` and `'tcx` etc.
/// `QueryRes
ponse
` parametric and `'gcx` and `'tcx` etc.
fn
shrink_to_tcx_lifetime
(
lifted_query_result
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
Self
::
QueryResult
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Self
::
QueryResult
>>
;
lifted_query_result
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
::
QueryResponse
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Self
::
QueryResponse
>>
;
fn
fully_perform_into
(
query_key
:
ParamEnvAnd
<
'tcx
,
Self
>
,
infcx
:
&
InferCtxt
<
'_
,
'gcx
,
'tcx
>
,
output_query_region_constraints
:
&
mut
Vec
<
QueryRegionConstraint
<
'tcx
>>
,
)
->
Fallible
<
Self
::
QueryRes
ult
>
{
)
->
Fallible
<
Self
::
QueryRes
ponse
>
{
if
let
Some
(
result
)
=
QueryTypeOp
::
try_fast_path
(
infcx
.tcx
,
&
query_key
)
{
return
Ok
(
result
);
}
...
...
@@ -114,7 +114,7 @@ fn fully_perform_into(
let
param_env
=
query_key
.param_env
;
let
InferOk
{
value
,
obligations
}
=
infcx
.instantiate_nll_query_res
ult
_and_region_obligations
(
.instantiate_nll_query_res
ponse
_and_region_obligations
(
&
ObligationCause
::
dummy
(),
param_env
,
&
canonical_var_values
,
...
...
@@ -145,7 +145,7 @@ impl<'gcx: 'tcx, 'tcx, Q> TypeOp<'gcx, 'tcx> for ParamEnvAnd<'tcx, Q>
where
Q
:
QueryTypeOp
<
'gcx
,
'tcx
>
,
{
type
Output
=
Q
::
QueryRes
ult
;
type
Output
=
Q
::
QueryRes
ponse
;
fn
fully_perform
(
self
,
...
...
src/librustc/traits/query/type_op/normalize.rs
浏览文件 @
bca294da
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ult
,
QueryResult
};
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ponse
,
QueryResponse
};
use
std
::
fmt
;
use
traits
::
query
::
Fallible
;
use
ty
::
fold
::
TypeFoldable
;
...
...
@@ -32,7 +32,7 @@ impl<'gcx: 'tcx, 'tcx, T> super::QueryTypeOp<'gcx, 'tcx> for Normalize<T>
where
T
:
Normalizable
<
'gcx
,
'tcx
>
,
{
type
QueryRes
ult
=
T
;
type
QueryRes
ponse
=
T
;
fn
try_fast_path
(
_
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
key
:
&
ParamEnvAnd
<
'tcx
,
Self
>
)
->
Option
<
T
>
{
if
!
key
.value.value
.has_projections
()
{
...
...
@@ -45,13 +45,13 @@ fn try_fast_path(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) ->
fn
perform_query
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Self
>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
::
QueryResult
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
::
QueryResponse
>>
{
T
::
type_op_method
(
tcx
,
canonicalized
)
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
T
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
T
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
T
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
T
>>
{
T
::
shrink_to_tcx_lifetime
(
v
)
}
}
...
...
@@ -60,13 +60,13 @@ pub trait Normalizable<'gcx, 'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'gcx>
fn
type_op_method
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
Self
>>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>>
;
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>>
;
/// Convert from the `'gcx` (lifted) form of `Self` into the `tcx`
/// form of `Self`.
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Self
>>
;
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Self
>>
;
}
impl
Normalizable
<
'gcx
,
'tcx
>
for
Ty
<
'tcx
>
...
...
@@ -76,13 +76,13 @@ impl Normalizable<'gcx, 'tcx> for Ty<'tcx>
fn
type_op_method
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
Self
>>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>>
{
tcx
.type_op_normalize_ty
(
canonicalized
)
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Self
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Self
>>
{
v
}
}
...
...
@@ -94,13 +94,13 @@ impl Normalizable<'gcx, 'tcx> for ty::Predicate<'tcx>
fn
type_op_method
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
Self
>>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>>
{
tcx
.type_op_normalize_predicate
(
canonicalized
)
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Self
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Self
>>
{
v
}
}
...
...
@@ -112,13 +112,13 @@ impl Normalizable<'gcx, 'tcx> for ty::PolyFnSig<'tcx>
fn
type_op_method
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
Self
>>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>>
{
tcx
.type_op_normalize_poly_fn_sig
(
canonicalized
)
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Self
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Self
>>
{
v
}
}
...
...
@@ -130,13 +130,13 @@ impl Normalizable<'gcx, 'tcx> for ty::FnSig<'tcx>
fn
type_op_method
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
Self
>>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>>
{
tcx
.type_op_normalize_fn_sig
(
canonicalized
)
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Self
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Self
>>
{
v
}
}
...
...
src/librustc/traits/query/type_op/outlives.rs
浏览文件 @
bca294da
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ult
,
QueryResult
};
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ponse
,
QueryResponse
};
use
traits
::
query
::
dropck_outlives
::
trivial_dropck_outlives
;
use
traits
::
query
::
dropck_outlives
::
DropckOutlivesResult
;
use
traits
::
query
::
Fallible
;
...
...
@@ -29,12 +29,12 @@ impl super::QueryTypeOp<'gcx, 'tcx> for DropckOutlives<'tcx>
where
'gcx
:
'tcx
,
{
type
QueryRes
ult
=
DropckOutlivesResult
<
'tcx
>
;
type
QueryRes
ponse
=
DropckOutlivesResult
<
'tcx
>
;
fn
try_fast_path
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
key
:
&
ParamEnvAnd
<
'tcx
,
Self
>
,
)
->
Option
<
Self
::
QueryRes
ult
>
{
)
->
Option
<
Self
::
QueryRes
ponse
>
{
if
trivial_dropck_outlives
(
tcx
,
key
.value.dropped_ty
)
{
Some
(
DropckOutlivesResult
::
default
())
}
else
{
...
...
@@ -45,7 +45,7 @@ fn try_fast_path(
fn
perform_query
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Self
>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
Self
::
QueryResult
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
::
QueryResponse
>>
{
// Subtle: note that we are not invoking
// `infcx.at(...).dropck_outlives(...)` here, but rather the
// underlying `dropck_outlives` query. This same underlying
...
...
@@ -76,8 +76,8 @@ fn perform_query(
}
fn
shrink_to_tcx_lifetime
(
lifted_query_result
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
Self
::
QueryResult
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Self
::
QueryResult
>>
{
lifted_query_result
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
Self
::
QueryResponse
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Self
::
QueryResponse
>>
{
lifted_query_result
}
}
...
...
src/librustc/traits/query/type_op/prove_predicate.rs
浏览文件 @
bca294da
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ult
,
QueryResult
};
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ponse
,
QueryResponse
};
use
traits
::
query
::
Fallible
;
use
ty
::{
ParamEnvAnd
,
Predicate
,
TyCtxt
};
...
...
@@ -24,12 +24,12 @@ pub fn new(predicate: Predicate<'tcx>) -> Self {
}
impl
<
'gcx
:
'tcx
,
'tcx
>
super
::
QueryTypeOp
<
'gcx
,
'tcx
>
for
ProvePredicate
<
'tcx
>
{
type
QueryRes
ult
=
();
type
QueryRes
ponse
=
();
fn
try_fast_path
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
key
:
&
ParamEnvAnd
<
'tcx
,
Self
>
,
)
->
Option
<
Self
::
QueryRes
ult
>
{
)
->
Option
<
Self
::
QueryRes
ponse
>
{
// Proving Sized, very often on "obviously sized" types like
// `&T`, accounts for about 60% percentage of the predicates
// we have to prove. No need to canonicalize and all that for
...
...
@@ -50,13 +50,13 @@ fn try_fast_path(
fn
perform_query
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Self
>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
()
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
()
>>
{
tcx
.type_op_prove_predicate
(
canonicalized
)
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
()
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
()
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
()
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
()
>>
{
v
}
}
...
...
src/librustc/traits/query/type_op/subtype.rs
浏览文件 @
bca294da
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ult
,
QueryResult
};
use
infer
::
canonical
::{
Canonical
,
Canonicalized
,
CanonicalizedQueryRes
ponse
,
QueryResponse
};
use
traits
::
query
::
Fallible
;
use
ty
::{
ParamEnvAnd
,
Ty
,
TyCtxt
};
...
...
@@ -28,7 +28,7 @@ pub fn new(sub: Ty<'tcx>, sup: Ty<'tcx>) -> Self {
}
impl
<
'gcx
:
'tcx
,
'tcx
>
super
::
QueryTypeOp
<
'gcx
,
'tcx
>
for
Subtype
<
'tcx
>
{
type
QueryRes
ult
=
();
type
QueryRes
ponse
=
();
fn
try_fast_path
(
_
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
key
:
&
ParamEnvAnd
<
'tcx
,
Self
>
)
->
Option
<
()
>
{
if
key
.value.sub
==
key
.value.sup
{
...
...
@@ -41,13 +41,13 @@ fn try_fast_path(_tcx: TyCtxt<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) ->
fn
perform_query
(
tcx
:
TyCtxt
<
'_
,
'gcx
,
'tcx
>
,
canonicalized
:
Canonicalized
<
'gcx
,
ParamEnvAnd
<
'tcx
,
Self
>>
,
)
->
Fallible
<
CanonicalizedQueryRes
ult
<
'gcx
,
()
>>
{
)
->
Fallible
<
CanonicalizedQueryRes
ponse
<
'gcx
,
()
>>
{
tcx
.type_op_subtype
(
canonicalized
)
}
fn
shrink_to_tcx_lifetime
(
v
:
&
'a
CanonicalizedQueryRes
ult
<
'gcx
,
()
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
()
>>
{
v
:
&
'a
CanonicalizedQueryRes
ponse
<
'gcx
,
()
>
,
)
->
&
'a
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
()
>>
{
v
}
}
...
...
src/librustc/ty/query/mod.rs
浏览文件 @
bca294da
...
...
@@ -559,7 +559,7 @@
[]
fn
normalize_projection_ty
:
NormalizeProjectionTy
(
CanonicalProjectionGoal
<
'tcx
>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
NormalizationResult
<
'tcx
>>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
NormalizationResult
<
'tcx
>>>>
,
NoSolution
,
>
,
...
...
@@ -571,7 +571,7 @@
[]
fn
implied_outlives_bounds
:
ImpliedOutlivesBounds
(
CanonicalTyGoal
<
'tcx
>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
Vec
<
OutlivesBound
<
'tcx
>>>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
Vec
<
OutlivesBound
<
'tcx
>>>>>
,
NoSolution
,
>
,
...
...
@@ -579,7 +579,7 @@
[]
fn
dropck_outlives
:
DropckOutlives
(
CanonicalTyGoal
<
'tcx
>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
DropckOutlivesResult
<
'tcx
>>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
DropckOutlivesResult
<
'tcx
>>>>
,
NoSolution
,
>
,
...
...
@@ -593,7 +593,7 @@
[]
fn
type_op_eq
:
TypeOpEq
(
CanonicalTypeOpEqGoal
<
'tcx
>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
()
>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
()
>>>
,
NoSolution
,
>
,
...
...
@@ -601,7 +601,7 @@
[]
fn
type_op_subtype
:
TypeOpSubtype
(
CanonicalTypeOpSubtypeGoal
<
'tcx
>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
()
>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
()
>>>
,
NoSolution
,
>
,
...
...
@@ -609,7 +609,7 @@
[]
fn
type_op_prove_predicate
:
TypeOpProvePredicate
(
CanonicalTypeOpProvePredicateGoal
<
'tcx
>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
()
>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
()
>>>
,
NoSolution
,
>
,
...
...
@@ -617,7 +617,7 @@
[]
fn
type_op_normalize_ty
:
TypeOpNormalizeTy
(
CanonicalTypeOpNormalizeGoal
<
'tcx
,
Ty
<
'tcx
>>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
Ty
<
'tcx
>>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
Ty
<
'tcx
>>>>
,
NoSolution
,
>
,
...
...
@@ -625,7 +625,7 @@
[]
fn
type_op_normalize_predicate
:
TypeOpNormalizePredicate
(
CanonicalTypeOpNormalizeGoal
<
'tcx
,
ty
::
Predicate
<
'tcx
>>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
ty
::
Predicate
<
'tcx
>>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
ty
::
Predicate
<
'tcx
>>>>
,
NoSolution
,
>
,
...
...
@@ -633,7 +633,7 @@
[]
fn
type_op_normalize_poly_fn_sig
:
TypeOpNormalizePolyFnSig
(
CanonicalTypeOpNormalizeGoal
<
'tcx
,
ty
::
PolyFnSig
<
'tcx
>>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
ty
::
PolyFnSig
<
'tcx
>>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
ty
::
PolyFnSig
<
'tcx
>>>>
,
NoSolution
,
>
,
...
...
@@ -641,7 +641,7 @@
[]
fn
type_op_normalize_fn_sig
:
TypeOpNormalizeFnSig
(
CanonicalTypeOpNormalizeGoal
<
'tcx
,
ty
::
FnSig
<
'tcx
>>
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
ty
::
FnSig
<
'tcx
>>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
ty
::
FnSig
<
'tcx
>>>>
,
NoSolution
,
>
,
...
...
src/librustc_traits/chalk_context.rs
浏览文件 @
bca294da
...
...
@@ -10,7 +10,7 @@
use
chalk_engine
::
fallible
::
Fallible
as
ChalkEngineFallible
;
use
chalk_engine
::{
context
,
hh
::
HhGoal
,
DelayedLiteral
,
ExClause
};
use
rustc
::
infer
::
canonical
::{
Canonical
,
CanonicalVarValues
,
QueryRegionConstraint
,
QueryRes
ult
};
use
rustc
::
infer
::
canonical
::{
Canonical
,
CanonicalVarValues
,
QueryRegionConstraint
,
QueryRes
ponse
};
use
rustc
::
infer
::{
InferCtxt
,
InferOk
,
LateBoundRegionConversionTime
};
use
rustc
::
traits
::{
WellFormed
,
...
...
@@ -77,7 +77,7 @@ impl context::Context for ChalkArenas<'tcx> {
// u-canonicalization not yet implemented
type
UniverseMap
=
UniverseMap
;
type
Solution
=
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
()
>>
;
type
Solution
=
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
()
>>
;
type
InferenceNormalizedSubst
=
CanonicalVarValues
<
'tcx
>
;
...
...
@@ -116,7 +116,7 @@ fn make_solution(
&
self
,
_
root_goal
:
&
Canonical
<
'gcx
,
ty
::
ParamEnvAnd
<
'gcx
,
Goal
<
'gcx
>>>
,
_
simplified_answers
:
impl
context
::
AnswerStream
<
ChalkArenas
<
'gcx
>>
,
)
->
Option
<
Canonical
<
'gcx
,
QueryRes
ult
<
'gcx
,
()
>>>
{
)
->
Option
<
Canonical
<
'gcx
,
QueryRes
ponse
<
'gcx
,
()
>>>
{
unimplemented!
()
}
}
...
...
src/librustc_traits/dropck_outlives.rs
浏览文件 @
bca294da
...
...
@@ -9,7 +9,7 @@
// except according to those terms.
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
infer
::
canonical
::{
Canonical
,
QueryRes
ult
};
use
rustc
::
infer
::
canonical
::{
Canonical
,
QueryRes
ponse
};
use
rustc
::
traits
::
query
::
dropck_outlives
::{
DropckOutlivesResult
,
DtorckConstraint
};
use
rustc
::
traits
::
query
::{
CanonicalTyGoal
,
NoSolution
};
use
rustc
::
traits
::{
FulfillmentContext
,
Normalized
,
ObligationCause
,
TraitEngineExt
};
...
...
@@ -31,7 +31,7 @@
fn
dropck_outlives
<
'tcx
>
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
canonical_goal
:
CanonicalTyGoal
<
'tcx
>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
DropckOutlivesResult
<
'tcx
>>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
DropckOutlivesResult
<
'tcx
>>>>
,
NoSolution
>
{
debug!
(
"dropck_outlives(goal={:#?})"
,
canonical_goal
);
tcx
.infer_ctxt
()
.enter_with_canonical
(
DUMMY_SP
,
&
canonical_goal
,
|
ref
infcx
,
goal
,
canonical_inference_vars
|
{
...
...
@@ -143,7 +143,7 @@ fn dropck_outlives<'tcx>(
debug!
(
"dropck_outlives: result = {:#?}"
,
result
);
infcx
.make_canonicalized_query_res
ult
(
canonical_inference_vars
,
result
,
fulfill_cx
)
infcx
.make_canonicalized_query_res
ponse
(
canonical_inference_vars
,
result
,
fulfill_cx
)
})
}
...
...
src/librustc_traits/implied_outlives_bounds.rs
浏览文件 @
bca294da
...
...
@@ -37,7 +37,7 @@ fn implied_outlives_bounds<'tcx>(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
goal
:
CanonicalTyGoal
<
'tcx
>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ult
<
'tcx
,
Vec
<
OutlivesBound
<
'tcx
>>>>>
,
Lrc
<
Canonical
<
'tcx
,
canonical
::
QueryRes
ponse
<
'tcx
,
Vec
<
OutlivesBound
<
'tcx
>>>>>
,
NoSolution
,
>
{
tcx
.infer_ctxt
()
...
...
src/librustc_traits/normalize_projection_ty.rs
浏览文件 @
bca294da
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
rustc
::
infer
::
canonical
::{
Canonical
,
QueryRes
ult
};
use
rustc
::
infer
::
canonical
::{
Canonical
,
QueryRes
ponse
};
use
rustc
::
traits
::
query
::{
normalize
::
NormalizationResult
,
CanonicalProjectionGoal
,
NoSolution
};
use
rustc
::
traits
::{
self
,
ObligationCause
,
SelectionContext
,
TraitEngineExt
};
use
rustc
::
ty
::
query
::
Providers
;
...
...
@@ -28,7 +28,7 @@
fn
normalize_projection_ty
<
'tcx
>
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
goal
:
CanonicalProjectionGoal
<
'tcx
>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
NormalizationResult
<
'tcx
>>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
NormalizationResult
<
'tcx
>>>>
,
NoSolution
>
{
debug!
(
"normalize_provider(goal={:#?})"
,
goal
);
tcx
.sess
...
...
src/librustc_traits/type_op.rs
浏览文件 @
bca294da
...
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use
rustc
::
infer
::
canonical
::{
Canonical
,
QueryRes
ult
};
use
rustc
::
infer
::
canonical
::{
Canonical
,
QueryRes
ponse
};
use
rustc
::
infer
::
InferCtxt
;
use
rustc
::
traits
::
query
::
type_op
::
eq
::
Eq
;
use
rustc
::
traits
::
query
::
type_op
::
normalize
::
Normalize
;
...
...
@@ -38,7 +38,7 @@
fn
type_op_eq
<
'tcx
>
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
canonicalized
:
Canonical
<
'tcx
,
ParamEnvAnd
<
'tcx
,
Eq
<
'tcx
>>>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
()
>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
()
>>>
,
NoSolution
>
{
tcx
.infer_ctxt
()
.enter_canonical_trait_query
(
&
canonicalized
,
|
infcx
,
fulfill_cx
,
key
|
{
let
(
param_env
,
Eq
{
a
,
b
})
=
key
.into_parts
();
...
...
@@ -68,7 +68,7 @@ fn type_op_normalize<T>(
fn
type_op_normalize_ty
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
canonicalized
:
Canonical
<
'tcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
Ty
<
'tcx
>>>>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Ty
<
'tcx
>>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Ty
<
'tcx
>>>>
,
NoSolution
>
{
tcx
.infer_ctxt
()
.enter_canonical_trait_query
(
&
canonicalized
,
type_op_normalize
)
}
...
...
@@ -76,7 +76,7 @@ fn type_op_normalize_ty(
fn
type_op_normalize_predicate
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
canonicalized
:
Canonical
<
'tcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
Predicate
<
'tcx
>>>>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
Predicate
<
'tcx
>>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
Predicate
<
'tcx
>>>>
,
NoSolution
>
{
tcx
.infer_ctxt
()
.enter_canonical_trait_query
(
&
canonicalized
,
type_op_normalize
)
}
...
...
@@ -84,7 +84,7 @@ fn type_op_normalize_predicate(
fn
type_op_normalize_fn_sig
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
canonicalized
:
Canonical
<
'tcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
FnSig
<
'tcx
>>>>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
FnSig
<
'tcx
>>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
FnSig
<
'tcx
>>>>
,
NoSolution
>
{
tcx
.infer_ctxt
()
.enter_canonical_trait_query
(
&
canonicalized
,
type_op_normalize
)
}
...
...
@@ -92,7 +92,7 @@ fn type_op_normalize_fn_sig(
fn
type_op_normalize_poly_fn_sig
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
canonicalized
:
Canonical
<
'tcx
,
ParamEnvAnd
<
'tcx
,
Normalize
<
PolyFnSig
<
'tcx
>>>>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
PolyFnSig
<
'tcx
>>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
PolyFnSig
<
'tcx
>>>>
,
NoSolution
>
{
tcx
.infer_ctxt
()
.enter_canonical_trait_query
(
&
canonicalized
,
type_op_normalize
)
}
...
...
@@ -100,7 +100,7 @@ fn type_op_normalize_poly_fn_sig(
fn
type_op_subtype
<
'tcx
>
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
canonicalized
:
Canonical
<
'tcx
,
ParamEnvAnd
<
'tcx
,
Subtype
<
'tcx
>>>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
()
>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
()
>>>
,
NoSolution
>
{
tcx
.infer_ctxt
()
.enter_canonical_trait_query
(
&
canonicalized
,
|
infcx
,
fulfill_cx
,
key
|
{
let
(
param_env
,
Subtype
{
sub
,
sup
})
=
key
.into_parts
();
...
...
@@ -114,7 +114,7 @@ fn type_op_subtype<'tcx>(
fn
type_op_prove_predicate
<
'tcx
>
(
tcx
:
TyCtxt
<
'_
,
'tcx
,
'tcx
>
,
canonicalized
:
Canonical
<
'tcx
,
ParamEnvAnd
<
'tcx
,
ProvePredicate
<
'tcx
>>>
,
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ult
<
'tcx
,
()
>>>
,
NoSolution
>
{
)
->
Result
<
Lrc
<
Canonical
<
'tcx
,
QueryRes
ponse
<
'tcx
,
()
>>>
,
NoSolution
>
{
tcx
.infer_ctxt
()
.enter_canonical_trait_query
(
&
canonicalized
,
|
infcx
,
fulfill_cx
,
key
|
{
let
(
param_env
,
ProvePredicate
{
predicate
})
=
key
.into_parts
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录