Skip to content

Commit 42051ce

Browse files
Use tcx.type_of(impl) instead of TraitRef::self_ty() for getting Self in relevant_impls_for().
1 parent 0a77a58 commit 42051ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc/ty/trait_def.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
170170
.map(|&node_id| tcx.hir.local_def_id(node_id));
171171

172172
for impl_def_id in local_impls.chain(remote_impls.into_iter()) {
173-
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
174-
if impl_def_id.is_local() && impl_trait_ref.references_error() {
173+
let impl_self_ty = tcx.type_of(impl_def_id);
174+
if impl_def_id.is_local() && impl_self_ty.references_error() {
175175
continue
176176
}
177177

178-
if fast_reject::simplify_type(tcx, impl_trait_ref.self_ty(), false).is_some() {
178+
if fast_reject::simplify_type(tcx, impl_self_ty, false).is_some() {
179179
non_blanket_impls.push(impl_def_id);
180180
} else {
181181
blanket_impls.push(impl_def_id);
@@ -201,9 +201,9 @@ pub(super) fn relevant_trait_impls_provider<'a, 'tcx>(
201201
.iter()
202202
.cloned()
203203
.filter(|&impl_def_id| {
204-
let impl_trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
204+
let impl_self_ty = tcx.type_of(impl_def_id);
205205
let impl_simple_self_ty = fast_reject::simplify_type(tcx,
206-
impl_trait_ref.self_ty(),
206+
impl_self_ty,
207207
false).unwrap();
208208
impl_simple_self_ty == self_ty
209209
})

0 commit comments

Comments
 (0)