about summary refs log tree commit diff
path: root/tests/ui/generic-const-items
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-07 01:45:31 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2024-04-07 01:45:31 +0200
commit88aa71f1084cae330345f5c904112cad1686e003 (patch)
tree1e11d1faa90b7f2f002914422ab9a5a7d66e2654 /tests/ui/generic-const-items
parentb9761424395436cfca935e32e8cb323b284e24de (diff)
downloadrust-88aa71f1084cae330345f5c904112cad1686e003.tar.gz
rust-88aa71f1084cae330345f5c904112cad1686e003.zip
add test for assertion failed: !value.has_infer() #115806
Fixes https://github.com/rust-lang/rust/issues/115806
Diffstat (limited to 'tests/ui/generic-const-items')
-rw-r--r--tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.rs19
-rw-r--r--tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.stderr14
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.rs b/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.rs
new file mode 100644
index 00000000000..2607013ec63
--- /dev/null
+++ b/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.rs
@@ -0,0 +1,19 @@
+// ICE: assertion failed: !value.has_infer()
+// issue: rust-lang/rust#115806
+#![feature(associated_const_equality)]
+#![allow(incomplete_features)]
+
+pub struct NoPin;
+
+impl<TA> Pins<TA> for NoPin {}
+
+pub trait PinA<PER> {
+    const A: &'static () = &();
+}
+
+pub trait Pins<USART> {}
+
+impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { &() }> {}
+//~^ ERROR conflicting implementations of trait `Pins<_>` for type `NoPin`
+
+pub fn main() {}
diff --git a/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.stderr b/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.stderr
new file mode 100644
index 00000000000..9a9baaddcba
--- /dev/null
+++ b/tests/ui/generic-const-items/assoc-const-no-infer-ice-115806.stderr
@@ -0,0 +1,14 @@
+error[E0119]: conflicting implementations of trait `Pins<_>` for type `NoPin`
+  --> $DIR/assoc-const-no-infer-ice-115806.rs:16:1
+   |
+LL | impl<TA> Pins<TA> for NoPin {}
+   | --------------------------- first implementation here
+...
+LL | impl<USART, T> Pins<USART> for T where T: PinA<USART, A = { &() }> {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `NoPin`
+   |
+   = note: downstream crates may implement trait `PinA<_>` for type `NoPin`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0119`.