Skip to content

Commit

Permalink
Always encode RPITITs
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino authored and compiler-errors committed Mar 21, 2023
1 parent 77d50a8 commit c1f3529
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,13 @@ fn should_encode_type(tcx: TyCtxt<'_>, def_id: LocalDefId, def_kind: DefKind) ->
let assoc_item = tcx.associated_item(def_id);
match assoc_item.container {
ty::AssocItemContainer::ImplContainer => true,
ty::AssocItemContainer::TraitContainer => assoc_item.defaultness(tcx).has_value(),
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) always encode RPITITs,
// since we need to be able to "project" from an RPITIT associated item
// to an opaque when installing the default projection predicates in
// default trait methods with RPITITs.
ty::AssocItemContainer::TraitContainer => {
assoc_item.defaultness(tcx).has_value() || assoc_item.opt_rpitit_info.is_some()
}
}
}
DefKind::TyParam => {
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty

#![feature(return_position_impl_trait_in_trait)]

pub trait Foo {
Expand Down

0 comments on commit c1f3529

Please sign in to comment.