1
Fork 0

Reformat using the new identifier sorting from rustfmt

This commit is contained in:
Michael Goulet 2024-09-22 19:05:04 -04:00
parent 1173204b36
commit c682aa162b
1455 changed files with 7152 additions and 8384 deletions

View file

@ -7,7 +7,7 @@ use rustc_type_ir::fold::TypeFoldable;
use rustc_type_ir::inherent::*;
use rustc_type_ir::lang_items::TraitSolverLangItem;
use rustc_type_ir::visit::TypeVisitableExt as _;
use rustc_type_ir::{self as ty, elaborate, Interner, Upcast as _};
use rustc_type_ir::{self as ty, Interner, Upcast as _, elaborate};
use tracing::{debug, instrument};
use crate::delegate::SolverDelegate;

View file

@ -7,7 +7,7 @@ use rustc_type_ir::data_structures::HashMap;
use rustc_type_ir::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
use rustc_type_ir::inherent::*;
use rustc_type_ir::lang_items::TraitSolverLangItem;
use rustc_type_ir::{self as ty, elaborate, Interner, Upcast as _};
use rustc_type_ir::{self as ty, Interner, Upcast as _, elaborate};
use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
use tracing::instrument;
@ -507,11 +507,10 @@ 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),
);
}
@ -617,18 +616,14 @@ 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(),

View file

@ -22,9 +22,9 @@ use crate::delegate::SolverDelegate;
use crate::resolve::EagerResolver;
use crate::solve::eval_ctxt::NestedGoals;
use crate::solve::{
inspect, response_no_constraints_raw, CanonicalInput, CanonicalResponse, Certainty, EvalCtxt,
ExternalConstraintsData, Goal, MaybeCause, NestedNormalizationGoals, NoSolution,
PredefinedOpaquesData, QueryInput, QueryResult, Response,
CanonicalInput, CanonicalResponse, Certainty, EvalCtxt, ExternalConstraintsData, Goal,
MaybeCause, NestedNormalizationGoals, NoSolution, PredefinedOpaquesData, QueryInput,
QueryResult, Response, inspect, response_no_constraints_raw,
};
trait ResponseT<I: Interner> {

View file

@ -17,9 +17,9 @@ use crate::delegate::SolverDelegate;
use crate::solve::inspect::{self, ProofTreeBuilder};
use crate::solve::search_graph::SearchGraph;
use crate::solve::{
CanonicalInput, CanonicalResponse, Certainty, Goal, GoalEvaluationKind, GoalSource,
NestedNormalizationGoals, NoSolution, PredefinedOpaquesData, QueryResult, SolverMode,
FIXPOINT_STEP_LIMIT,
CanonicalInput, CanonicalResponse, Certainty, FIXPOINT_STEP_LIMIT, Goal, GoalEvaluationKind,
GoalSource, NestedNormalizationGoals, NoSolution, PredefinedOpaquesData, QueryResult,
SolverMode,
};
pub(super) mod canonical;
@ -497,10 +497,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,

View file

@ -6,7 +6,7 @@ use tracing::instrument;
use crate::delegate::SolverDelegate;
use crate::solve::assembly::Candidate;
use crate::solve::{
inspect, BuiltinImplSource, CandidateSource, EvalCtxt, NoSolution, QueryResult,
BuiltinImplSource, CandidateSource, EvalCtxt, NoSolution, QueryResult, inspect,
};
pub(in crate::solve) struct ProbeCtxt<'me, 'a, D, I, F, T>

View file

@ -13,8 +13,8 @@ use rustc_type_ir::{self as ty, Interner};
use crate::delegate::SolverDelegate;
use crate::solve::eval_ctxt::canonical;
use crate::solve::{
inspect, CanonicalInput, Certainty, GenerateProofTree, Goal, GoalEvaluationKind, GoalSource,
QueryInput, QueryResult,
CanonicalInput, Certainty, GenerateProofTree, Goal, GoalEvaluationKind, GoalSource, QueryInput,
QueryResult, inspect,
};
/// The core data structure when building proof trees.

View file

@ -340,11 +340,10 @@ 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);
@ -396,26 +395,21 @@ 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(
@ -423,14 +417,10 @@ 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 {
@ -556,11 +546,10 @@ 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)
@ -731,11 +720,10 @@ 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),

View file

@ -1,13 +1,13 @@
use std::convert::Infallible;
use std::marker::PhantomData;
use rustc_type_ir::Interner;
use rustc_type_ir::inherent::*;
use rustc_type_ir::search_graph::{self, PathKind};
use rustc_type_ir::solve::{CanonicalInput, Certainty, QueryResult};
use rustc_type_ir::Interner;
use super::inspect::ProofTreeBuilder;
use super::{has_no_inference_or_external_constraints, FIXPOINT_STEP_LIMIT};
use super::{FIXPOINT_STEP_LIMIT, has_no_inference_or_external_constraints};
use crate::delegate::SolverDelegate;
/// This type is never constructed. We only use it to implement `search_graph::Delegate`

View file

@ -6,7 +6,7 @@ use rustc_type_ir::fast_reject::DeepRejectCtxt;
use rustc_type_ir::inherent::*;
use rustc_type_ir::lang_items::TraitSolverLangItem;
use rustc_type_ir::visit::TypeVisitableExt as _;
use rustc_type_ir::{self as ty, elaborate, Interner, TraitPredicate, Upcast as _};
use rustc_type_ir::{self as ty, Interner, TraitPredicate, Upcast as _, elaborate};
use tracing::{instrument, trace};
use crate::delegate::SolverDelegate;
@ -359,21 +359,18 @@ where
)?;
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);
// A built-in `AsyncFn` impl only holds if the output is sized.
@ -1027,11 +1024,9 @@ 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)
@ -1069,11 +1064,9 @@ 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)