File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change
1
+ //! Regression test for issue #11881
2
+ //!
3
+ //! Originally, the compiler would ICE when trying to parameterize on certain encoder types
4
+ //! due to issues with higher-ranked trait bounds and lifetime inference. This test checks
5
+ //! that various encoder patterns work correctly:
6
+ //! - Generic encoders with associated error types
7
+ //! - Higher-ranked trait bounds (for<'r> Encodable<JsonEncoder<'r>>)
8
+ //! - Multiple encoder implementations for the same type
9
+ //! - Polymorphic encoding functions
10
+
1
11
//@ run-pass
2
12
3
13
#![ allow( unused_must_use) ]
4
14
#![ allow( dead_code) ]
5
15
#![ allow( unused_imports) ]
6
16
7
- use std:: fmt;
8
- use std:: io:: prelude:: * ;
9
17
use std:: io:: Cursor ;
10
- use std:: slice ;
18
+ use std:: io :: prelude :: * ;
11
19
use std:: marker:: PhantomData ;
20
+ use std:: { fmt, slice} ;
12
21
13
22
trait Encoder {
14
23
type Error ;
@@ -45,7 +54,6 @@ impl Encoder for OpaqueEncoder {
45
54
type Error = ( ) ;
46
55
}
47
56
48
-
49
57
struct Foo {
50
58
baz : bool ,
51
59
}
@@ -69,7 +77,6 @@ impl<S: Encoder> Encodable<S> for Bar {
69
77
enum WireProtocol {
70
78
JSON ,
71
79
Opaque ,
72
- // ...
73
80
}
74
81
75
82
fn encode_json < T : for < ' a > Encodable < JsonEncoder < ' a > > > ( val : & T , wr : & mut Cursor < Vec < u8 > > ) {
You can’t perform that action at this time.
0 commit comments