about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2020-07-23 21:59:20 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2020-10-06 11:19:31 +0100
commitcfee49593d756bb97018d1d2ac194e0821d2dfca (patch)
tree6b93b9dc025cbf3275b384cc52fcd39d250ad3dd /src
parentbc08b791bce1c5b31052da5dfda74302b6f61a99 (diff)
downloadrust-cfee49593d756bb97018d1d2ac194e0821d2dfca.tar.gz
rust-cfee49593d756bb97018d1d2ac194e0821d2dfca.zip
Handle multiple applicable projection candidates
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/associated-types/associated-types-bound-ambiguity.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/associated-types/associated-types-bound-ambiguity.rs b/src/test/ui/associated-types/associated-types-bound-ambiguity.rs
new file mode 100644
index 00000000000..9f179b6454e
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-bound-ambiguity.rs
@@ -0,0 +1,23 @@
+// Make sure that if there are multiple applicable bounds on a projection, we
+// consider them ambiguous. In this test we are initially trying to solve
+// `Self::Repr: From<_>`, which is ambiguous until we later infer `_` to
+// `{integer}`.
+
+// check-pass
+
+trait PrimeField: Sized {
+    type Repr: From<u64> + From<Self>;
+    type Repr2: From<Self> + From<u64>;
+
+    fn method() {
+        Self::Repr::from(10);
+        Self::Repr2::from(10);
+    }
+}
+
+fn function<T: PrimeField>() {
+    T::Repr::from(10);
+    T::Repr2::from(10);
+}
+
+fn main() {}