about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-10 09:11:34 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-10 09:14:59 +1100
commitbb60ded24b6e4a8dfbcf8533b58c1a35b87bbb8b (patch)
tree57cd635b16cfb333e13544c8f617d9ec4f1e0359 /compiler
parentf4cfd872028398da2b2d85c368c51f4d007dc6af (diff)
downloadrust-bb60ded24b6e4a8dfbcf8533b58c1a35b87bbb8b.tar.gz
rust-bb60ded24b6e4a8dfbcf8533b58c1a35b87bbb8b.zip
Loosen an assertion to account for stashed errors.
The meaning of this assertion changed in #120828 when the meaning of
`has_errors` changed to exclude stashed errors. Evidently the new
meaning is too restrictive.

Fixes #120856.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index 50809a571b8..7250dc81faf 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -1283,7 +1283,8 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD
     let ty = tcx.type_of(def_id).instantiate_identity();
     if ty.references_error() {
         // If there is already another error, do not emit an error for not using a type parameter.
-        assert!(tcx.dcx().has_errors().is_some());
+        // Without the `stashed_err_count` part this can fail (#120856).
+        assert!(tcx.dcx().has_errors().is_some() || tcx.dcx().stashed_err_count() > 0);
         return;
     }