about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-07 19:15:34 +0100
committerGitHub <noreply@github.com>2025-03-07 19:15:34 +0100
commit0defc4f27f3e00df9020b7f81e43ef7f9537dea8 (patch)
treec3fe7529e093ebb747cb2395ece3a7b0bd072f92 /tests
parent63c548d82c893df5c5c05ecb31ee9dbb183eb3e3 (diff)
parentaf92a33deef026844c4594cc5eb7484527403425 (diff)
Rollup merge of #137977 - nnethercote:less-kw-Empty-1, r=spastorino
Reduce `kw::Empty` usage, part 1

This PR fixes some confusing `kw::Empty` usage, fixing a crash test along the way.

r? ```@spastorino```
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/133426.rs12
-rw-r--r--tests/ui/lowering/no-name-for-DefPath-issue-133426.rs20
-rw-r--r--tests/ui/lowering/no-name-for-DefPath-issue-133426.stderr31
3 files changed, 51 insertions, 12 deletions
diff --git a/tests/crashes/133426.rs b/tests/crashes/133426.rs
deleted file mode 100644
index 307a94c0f6c..00000000000
--- a/tests/crashes/133426.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ known-bug: #133426
-
-fn a(
-    _: impl Iterator<
-        Item = [(); {
-                   match *todo!() { ! };
-               }],
-    >,
-) {
-}
-
-fn b(_: impl Iterator<Item = { match 0 { ! } }>) {}
diff --git a/tests/ui/lowering/no-name-for-DefPath-issue-133426.rs b/tests/ui/lowering/no-name-for-DefPath-issue-133426.rs
new file mode 100644
index 00000000000..fc3b51b40a5
--- /dev/null
+++ b/tests/ui/lowering/no-name-for-DefPath-issue-133426.rs
@@ -0,0 +1,20 @@
+//! Test for the crash in #133426, caused by an empty symbol being used for a
+//! type name.
+
+#![allow(incomplete_features)]
+#![feature(never_patterns)]
+
+fn a(
+    _: impl Iterator<
+        Item = [(); {
+            match *todo!() { ! }; //~ ERROR type `!` cannot be dereferenced
+        }],
+    >,
+) {
+}
+
+fn b(_: impl Iterator<Item = { match 0 { ! } }>) {}
+//~^ ERROR associated const equality is incomplete
+//~| ERROR expected type, found constant
+
+fn main() {}
diff --git a/tests/ui/lowering/no-name-for-DefPath-issue-133426.stderr b/tests/ui/lowering/no-name-for-DefPath-issue-133426.stderr
new file mode 100644
index 00000000000..555d8eec6ba
--- /dev/null
+++ b/tests/ui/lowering/no-name-for-DefPath-issue-133426.stderr
@@ -0,0 +1,31 @@
+error[E0658]: associated const equality is incomplete
+  --> $DIR/no-name-for-DefPath-issue-133426.rs:16:23
+   |
+LL | fn b(_: impl Iterator<Item = { match 0 { ! } }>) {}
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
+   = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0614]: type `!` cannot be dereferenced
+  --> $DIR/no-name-for-DefPath-issue-133426.rs:10:19
+   |
+LL |             match *todo!() { ! };
+   |                   ^^^^^^^^ can't be dereferenced
+
+error: expected type, found constant
+  --> $DIR/no-name-for-DefPath-issue-133426.rs:16:30
+   |
+LL | fn b(_: impl Iterator<Item = { match 0 { ! } }>) {}
+   |                       ----   ^^^^^^^^^^^^^^^^^ unexpected constant
+   |                       |
+   |                       expected a type because of this associated type
+   |
+note: the associated type is defined here
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0614, E0658.
+For more information about an error, try `rustc --explain E0614`.