Skip to content

Commit fee7dc6

Browse files
committed
Properly type check type parameter predicates for RPIT
1 parent 35a98a7 commit fee7dc6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

compiler/rustc_typeck/src/collect.rs

+13
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,19 @@ fn type_param_predicates(
632632
}
633633
generics
634634
}
635+
ItemKind::OpaqueTy(OpaqueTy {
636+
ref generics,
637+
origin: hir::OpaqueTyOrigin::FnReturn(..),
638+
..
639+
}) if tcx.sess.features_untracked().return_position_impl_trait_v2 => {
640+
// Implied `Self: Trait` and supertrait bounds.
641+
if param_id == item_hir_id {
642+
let identity_trait_ref = ty::TraitRef::identity(tcx, item_def_id);
643+
extend =
644+
Some((identity_trait_ref.without_const().to_predicate(tcx), item.span));
645+
}
646+
generics
647+
}
635648
_ => return result,
636649
}
637650
}

0 commit comments

Comments
 (0)