Skip to content

Commit 0597d42

Browse files
committed
Always encode RPITITs
1 parent 04211b6 commit 0597d42

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,14 @@ fn should_encode_type(tcx: TyCtxt<'_>, def_id: LocalDefId, def_kind: DefKind) ->
10421042
DefKind::AssocTy => {
10431043
let assoc_item = tcx.associated_item(def_id);
10441044
match assoc_item.container {
1045+
// FIXME(-Zlower-impl-trait-in-trait-to-assoc-ty) always encode RPITITs but when we
1046+
// stop lowering default method bodies as ImplTraitPlaceholder this may be wrong,
1047+
// because we want to do something similar to what we do in the branch above.
1048+
_ => {
1049+
if tcx.opt_rpitit_info(def_id.to_def_id()).is_some() {
1050+
true
1051+
}
1052+
}
10451053
ty::AssocItemContainer::ImplContainer => true,
10461054
ty::AssocItemContainer::TraitContainer => assoc_item.defaultness(tcx).has_value(),
10471055
}

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

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

36
pub trait Foo {

0 commit comments

Comments
 (0)