Skip to content

Commit cd59848

Browse files
Allow to implement on projections
1 parent 26e2360 commit cd59848

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,13 @@ impl<'tcx> InherentCollect<'tcx> {
186186
return;
187187
};
188188

189-
let self_ty = self.tcx.type_of(item.owner_id);
189+
let mut self_ty = self.tcx.type_of(item.owner_id);
190+
if matches!(self_ty.kind(), ty::Alias(ty::AliasKind::Projection, _)) {
191+
let param_env = self.tcx.param_env(item.owner_id);
192+
if let Ok(new_ty) = self.tcx.try_normalize_erasing_regions(param_env, self_ty) {
193+
self_ty = new_ty;
194+
}
195+
}
190196
match *self_ty.kind() {
191197
ty::Adt(def, _) => {
192198
self.check_def_id(item, self_ty, def.did());

0 commit comments

Comments
 (0)