Nits and formatting
This commit is contained in:
parent
1e72c7f536
commit
a41c44f21c
17 changed files with 130 additions and 142 deletions
|
@ -10,7 +10,7 @@ use rustc_hir::intravisit;
|
|||
use rustc_hir::{GenericParamKind, ImplItemKind};
|
||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||
use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
|
||||
use rustc_infer::traits::{util, FulfillmentErrorLike};
|
||||
use rustc_infer::traits::util;
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||
use rustc_middle::ty::fold::BottomUpFolder;
|
||||
use rustc_middle::ty::util::ExplicitSelf;
|
||||
|
@ -764,10 +764,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
|||
Ok(&*tcx.arena.alloc(remapped_types))
|
||||
}
|
||||
|
||||
struct ImplTraitInTraitCollector<'a, 'tcx, E>
|
||||
where
|
||||
E: FulfillmentErrorLike<'tcx>,
|
||||
{
|
||||
struct ImplTraitInTraitCollector<'a, 'tcx, E> {
|
||||
ocx: &'a ObligationCtxt<'a, 'tcx, E>,
|
||||
types: FxIndexMap<DefId, (Ty<'tcx>, ty::GenericArgsRef<'tcx>)>,
|
||||
span: Span,
|
||||
|
@ -777,7 +774,7 @@ where
|
|||
|
||||
impl<'a, 'tcx, E> ImplTraitInTraitCollector<'a, 'tcx, E>
|
||||
where
|
||||
E: FulfillmentErrorLike<'tcx>,
|
||||
E: 'tcx,
|
||||
{
|
||||
fn new(
|
||||
ocx: &'a ObligationCtxt<'a, 'tcx, E>,
|
||||
|
@ -791,7 +788,7 @@ where
|
|||
|
||||
impl<'tcx, E> TypeFolder<TyCtxt<'tcx>> for ImplTraitInTraitCollector<'_, 'tcx, E>
|
||||
where
|
||||
E: FulfillmentErrorLike<'tcx>,
|
||||
E: 'tcx,
|
||||
{
|
||||
fn interner(&self) -> TyCtxt<'tcx> {
|
||||
self.ocx.infcx.tcx
|
||||
|
|
|
@ -12,11 +12,8 @@ use rustc_middle::ty::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
|||
use rustc_middle::ty::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::def_id::{DefId, LocalDefId};
|
||||
use rustc_trait_selection::traits::{
|
||||
self, IsFirstInputType, ScrubbedTraitError, UncoveredTyParams,
|
||||
};
|
||||
use rustc_trait_selection::traits::{self, IsFirstInputType, UncoveredTyParams};
|
||||
use rustc_trait_selection::traits::{OrphanCheckErr, OrphanCheckMode};
|
||||
use rustc_trait_selection::traits::{StructurallyNormalizeExt, TraitEngineExt};
|
||||
|
||||
#[instrument(level = "debug", skip(tcx))]
|
||||
pub(crate) fn orphan_check_impl(
|
||||
|
@ -319,13 +316,12 @@ fn orphan_check<'tcx>(
|
|||
}
|
||||
|
||||
let ty = if infcx.next_trait_solver() {
|
||||
let mut fulfill_cx =
|
||||
<dyn traits::TraitEngine<'tcx, ScrubbedTraitError<'tcx>>>::new(&infcx);
|
||||
infcx
|
||||
.at(&cause, ty::ParamEnv::empty())
|
||||
.structurally_normalize(ty, &mut *fulfill_cx)
|
||||
.map(|ty| infcx.resolve_vars_if_possible(ty))
|
||||
.unwrap_or(ty)
|
||||
ocx.structurally_normalize(
|
||||
&cause,
|
||||
ty::ParamEnv::empty(),
|
||||
infcx.resolve_vars_if_possible(ty),
|
||||
)
|
||||
.unwrap_or(ty)
|
||||
} else {
|
||||
ty
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue