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+
111//@ run-pass
212
313#![ allow( unused_must_use) ]
414#![ allow( dead_code) ]
515#![ allow( unused_imports) ]
616
7- use std:: fmt;
8- use std:: io:: prelude:: * ;
917use std:: io:: Cursor ;
10- use std:: slice ;
18+ use std:: io :: prelude :: * ;
1119use std:: marker:: PhantomData ;
20+ use std:: { fmt, slice} ;
1221
1322trait Encoder {
1423 type Error ;
@@ -45,7 +54,6 @@ impl Encoder for OpaqueEncoder {
4554 type Error = ( ) ;
4655}
4756
48-
4957struct Foo {
5058 baz : bool ,
5159}
@@ -69,7 +77,6 @@ impl<S: Encoder> Encodable<S> for Bar {
6977enum WireProtocol {
7078 JSON ,
7179 Opaque ,
72- // ...
7380}
7481
7582fn 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