Rollup merge of #113456 - spastorino:new-rpitit-31, r=compiler-errors

Avoid calling report_forbidden_specialization for RPITITs

Fixes #113438

r? ``@compiler-errors``
This commit is contained in:
Michael Goulet 2023-07-07 22:12:18 -07:00 committed by GitHub
commit cf1f8c55d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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| {