diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-18 12:04:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-18 12:04:23 +0100 |
| commit | 8417c93092fbf7974c02c19ace8a46582c97c007 (patch) | |
| tree | 48437036e06e0337d1af9b393411cb9c903115bc /compiler | |
| parent | a48d83d55698614a88be7df46a3c7e9c49f43cf4 (diff) | |
| parent | ae7fa1d269a3346372562570da3c51625027097b (diff) | |
| download | rust-8417c93092fbf7974c02c19ace8a46582c97c007.tar.gz rust-8417c93092fbf7974c02c19ace8a46582c97c007.zip | |
Rollup merge of #109238 - spastorino:new-rpitit-12, r=compiler-errors
Fix generics mismatch errors for RPITITs on -Zlower-impl-trait-in-trait-to-assoc-ty This PR stops reporting errors due to different count of generics on the new synthesized associated types for RPITITs. Those were already reported when we compare the function on the triat with the function on the impl. r? ``@compiler-errors``
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index 6e6f8c1533b..32b6aeed5f8 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -1205,6 +1205,17 @@ fn compare_number_of_generics<'tcx>( return Ok(()); } + // We never need to emit a separate error for RPITITs, since if an RPITIT + // has mismatched type or const generic arguments, then the method that it's + // inheriting the generics from will also have mismatched arguments, and + // we'll report an error for that instead. Delay a bug for safety, though. + if tcx.opt_rpitit_info(trait_.def_id).is_some() { + return Err(tcx.sess.delay_span_bug( + rustc_span::DUMMY_SP, + "errors comparing numbers of generics of trait/impl functions were not emitted", + )); + } + let matchings = [ ("type", trait_own_counts.types, impl_own_counts.types), ("const", trait_own_counts.consts, impl_own_counts.consts), |
