diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2023-03-03 12:34:16 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2023-03-06 14:49:47 -0300 |
| commit | 83c0ff8fa5eb1789b9d5caa1d5bb2b344165e897 (patch) | |
| tree | 4758626d849a957a7c44f63c7fc6ed298e708940 | |
| parent | 3ecb70125e813750dffcec78b4d5075f0d0deb6a (diff) | |
| download | rust-83c0ff8fa5eb1789b9d5caa1d5bb2b344165e897.tar.gz rust-83c0ff8fa5eb1789b9d5caa1d5bb2b344165e897.zip | |
Map to new synthesized assoc ty for RPITITs in astconv
| -rw-r--r-- | compiler/rustc_hir_analysis/src/astconv/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs index 899029d98e0..2a64e09b9c6 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs @@ -3049,10 +3049,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } &hir::TyKind::OpaqueDef(item_id, lifetimes, in_trait) => { let opaque_ty = tcx.hir().item(item_id); - let def_id = item_id.owner_id.to_def_id(); match opaque_ty.kind { hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) => { + let local_def_id = item_id.owner_id.def_id; + // If this is an RPITIT and we are using the new RPITIT lowering scheme, we + // generate the def_id of an associated type for the trait and return as + // type a projection. + let def_id = if in_trait && tcx.lower_impl_trait_in_trait_to_assoc_ty() { + tcx.associated_item_for_impl_trait_in_trait(local_def_id).to_def_id() + } else { + local_def_id.to_def_id() + }; self.impl_trait_ty_to_ty(def_id, lifetimes, origin, in_trait) } ref i => bug!("`impl Trait` pointed to non-opaque type?? {:#?}", i), |
