diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index ec82644ea5ba4..b0a6922ff72bb 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -1637,7 +1637,6 @@ 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()); return; } diff --git a/tests/crashes/135341.rs b/tests/crashes/135341.rs deleted file mode 100644 index 0e33242a5f5a0..0000000000000 --- a/tests/crashes/135341.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ known-bug: #135341 -type A = B; -type B = _; - -pub fn main() {} diff --git a/tests/ui/wf/ice-hir-wf-issue-135341.rs b/tests/ui/wf/ice-hir-wf-issue-135341.rs new file mode 100644 index 0000000000000..7428575aee0db --- /dev/null +++ b/tests/ui/wf/ice-hir-wf-issue-135341.rs @@ -0,0 +1,4 @@ +type A = B; +type B = _; //~ ERROR the placeholder `_` is not allowed within types on item signatures for type aliases + +fn main() {} diff --git a/tests/ui/wf/ice-hir-wf-issue-135341.stderr b/tests/ui/wf/ice-hir-wf-issue-135341.stderr new file mode 100644 index 0000000000000..c568129cf56d0 --- /dev/null +++ b/tests/ui/wf/ice-hir-wf-issue-135341.stderr @@ -0,0 +1,9 @@ +error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases + --> $DIR/ice-hir-wf-issue-135341.rs:2:10 + | +LL | type B = _; + | ^ not allowed in type signatures + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0121`.