Skip to content

Commit bedd9d7

Browse files
committed
moved renamed docs formatted | issue-11881.rs
1 parent 62f53e3 commit bedd9d7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tests/ui/issue-11881.rs renamed to tests/ui/traits/encoder-trait-bounds-regression.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
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::*;
917
use std::io::Cursor;
10-
use std::slice;
18+
use std::io::prelude::*;
1119
use std::marker::PhantomData;
20+
use std::{fmt, slice};
1221

1322
trait Encoder {
1423
type Error;
@@ -45,7 +54,6 @@ impl Encoder for OpaqueEncoder {
4554
type Error = ();
4655
}
4756

48-
4957
struct Foo {
5058
baz: bool,
5159
}
@@ -69,7 +77,6 @@ impl<S: Encoder> Encodable<S> for Bar {
6977
enum WireProtocol {
7078
JSON,
7179
Opaque,
72-
// ...
7380
}
7481

7582
fn encode_json<T: for<'a> Encodable<JsonEncoder<'a>>>(val: &T, wr: &mut Cursor<Vec<u8>>) {

0 commit comments

Comments
 (0)