Skip to content

Commit 4ffdaa3

Browse files
Don't register predicates for RPITIT items in built-in trait object impl confirmation
1 parent 22e1ca7 commit 4ffdaa3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,18 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
629629

630630
// When `async_fn_in_dyn_trait` is enabled, we don't need to check the
631631
// RPITIT for compatibility, since it's not provided by the user.
632-
if tcx.features().async_fn_in_dyn_trait() && tcx.is_impl_trait_in_trait(assoc_type) {
633-
continue;
632+
if tcx.is_impl_trait_in_trait(assoc_type) {
633+
if tcx.features().async_fn_in_dyn_trait() {
634+
continue;
635+
} else {
636+
tcx.dcx().span_delayed_bug(
637+
obligation.cause.span,
638+
"RPITIT in trait object shouldn't have been considered",
639+
);
640+
return Err(SelectionError::TraitDynIncompatible(
641+
trait_predicate.trait_ref.def_id,
642+
));
643+
}
634644
}
635645

636646
if !defs.own_params.is_empty() {

0 commit comments

Comments
 (0)