Skip to content

Commit

Permalink
Don't register predicates for RPITIT items in built-in trait object i…
Browse files Browse the repository at this point in the history
…mpl confirmation
  • Loading branch information
compiler-errors committed Dec 4, 2024
1 parent 22e1ca7 commit 4ffdaa3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions compiler/rustc_trait_selection/src/traits/select/confirmation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,18 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {

// When `async_fn_in_dyn_trait` is enabled, we don't need to check the
// RPITIT for compatibility, since it's not provided by the user.
if tcx.features().async_fn_in_dyn_trait() && tcx.is_impl_trait_in_trait(assoc_type) {
continue;
if tcx.is_impl_trait_in_trait(assoc_type) {
if tcx.features().async_fn_in_dyn_trait() {
continue;
} else {
tcx.dcx().span_delayed_bug(
obligation.cause.span,
"RPITIT in trait object shouldn't have been considered",
);
return Err(SelectionError::TraitDynIncompatible(
trait_predicate.trait_ref.def_id,
));
}
}

if !defs.own_params.is_empty() {
Expand Down

0 comments on commit 4ffdaa3

Please sign in to comment.