diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2020-07-23 21:59:20 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2020-10-06 11:19:31 +0100 |
| commit | cfee49593d756bb97018d1d2ac194e0821d2dfca (patch) | |
| tree | 6b93b9dc025cbf3275b384cc52fcd39d250ad3dd /src | |
| parent | bc08b791bce1c5b31052da5dfda74302b6f61a99 (diff) | |
| download | rust-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.rs | 23 |
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() {} |
