about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-01-18 09:11:05 +0100
committerGitHub <noreply@github.com>2025-01-18 09:11:05 +0100
commit233fd55e6e60ec0c19454ac382e5a8efbbd1aceb (patch)
treebee66eeb00f8e9e6ab140ff49a1e15288f7db5de
parent8fec08b988ba1acbefaaeec9b2c49beb5419bfb0 (diff)
parent865a09d50a6eb5bb079310f0777e4e7afd1c676d (diff)
downloadrust-233fd55e6e60ec0c19454ac382e5a8efbbd1aceb.tar.gz
rust-233fd55e6e60ec0c19454ac382e5a8efbbd1aceb.zip
Rollup merge of #135611 - chenyukang:yukang-fix-135341-ice-crash, r=oli-obk
Remove unnecessary assertion for reference error

Fixes #135341

From comment: https://github.com/rust-lang/rust/issues/135341#issuecomment-2594430504

r? ``@oli-obk``
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs1
-rw-r--r--tests/crashes/135341.rs5
-rw-r--r--tests/ui/wf/ice-hir-wf-issue-135341.rs4
-rw-r--r--tests/ui/wf/ice-hir-wf-issue-135341.stderr9
4 files changed, 13 insertions, 6 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index ec82644ea5b..b0a6922ff72 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 0e33242a5f5..00000000000
--- a/tests/crashes/135341.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-//@ known-bug: #135341
-type A<T> = 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 00000000000..7428575aee0
--- /dev/null
+++ b/tests/ui/wf/ice-hir-wf-issue-135341.rs
@@ -0,0 +1,4 @@
+type A<T> = 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 00000000000..c568129cf56
--- /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`.