|
1 | 1 | // Regression test for #81317: type can no longer be infered as of 1.49
|
2 | 2 | //
|
3 |
| -// The problem is that the xor operator and the index.into() each have two candidate impls that could apply |
| 3 | +// The problem is that the xor operator and the index.into() call |
| 4 | +// each have two candidate impls that could apply |
4 | 5 | // { S as BitXor<S>, S as BitXor<&'a S> } for xor and
|
5 | 6 | // { T::I as Into<u64>, T::I as Into<S> } for index.into()
|
6 | 7 | // previously inference was able to infer that the only valid combination was
|
7 | 8 | // S as BitXor<S> and T::I as Into<S>
|
8 | 9 | //
|
9 | 10 | // after rust-lang/rust#73905 this is no longer infered
|
10 | 11 | //
|
11 |
| -// the error message could be better e.g. when iv is unused or has an an explicitly specified type S |
| 12 | +// the error message could be better e.g. |
| 13 | +// when iv is unused or has an an explicitly specified type S |
12 | 14 | // there is currently the following help message
|
13 | 15 | //
|
14 | 16 | // error[E0284]: type annotations needed
|
15 | 17 | // --> src/main.rs:13:24
|
16 | 18 | // |
|
17 |
| -// 42 | let iv = S ^ index.into(); |
| 19 | +// 44 | let iv = S ^ index.into(); |
18 | 20 | // | - ^^^^
|
19 | 21 | // | |
|
20 | 22 | // | type must be known at this point
|
21 | 23 | // |
|
22 | 24 | // = note: cannot satisfy `<S as BitXor<_>>::Output == _`
|
23 | 25 | // help: try using a fully qualified path to specify the expected types
|
24 | 26 | // |
|
25 |
| -// 42 - let iv = S ^ index.into(); |
26 |
| -// 42 + let iv = S ^ <<T as P>::I as Into<T>>::into(index); |
| 27 | +// 44 - let iv = S ^ index.into(); |
| 28 | +// 44 + let iv = S ^ <<T as P>::I as Into<T>>::into(index); |
27 | 29 | //
|
28 | 30 | // this is better as it's actually sufficent to fix the problem,
|
29 | 31 | // while just specifying the type of iv as currently suggested is insufficent
|
|
0 commit comments