Skip to content

Commit 83c0ff8

Browse files
committed
Map to new synthesized assoc ty for RPITITs in astconv
1 parent 3ecb701 commit 83c0ff8

File tree

1 file changed

+9
-1
lines changed
  • compiler/rustc_hir_analysis/src/astconv

1 file changed

+9
-1
lines changed

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3049,10 +3049,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
30493049
}
30503050
&hir::TyKind::OpaqueDef(item_id, lifetimes, in_trait) => {
30513051
let opaque_ty = tcx.hir().item(item_id);
3052-
let def_id = item_id.owner_id.to_def_id();
30533052

30543053
match opaque_ty.kind {
30553054
hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) => {
3055+
let local_def_id = item_id.owner_id.def_id;
3056+
// If this is an RPITIT and we are using the new RPITIT lowering scheme, we
3057+
// generate the def_id of an associated type for the trait and return as
3058+
// type a projection.
3059+
let def_id = if in_trait && tcx.lower_impl_trait_in_trait_to_assoc_ty() {
3060+
tcx.associated_item_for_impl_trait_in_trait(local_def_id).to_def_id()
3061+
} else {
3062+
local_def_id.to_def_id()
3063+
};
30563064
self.impl_trait_ty_to_ty(def_id, lifetimes, origin, in_trait)
30573065
}
30583066
ref i => bug!("`impl Trait` pointed to non-opaque type?? {:#?}", i),

0 commit comments

Comments
 (0)