about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2023-12-08 07:27:47 +0000
committerAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2023-12-08 07:49:06 +0000
commit5fdb648fc3a672140f3fc8f98ee3268ed3fe5389 (patch)
treeeee74a75291b153ffdf3025691d9539979179e4a /tests
parent6c470a557ab97ee9e73ff5ab3d0872fbccad6645 (diff)
downloadrust-5fdb648fc3a672140f3fc8f98ee3268ed3fe5389.tar.gz
rust-5fdb648fc3a672140f3fc8f98ee3268ed3fe5389.zip
temporarily revert "ice on ambguity in mir typeck"
Reverts #116530
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/wf/unnormalized-projection-guides-inference.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/wf/unnormalized-projection-guides-inference.rs b/tests/ui/wf/unnormalized-projection-guides-inference.rs
new file mode 100644
index 00000000000..ca2d6c2e882
--- /dev/null
+++ b/tests/ui/wf/unnormalized-projection-guides-inference.rs
@@ -0,0 +1,24 @@
+// The WF requirements of the *unnormalized* form of type annotations
+// can guide inference.
+// check-pass
+
+pub trait EqualTo {
+    type Ty;
+}
+impl<X> EqualTo for X {
+    type Ty = X;
+}
+
+trait MyTrait<U: EqualTo<Ty = Self>> {
+    type Out;
+}
+impl<T, U: EqualTo<Ty = T>> MyTrait<U> for T {
+    type Out = ();
+}
+
+fn main() {
+    let _: <_ as MyTrait<u8>>::Out;
+    // We shoud be able to infer a value for the inference variable above.
+    // The WF of the unnormalized projection requires `u8: EqualTo<Ty = _>`,
+    // which is sufficient to guide inference.
+}