From b9761424395436cfca935e32e8cb323b284e24de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= <matthias.krueger@famsik.de>
Date: Sun, 7 Apr 2024 01:20:56 +0200
Subject: [PATCH] add test for  ice: unknown alias DefKind: AnonConst #116710

Fixes https://github.com/rust-lang/rust/issues/116710
---
 ...nown-alias-defkind-anonconst-ice-116710.rs | 15 +++++++++++++++
 ...-alias-defkind-anonconst-ice-116710.stderr | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.rs
 create mode 100644 tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.stderr

diff --git a/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.rs b/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.rs
new file mode 100644
index 00000000000..dd0b1e8c9f7
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.rs
@@ -0,0 +1,15 @@
+// ICE unknown alias DefKind: AnonConst
+// issue: rust-lang/rust#116710
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+struct A<const N: u32 = 1, const M: u32 = u8>;
+//~^ ERROR expected value, found builtin type `u8`
+
+trait Trait {}
+impl<const N: u32> Trait for A<N> {}
+
+impl<const N: u32> Trait for A<N> {}
+//~^ ERROR conflicting implementations of trait `Trait` for type `A<_>`
+
+pub fn main() {}
diff --git a/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.stderr b/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.stderr
new file mode 100644
index 00000000000..80ac96d4870
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/unknown-alias-defkind-anonconst-ice-116710.stderr
@@ -0,0 +1,19 @@
+error[E0423]: expected value, found builtin type `u8`
+  --> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:6:43
+   |
+LL | struct A<const N: u32 = 1, const M: u32 = u8>;
+   |                                           ^^ not a value
+
+error[E0119]: conflicting implementations of trait `Trait` for type `A<_>`
+  --> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:12:1
+   |
+LL | impl<const N: u32> Trait for A<N> {}
+   | --------------------------------- first implementation here
+LL |
+LL | impl<const N: u32> Trait for A<N> {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A<_>`
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0119, E0423.
+For more information about an error, try `rustc --explain E0119`.