about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-03-24 10:19:25 +0100
committerMatthias Krüger <matthias.krueger@famsik.de>2024-03-24 10:19:25 +0100
commitb151e066591728798cb9718628d1e694eda99b78 (patch)
tree988ee207945fae61e7b45b388f3b29a837a1bba7
parentcdea6d83824c9d8d03dc3d0e9869d1b06617e2db (diff)
downloadrust-b151e066591728798cb9718628d1e694eda99b78.tar.gz
rust-b151e066591728798cb9718628d1e694eda99b78.zip
add test for ICE: min_specialization: Ok(['?0, Const { ty: usize, kind: Leaf(0x0000000000000000) }]) is not fully resolved #113045
Fixes https://github.com/rust-lang/rust/issues/113045
-rw-r--r--tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.rs15
-rw-r--r--tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.stderr21
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.rs b/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.rs
new file mode 100644
index 00000000000..6f0f233b870
--- /dev/null
+++ b/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.rs
@@ -0,0 +1,15 @@
+// ICE min_specialization:
+// Ok(['?0, Const { ty: usize, kind: Leaf(0x0000000000000000) }]) is not fully resolved
+// issue: rust-lang/rust#113045
+
+#![feature(min_specialization)]
+
+trait X {}
+
+impl<'a, const N: usize> X for [(); N] {}
+
+impl<'a, Unconstrained> X for [(); 0] {}
+//~^ ERROR the type parameter `Unconstrained` is not constrained by the impl trait, self type, or predicates
+//~| ERROR specialization impl does not specialize any associated items
+
+fn main() {}
diff --git a/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.stderr b/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.stderr
new file mode 100644
index 00000000000..acbdb9b0a30
--- /dev/null
+++ b/tests/ui/specialization/min_specialization/ice-const-not-fully-resolved-113045.stderr
@@ -0,0 +1,21 @@
+error[E0207]: the type parameter `Unconstrained` is not constrained by the impl trait, self type, or predicates
+  --> $DIR/ice-const-not-fully-resolved-113045.rs:11:10
+   |
+LL | impl<'a, Unconstrained> X for [(); 0] {}
+   |          ^^^^^^^^^^^^^ unconstrained type parameter
+
+error: specialization impl does not specialize any associated items
+  --> $DIR/ice-const-not-fully-resolved-113045.rs:11:1
+   |
+LL | impl<'a, Unconstrained> X for [(); 0] {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: impl is a specialization of this impl
+  --> $DIR/ice-const-not-fully-resolved-113045.rs:9:1
+   |
+LL | impl<'a, const N: usize> X for [(); N] {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0207`.