Skip to content

Commit 7fc84ac

Browse files
committed
expand comment
1 parent 4ba683e commit 7fc84ac

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/ui/type-inference/regression-issue-81317.rs

+29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
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

433
use std::ops::BitXor;

0 commit comments

Comments
 (0)