about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-12-08 23:15:14 +0100
committerGitHub <noreply@github.com>2023-12-08 23:15:14 +0100
commita255b52525c11e141e0245f36d249a3771511147 (patch)
treecfed38ff8e76ac946b2e3e2c3fbc6cdc8d30d2af /tests
parent943fa33dafe8abcc299110682d272183f198ab5e (diff)
parent5fdb648fc3a672140f3fc8f98ee3268ed3fe5389 (diff)
downloadrust-a255b52525c11e141e0245f36d249a3771511147.tar.gz
rust-a255b52525c11e141e0245f36d249a3771511147.zip
Rollup merge of #118736 - aliemjay:revert-ice-on-ambig, r=compiler-errors
temporarily revert "ice on ambguity in mir typeck"

Reverts #116530 as a temporary measure to fix #117577. That issue should be ultimately fixed by checking WF of type annotations prior to normalization, which is implemented in #104098 but this PR is intended to be backported to beta.

r? ``@compiler-errors`` (the reviewer of the reverted PR)
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.
+}