File tree 2 files changed +57
-0
lines changed
2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Regression test for #81317: type can no longer be infered as of 1.49
2
+ //@ check-fail
3
+
4
+ use std:: ops:: BitXor ;
5
+
6
+ pub struct S ;
7
+
8
+ pub trait P {
9
+ type I : Into < u64 > + Into < S > ;
10
+ }
11
+
12
+ pub fn decrypt_portion < T : P > ( index : T :: I ) {
13
+ let iv = S ^ index. into ( ) ;
14
+ //~^ ERROR type annotations needed
15
+ & iv. to_bytes_be ( ) ;
16
+ }
17
+
18
+ impl S {
19
+ fn to_bytes_be ( & self ) -> & [ u8 ] {
20
+ & [ ]
21
+ }
22
+ }
23
+
24
+ impl BitXor for S {
25
+ type Output = S ;
26
+
27
+ fn bitxor ( self , _rhs : Self ) -> Self :: Output {
28
+ S
29
+ }
30
+ }
31
+
32
+ impl < ' a > BitXor < & ' a S > for S {
33
+ type Output = S ;
34
+
35
+ fn bitxor ( self , _rhs : & ' a S ) -> Self :: Output {
36
+ S
37
+ }
38
+ }
39
+
40
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0282]: type annotations needed
2
+ --> $DIR/regression-issue-81317.rs:13:9
3
+ |
4
+ LL | let iv = S ^ index.into();
5
+ | ^^
6
+ LL |
7
+ LL | &iv.to_bytes_be();
8
+ | -- type must be known at this point
9
+ |
10
+ help: consider giving `iv` an explicit type
11
+ |
12
+ LL | let iv: /* Type */ = S ^ index.into();
13
+ | ++++++++++++
14
+
15
+ error: aborting due to 1 previous error
16
+
17
+ For more information about this error, try `rustc --explain E0282`.
You can’t perform that action at this time.
0 commit comments