Skip to content

Commit c1f3529

Browse files
spastorinocompiler-errors
authored andcommitted
Always encode RPITITs
1 parent 77d50a8 commit c1f3529

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,13 @@ fn should_encode_type(tcx: TyCtxt<'_>, def_id: LocalDefId, def_kind: DefKind) ->
10441044
let assoc_item = tcx.associated_item(def_id);
10451045
match assoc_item.container {
10461046
ty::AssocItemContainer::ImplContainer => true,
1047-
ty::AssocItemContainer::TraitContainer => assoc_item.defaultness(tcx).has_value(),
1047+
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) always encode RPITITs,
1048+
// since we need to be able to "project" from an RPITIT associated item
1049+
// to an opaque when installing the default projection predicates in
1050+
// default trait methods with RPITITs.
1051+
ty::AssocItemContainer::TraitContainer => {
1052+
assoc_item.defaultness(tcx).has_value() || assoc_item.opt_rpitit_info.is_some()
1053+
}
10481054
}
10491055
}
10501056
DefKind::TyParam => {

tests/ui/impl-trait/in-trait/auxiliary/rpitit.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
2+
13
#![feature(return_position_impl_trait_in_trait)]
24

35
pub trait Foo {

0 commit comments

Comments
 (0)