diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-10-25 17:40:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-25 17:40:29 +0200 |
| commit | 96074bec97bee042af25442558375aafb1af16f5 (patch) | |
| tree | fd2fccb5868b4bc3cbf5b1ad0918e3bcfc6b490d /compiler | |
| parent | 75efc4fd9e8aaf2d587be2f7f853b52ba5852e1d (diff) | |
| parent | a947654a96651e3acc911fe202907b283cd2ed5b (diff) | |
Rollup merge of #117133 - compiler-errors:coherence-constrained, r=oli-obk
Merge `impl_wf_inference` (`check_mod_impl_wf`) check into coherence checking Problem here is that we call `collect_impl_trait_in_trait_types` when checking `check_mod_impl_wf` which is performed before coherence. Due to the `tcx.sess.track_errors`, since we end up reporting an error, we never actually proceed to coherence checking, where we would be emitting a more useful impl overlap error. This change means that we may report more errors in some cases, but can at least proceed far enough to leave a useful message for overlapping traits with RPITITs in them. Fixes #116982 r? types
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/lib.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 0622aa2ee80..f27ce7fa0e0 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -182,13 +182,10 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> { } tcx.sess.track_errors(|| { - tcx.sess.time("impl_wf_inference", || { - tcx.hir().for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)) - }); - })?; - - tcx.sess.track_errors(|| { tcx.sess.time("coherence_checking", || { + // Check impls constrain their parameters + tcx.hir().for_each_module(|module| tcx.ensure().check_mod_impl_wf(module)); + for &trait_def_id in tcx.all_local_trait_impls(()).keys() { tcx.ensure().coherent_trait(trait_def_id); } |
