Skip to content

Commit aff2893

Browse files
committed
Fix the error in resolving trait associated types
1 parent e25160b commit aff2893

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/builder/substs_specializer.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ impl<'tcx> SubstsSpecializer<'tcx> {
9595
let param_env = self
9696
.tcx
9797
.param_env(self.tcx.associated_item(item_def_id).container_id(self.tcx));
98+
let new_proj_type = Ty::new_projection(self.tcx, projection.def_id, specialized_substs);
99+
if let Ok(specialized_type) = self.tcx.try_normalize_erasing_regions(param_env, new_proj_type) {
100+
return specialized_type;
101+
}
98102
if let Ok(Some(instance)) = rustc_middle::ty::Instance::resolve(
99103
self.tcx,
100104
param_env,

0 commit comments

Comments
 (0)