Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/ty/context/impl_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
fn for_each_relevant_impl<R: VisitorResult>(
self,
trait_def_id: DefId,
self_ty: Ty<'tcx>,
args: ty::GenericArgsRef<'tcx>,
mut f: impl FnMut(DefId) -> R,
) -> R {
macro_rules! ret {
Expand All @@ -540,6 +540,7 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
};
}

let self_ty = args.type_at(0);
let tcx = self;
let trait_impls = tcx.trait_impls_of(trait_def_id);
let mut consider_impls_for_simplified_type = |simp| {
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ where
{
fn self_ty(self) -> I::Ty;

fn args(self) -> I::GenericArgs;

fn trait_ref(self, cx: I) -> ty::TraitRef<I>;

fn with_replaced_self_ty(self, cx: I, self_ty: I::Ty) -> Self;
Expand Down Expand Up @@ -539,7 +541,7 @@ where
let cx = self.cx();
cx.for_each_relevant_impl(
goal.predicate.trait_def_id(cx),
goal.predicate.self_ty(),
goal.predicate.args(),
|impl_def_id| -> Result<_, _> {
// For every `default impl`, there's always a non-default `impl`
// that will *also* apply. There's no reason to register a candidate
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_next_trait_solver/src/solve/effect_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ where
self.self_ty()
}

fn args(self) -> I::GenericArgs {
self.trait_ref.args
}

fn trait_ref(self, _: I) -> ty::TraitRef<I> {
self.trait_ref
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ where
self.self_ty()
}

fn args(self) -> I::GenericArgs {
self.alias.args
}

fn trait_ref(self, cx: I) -> ty::TraitRef<I> {
self.alias.trait_ref(cx)
}
Expand Down
6 changes: 5 additions & 1 deletion compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ where
self.self_ty()
}

fn args(self) -> I::GenericArgs {
self.trait_ref.args
}

fn trait_ref(self, _: I) -> ty::TraitRef<I> {
self.trait_ref
}
Expand Down Expand Up @@ -1238,7 +1242,7 @@ where
let mut disqualifying_impl = None;
self.cx().for_each_relevant_impl(
goal.predicate.def_id(),
goal.predicate.self_ty(),
goal.predicate.trait_ref.args,
|impl_def_id| {
disqualifying_impl = Some(impl_def_id);
},
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_type_ir/src/interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ pub trait Interner:
fn for_each_relevant_impl<R: VisitorResult>(
self,
trait_def_id: Self::TraitId,
self_ty: Self::Ty,
args: Self::GenericArgs,
f: impl FnMut(Self::ImplId) -> R,
) -> R;
fn for_each_blanket_impl<R: VisitorResult>(
Expand Down
Loading