diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2023-07-07 15:24:10 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2023-07-07 16:24:08 -0300 |
| commit | 24326ee5081a28628f0046d25764408b7bf4e2ca (patch) | |
| tree | bacdb9cf803ed0166e7f9503d6f4ca96eca4a112 /compiler | |
| parent | fd68a6ded951bd7b852ab8107007f7145e3ad6ec (diff) | |
| download | rust-24326ee5081a28628f0046d25764408b7bf4e2ca.tar.gz rust-24326ee5081a28628f0046d25764408b7bf4e2ca.zip | |
Avoid calling report_forbidden_specialization for RPITITs
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/check.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 270b90fa6b2..120545c8e5d 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -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| { |
