From cfee49593d756bb97018d1d2ac194e0821d2dfca Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Thu, 23 Jul 2020 21:59:20 +0100 Subject: Handle multiple applicable projection candidates --- .../associated-types-bound-ambiguity.rs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/ui/associated-types/associated-types-bound-ambiguity.rs (limited to 'src/test') 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 + From; + type Repr2: From + From; + + fn method() { + Self::Repr::from(10); + Self::Repr2::from(10); + } +} + +fn function() { + T::Repr::from(10); + T::Repr2::from(10); +} + +fn main() {} -- cgit 1.4.1-3-g733a5