about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSkgland <bennet.blessmann+github@googlemail.com>2025-05-05 20:40:44 +0200
committerBennet Bleßmann <bennet.blessmann+github@googlemail.com>2025-05-05 20:40:44 +0200
commit7fc84ac964b45955cc9beb7ec269d3d06a3591ab (patch)
treea5299768d4930d6c006dca9817dea0145a860a5c
parent4ba683ee529ed87cc52d4983492dbf89b495ca0f (diff)
expand comment
-rw-r--r--tests/ui/type-inference/regression-issue-81317.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/type-inference/regression-issue-81317.rs b/tests/ui/type-inference/regression-issue-81317.rs
index 50deb013d4b..39c91948426 100644
--- a/tests/ui/type-inference/regression-issue-81317.rs
+++ b/tests/ui/type-inference/regression-issue-81317.rs
@@ -1,4 +1,33 @@
 // Regression test for #81317: type can no longer be infered as of 1.49
+//
+// The problem is that the xor operator and the index.into() each have two candidate impls that could apply
+// { S as BitXor<S>, S as BitXor<&'a S> } for xor and
+// { T::I as Into<u64>, T::I as Into<S> } for index.into()
+// previously inference was able to infer that the only valid combination was
+// S as BitXor<S> and T::I as Into<S>
+//
+// after rust-lang/rust#73905 this is no longer infered
+//
+// the error message could be better e.g. when iv is unused or has an an explicitly specified type S
+// there is currently the following help message
+//
+// error[E0284]: type annotations needed
+//   --> src/main.rs:13:24
+//    |
+// 42 |     let iv = S ^ index.into();
+//    |                -       ^^^^
+//    |                |
+//    |                type must be known at this point
+//    |
+//    = note: cannot satisfy `<S as BitXor<_>>::Output == _`
+// help: try using a fully qualified path to specify the expected types
+//    |
+// 42 -     let iv = S ^ index.into();
+// 42 +     let iv = S ^ <<T as P>::I as Into<T>>::into(index);
+//
+// this is better as it's actually sufficent to fix the problem,
+// while just specifying the type of iv as currently suggested is insufficent
+//
 //@ check-fail
 
 use std::ops::BitXor;