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,11 +7,11 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_errors::ErrorGuaranteed;
use rustc_hir::def::DefKind;
use rustc_hir::lang_items::LangItem;
use rustc_infer::infer::resolve::OpportunisticRegionResolver;
use rustc_infer::infer::DefineOpaqueTypes;
use rustc_infer::infer::resolve::OpportunisticRegionResolver;
use rustc_infer::traits::ObligationCauseCode;
use rustc_middle::traits::select::OverflowError;
pub use rustc_middle::traits::Reveal;
use rustc_middle::traits::select::OverflowError;
use rustc_middle::traits::{BuiltinImplSource, ImplSource, ImplSourceUserDefinedData};
use rustc_middle::ty::fast_reject::DeepRejectCtxt;
use rustc_middle::ty::fold::TypeFoldable;
@@ -22,9 +22,9 @@ use rustc_span::symbol::sym;
use tracing::{debug, instrument};
use super::{
specialization_graph, translate_args, util, MismatchedProjectionTypes, Normalized,
NormalizedTerm, Obligation, ObligationCause, PredicateObligation, ProjectionCacheEntry,
ProjectionCacheKey, Selection, SelectionContext, SelectionError,
MismatchedProjectionTypes, Normalized, NormalizedTerm, Obligation, ObligationCause,
PredicateObligation, ProjectionCacheEntry, ProjectionCacheKey, Selection, SelectionContext,
SelectionError, specialization_graph, translate_args, util,
};
use crate::errors::InherentProjectionNormalizationOverflow;
use crate::infer::{BoundRegionConversionTime, InferOk};
@@ -1696,18 +1696,14 @@ fn confirm_closure_candidate<'cx, 'tcx>(
} else {
let upvars_projection_def_id =
tcx.require_lang_item(LangItem::AsyncFnKindUpvars, None);
let tupled_upvars_ty = Ty::new_projection(
tcx,
upvars_projection_def_id,
[
ty::GenericArg::from(kind_ty),
Ty::from_closure_kind(tcx, ty::ClosureKind::FnOnce).into(),
tcx.lifetimes.re_static.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(tcx, upvars_projection_def_id, [
ty::GenericArg::from(kind_ty),
Ty::from_closure_kind(tcx, ty::ClosureKind::FnOnce).into(),
tcx.lifetimes.re_static.into(),
sig.tupled_inputs_ty.into(),
args.tupled_upvars_ty().into(),
args.coroutine_captures_by_ref_ty().into(),
]);
sig.to_coroutine(
tcx,
args.parent_args(),
@@ -1834,18 +1830,14 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
// will project to the right upvars for the generator, appending the inputs and
// coroutine upvars respecting the closure kind.
// N.B. No need to register a `AsyncFnKindHelper` goal here, it's already in `nested`.
let tupled_upvars_ty = Ty::new_projection(
tcx,
upvars_projection_def_id,
[
ty::GenericArg::from(kind_ty),
Ty::from_closure_kind(tcx, goal_kind).into(),
env_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(tcx, upvars_projection_def_id, [
ty::GenericArg::from(kind_ty),
Ty::from_closure_kind(tcx, goal_kind).into(),
env_region.into(),
sig.tupled_inputs_ty.into(),
args.tupled_upvars_ty().into(),
args.coroutine_captures_by_ref_ty().into(),
]);
sig.to_coroutine(
tcx,
args.parent_args(),
@@ -1859,16 +1851,17 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
name => bug!("no such associated type: {name}"),
};
let projection_term = match item_name {
sym::CallOnceFuture | sym::Output => ty::AliasTerm::new(
tcx,
obligation.predicate.def_id,
[self_ty, sig.tupled_inputs_ty],
),
sym::CallRefFuture => ty::AliasTerm::new(
tcx,
obligation.predicate.def_id,
[ty::GenericArg::from(self_ty), sig.tupled_inputs_ty.into(), env_region.into()],
),
sym::CallOnceFuture | sym::Output => {
ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
self_ty,
sig.tupled_inputs_ty,
])
}
sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
ty::GenericArg::from(self_ty),
sig.tupled_inputs_ty.into(),
env_region.into(),
]),
name => bug!("no such associated type: {name}"),
};
@@ -1888,20 +1881,17 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
name => bug!("no such associated type: {name}"),
};
let projection_term = match item_name {
sym::CallOnceFuture | sym::Output => ty::AliasTerm::new(
tcx,
obligation.predicate.def_id,
[self_ty, Ty::new_tup(tcx, sig.inputs())],
),
sym::CallRefFuture => ty::AliasTerm::new(
tcx,
obligation.predicate.def_id,
[
ty::GenericArg::from(self_ty),
Ty::new_tup(tcx, sig.inputs()).into(),
env_region.into(),
],
),
sym::CallOnceFuture | sym::Output => {
ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
self_ty,
Ty::new_tup(tcx, sig.inputs()),
])
}
sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
ty::GenericArg::from(self_ty),
Ty::new_tup(tcx, sig.inputs()).into(),
env_region.into(),
]),
name => bug!("no such associated type: {name}"),
};
@@ -1924,11 +1914,11 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
sym::CallOnceFuture | sym::Output => {
ty::AliasTerm::new(tcx, obligation.predicate.def_id, [self_ty, sig.inputs()[0]])
}
sym::CallRefFuture => ty::AliasTerm::new(
tcx,
obligation.predicate.def_id,
[ty::GenericArg::from(self_ty), sig.inputs()[0].into(), env_region.into()],
),
sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
ty::GenericArg::from(self_ty),
sig.inputs()[0].into(),
env_region.into(),
]),
name => bug!("no such associated type: {name}"),
};