1
Fork 0

Avoid calling report_forbidden_specialization for RPITITs

This commit is contained in:
Santiago Pastorino 2023-07-07 15:24:10 -03:00
parent fd68a6ded9
commit 24326ee508
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
4 changed files with 94 additions and 2 deletions

View file

@ -722,7 +722,14 @@ pub(super) fn check_specialization_validity<'tcx>(
let result = opt_result.unwrap_or(Ok(()));
if let Err(parent_impl) = result {
report_forbidden_specialization(tcx, impl_item, parent_impl);
if !tcx.is_impl_trait_in_trait(impl_item) {
report_forbidden_specialization(tcx, impl_item, parent_impl);
} else {
tcx.sess.delay_span_bug(
DUMMY_SP,
format!("parent item: {:?} not marked as default", parent_impl),
);
}
}
}
@ -1485,7 +1492,9 @@ fn opaque_type_cycle_error(
}
for closure_def_id in visitor.closures {
let Some(closure_local_did) = closure_def_id.as_local() else { continue; };
let Some(closure_local_did) = closure_def_id.as_local() else {
continue;
};
let typeck_results = tcx.typeck(closure_local_did);
let mut label_match = |ty: Ty<'_>, span| {