Rustfmt
This commit is contained in:
parent
3183b44a1e
commit
1fcae03369
287 changed files with 5888 additions and 4608 deletions
|
@ -514,10 +514,11 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<I:
|
|||
// will project to the right upvars for the generator, appending the inputs and
|
||||
// coroutine upvars respecting the closure kind.
|
||||
nested.push(
|
||||
ty::TraitRef::new(cx, async_fn_kind_trait_def_id, [
|
||||
kind_ty,
|
||||
Ty::from_closure_kind(cx, goal_kind),
|
||||
])
|
||||
ty::TraitRef::new(
|
||||
cx,
|
||||
async_fn_kind_trait_def_id,
|
||||
[kind_ty, Ty::from_closure_kind(cx, goal_kind)],
|
||||
)
|
||||
.upcast(cx),
|
||||
);
|
||||
}
|
||||
|
@ -624,14 +625,18 @@ fn coroutine_closure_to_ambiguous_coroutine<I: Interner>(
|
|||
sig: ty::CoroutineClosureSignature<I>,
|
||||
) -> I::Ty {
|
||||
let upvars_projection_def_id = cx.require_lang_item(TraitSolverLangItem::AsyncFnKindUpvars);
|
||||
let tupled_upvars_ty = Ty::new_projection(cx, upvars_projection_def_id, [
|
||||
I::GenericArg::from(args.kind_ty()),
|
||||
Ty::from_closure_kind(cx, goal_kind).into(),
|
||||
goal_region.into(),
|
||||
sig.tupled_inputs_ty.into(),
|
||||
args.tupled_upvars_ty().into(),
|
||||
args.coroutine_captures_by_ref_ty().into(),
|
||||
]);
|
||||
let tupled_upvars_ty = Ty::new_projection(
|
||||
cx,
|
||||
upvars_projection_def_id,
|
||||
[
|
||||
I::GenericArg::from(args.kind_ty()),
|
||||
Ty::from_closure_kind(cx, goal_kind).into(),
|
||||
goal_region.into(),
|
||||
sig.tupled_inputs_ty.into(),
|
||||
args.tupled_upvars_ty().into(),
|
||||
args.coroutine_captures_by_ref_ty().into(),
|
||||
],
|
||||
);
|
||||
sig.to_coroutine(
|
||||
cx,
|
||||
args.parent_args(),
|
||||
|
|
|
@ -248,10 +248,11 @@ where
|
|||
|
||||
let pred = inputs_and_output
|
||||
.map_bound(|(inputs, _)| {
|
||||
ty::TraitRef::new(cx, goal.predicate.def_id(), [
|
||||
goal.predicate.self_ty(),
|
||||
Ty::new_tup(cx, inputs.as_slice()),
|
||||
])
|
||||
ty::TraitRef::new(
|
||||
cx,
|
||||
goal.predicate.def_id(),
|
||||
[goal.predicate.self_ty(), Ty::new_tup(cx, inputs.as_slice())],
|
||||
)
|
||||
})
|
||||
.to_host_effect_clause(cx, goal.predicate.constness);
|
||||
|
||||
|
|
|
@ -60,13 +60,16 @@ where
|
|||
(goal, opaque_types).fold_with(&mut EagerResolver::new(self.delegate));
|
||||
|
||||
let mut orig_values = Default::default();
|
||||
let canonical =
|
||||
Canonicalizer::canonicalize_input(self.delegate, &mut orig_values, QueryInput {
|
||||
let canonical = Canonicalizer::canonicalize_input(
|
||||
self.delegate,
|
||||
&mut orig_values,
|
||||
QueryInput {
|
||||
goal,
|
||||
predefined_opaques_in_body: self
|
||||
.cx()
|
||||
.mk_predefined_opaques_in_body(PredefinedOpaquesData { opaque_types }),
|
||||
});
|
||||
},
|
||||
);
|
||||
let query_input = ty::CanonicalQueryInput { canonical, typing_mode: self.typing_mode() };
|
||||
(orig_values, query_input)
|
||||
}
|
||||
|
|
|
@ -548,10 +548,10 @@ where
|
|||
// Replace the goal with an unconstrained infer var, so the
|
||||
// RHS does not affect projection candidate assembly.
|
||||
let unconstrained_rhs = self.next_term_infer_of_kind(goal.predicate.term);
|
||||
let unconstrained_goal = goal.with(cx, ty::NormalizesTo {
|
||||
alias: goal.predicate.alias,
|
||||
term: unconstrained_rhs,
|
||||
});
|
||||
let unconstrained_goal = goal.with(
|
||||
cx,
|
||||
ty::NormalizesTo { alias: goal.predicate.alias, term: unconstrained_rhs },
|
||||
);
|
||||
|
||||
let (NestedNormalizationGoals(nested_goals), _, certainty) = self.evaluate_goal_raw(
|
||||
GoalEvaluationKind::Nested,
|
||||
|
|
|
@ -398,10 +398,11 @@ where
|
|||
|
||||
let pred = tupled_inputs_and_output
|
||||
.map_bound(|(inputs, output)| ty::ProjectionPredicate {
|
||||
projection_term: ty::AliasTerm::new(cx, goal.predicate.def_id(), [
|
||||
goal.predicate.self_ty(),
|
||||
inputs,
|
||||
]),
|
||||
projection_term: ty::AliasTerm::new(
|
||||
cx,
|
||||
goal.predicate.def_id(),
|
||||
[goal.predicate.self_ty(), inputs],
|
||||
),
|
||||
term: output.into(),
|
||||
})
|
||||
.upcast(cx);
|
||||
|
@ -454,21 +455,26 @@ where
|
|||
.is_lang_item(goal.predicate.def_id(), TraitSolverLangItem::CallOnceFuture)
|
||||
{
|
||||
(
|
||||
ty::AliasTerm::new(cx, goal.predicate.def_id(), [
|
||||
goal.predicate.self_ty(),
|
||||
tupled_inputs_ty,
|
||||
]),
|
||||
ty::AliasTerm::new(
|
||||
cx,
|
||||
goal.predicate.def_id(),
|
||||
[goal.predicate.self_ty(), tupled_inputs_ty],
|
||||
),
|
||||
output_coroutine_ty.into(),
|
||||
)
|
||||
} else if cx
|
||||
.is_lang_item(goal.predicate.def_id(), TraitSolverLangItem::CallRefFuture)
|
||||
{
|
||||
(
|
||||
ty::AliasTerm::new(cx, goal.predicate.def_id(), [
|
||||
I::GenericArg::from(goal.predicate.self_ty()),
|
||||
tupled_inputs_ty.into(),
|
||||
env_region.into(),
|
||||
]),
|
||||
ty::AliasTerm::new(
|
||||
cx,
|
||||
goal.predicate.def_id(),
|
||||
[
|
||||
I::GenericArg::from(goal.predicate.self_ty()),
|
||||
tupled_inputs_ty.into(),
|
||||
env_region.into(),
|
||||
],
|
||||
),
|
||||
output_coroutine_ty.into(),
|
||||
)
|
||||
} else if cx.is_lang_item(
|
||||
|
@ -476,10 +482,14 @@ where
|
|||
TraitSolverLangItem::AsyncFnOnceOutput,
|
||||
) {
|
||||
(
|
||||
ty::AliasTerm::new(cx, goal.predicate.def_id(), [
|
||||
I::GenericArg::from(goal.predicate.self_ty()),
|
||||
tupled_inputs_ty.into(),
|
||||
]),
|
||||
ty::AliasTerm::new(
|
||||
cx,
|
||||
goal.predicate.def_id(),
|
||||
[
|
||||
I::GenericArg::from(goal.predicate.self_ty()),
|
||||
tupled_inputs_ty.into(),
|
||||
],
|
||||
),
|
||||
coroutine_return_ty.into(),
|
||||
)
|
||||
} else {
|
||||
|
@ -603,10 +613,11 @@ where
|
|||
// and opaque types: If the `self_ty` is `Sized`, then the metadata is `()`.
|
||||
// FIXME(ptr_metadata): This impl overlaps with the other impls and shouldn't
|
||||
// exist. Instead, `Pointee<Metadata = ()>` should be a supertrait of `Sized`.
|
||||
let sized_predicate =
|
||||
ty::TraitRef::new(cx, cx.require_lang_item(TraitSolverLangItem::Sized), [
|
||||
I::GenericArg::from(goal.predicate.self_ty()),
|
||||
]);
|
||||
let sized_predicate = ty::TraitRef::new(
|
||||
cx,
|
||||
cx.require_lang_item(TraitSolverLangItem::Sized),
|
||||
[I::GenericArg::from(goal.predicate.self_ty())],
|
||||
);
|
||||
// FIXME(-Znext-solver=coinductive): Should this be `GoalSource::ImplWhereBound`?
|
||||
ecx.add_goal(GoalSource::Misc, goal.with(cx, sized_predicate));
|
||||
Ty::new_unit(cx)
|
||||
|
@ -782,10 +793,11 @@ where
|
|||
CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),
|
||||
goal,
|
||||
ty::ProjectionPredicate {
|
||||
projection_term: ty::AliasTerm::new(ecx.cx(), goal.predicate.def_id(), [
|
||||
self_ty,
|
||||
coroutine.resume_ty(),
|
||||
]),
|
||||
projection_term: ty::AliasTerm::new(
|
||||
ecx.cx(),
|
||||
goal.predicate.def_id(),
|
||||
[self_ty, coroutine.resume_ty()],
|
||||
),
|
||||
term,
|
||||
}
|
||||
.upcast(cx),
|
||||
|
|
|
@ -342,18 +342,21 @@ where
|
|||
// (FIXME: technically we only need to check this if the type is a fn ptr...)
|
||||
let output_is_sized_pred = tupled_inputs_and_output_and_coroutine.map_bound(
|
||||
|AsyncCallableRelevantTypes { output_coroutine_ty, .. }| {
|
||||
ty::TraitRef::new(cx, cx.require_lang_item(TraitSolverLangItem::Sized), [
|
||||
output_coroutine_ty,
|
||||
])
|
||||
ty::TraitRef::new(
|
||||
cx,
|
||||
cx.require_lang_item(TraitSolverLangItem::Sized),
|
||||
[output_coroutine_ty],
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
let pred = tupled_inputs_and_output_and_coroutine
|
||||
.map_bound(|AsyncCallableRelevantTypes { tupled_inputs_ty, .. }| {
|
||||
ty::TraitRef::new(cx, goal.predicate.def_id(), [
|
||||
goal.predicate.self_ty(),
|
||||
tupled_inputs_ty,
|
||||
])
|
||||
ty::TraitRef::new(
|
||||
cx,
|
||||
goal.predicate.def_id(),
|
||||
[goal.predicate.self_ty(), tupled_inputs_ty],
|
||||
)
|
||||
})
|
||||
.upcast(cx);
|
||||
Self::probe_and_consider_implied_clause(
|
||||
|
@ -975,9 +978,11 @@ where
|
|||
GoalSource::ImplWhereBound,
|
||||
goal.with(
|
||||
cx,
|
||||
ty::TraitRef::new(cx, cx.require_lang_item(TraitSolverLangItem::Unsize), [
|
||||
a_tail_ty, b_tail_ty,
|
||||
]),
|
||||
ty::TraitRef::new(
|
||||
cx,
|
||||
cx.require_lang_item(TraitSolverLangItem::Unsize),
|
||||
[a_tail_ty, b_tail_ty],
|
||||
),
|
||||
),
|
||||
);
|
||||
self.probe_builtin_trait_candidate(BuiltinImplSource::Misc)
|
||||
|
@ -1015,9 +1020,11 @@ where
|
|||
GoalSource::ImplWhereBound,
|
||||
goal.with(
|
||||
cx,
|
||||
ty::TraitRef::new(cx, cx.require_lang_item(TraitSolverLangItem::Unsize), [
|
||||
a_last_ty, b_last_ty,
|
||||
]),
|
||||
ty::TraitRef::new(
|
||||
cx,
|
||||
cx.require_lang_item(TraitSolverLangItem::Unsize),
|
||||
[a_last_ty, b_last_ty],
|
||||
),
|
||||
),
|
||||
);
|
||||
self.probe_builtin_trait_candidate(BuiltinImplSource::TupleUnsizing)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue