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