diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-02-08 22:12:13 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-02-08 22:12:13 +0000 |
| commit | 1fcae03369abb4c2cc180cd5a49e1f4440a81300 (patch) | |
| tree | fe705ff77c286f5fc4c09acc98d2f124086d0479 /compiler/rustc_next_trait_solver/src | |
| parent | 3183b44a1ec209b06e0c26cbc92217176b59dc76 (diff) | |
| download | rust-1fcae03369abb4c2cc180cd5a49e1f4440a81300.tar.gz rust-1fcae03369abb4c2cc180cd5a49e1f4440a81300.zip | |
Rustfmt
Diffstat (limited to 'compiler/rustc_next_trait_solver/src')
6 files changed, 89 insertions, 61 deletions
diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs index 3c5d9b95e77..082c356cc5f 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs @@ -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(), diff --git a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs index 7669a305d58..fb53e778e60 100644 --- a/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs +++ b/compiler/rustc_next_trait_solver/src/solve/effect_goals.rs @@ -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); diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs index 0bfd72c6848..2491f09a0e2 100644 --- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs +++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs @@ -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) } diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs index 48a05488148..b0a34b9ce75 100644 --- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs @@ -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, diff --git a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs index 76cbe5758b2..c8ea0b119ff 100644 --- a/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs @@ -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), diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs index 513fc9355c8..46fae5c6fa4 100644 --- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs +++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs @@ -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) |
