about summary refs log tree commit diff
path: root/tests/crashes/92470.rs
blob: a3c518f5ec62f0484852b253115ae5d8a62af5f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//@ known-bug: #92470
fn main() {
    encode(&mut EncoderImpl);
}

pub trait Encoder {
    type W;

    fn writer(&self) -> Self::W;
}

fn encode<E: Encoder>(mut encoder: E) {
    encoder.writer();
    encode(&mut encoder);
}

struct EncoderImpl;

impl Encoder for EncoderImpl {
    type W = ();

    fn writer(&self) {}
}

impl<'a, T: Encoder> Encoder for &'a mut T {
    type W = T::W;

    fn writer(&self) -> Self::W {
        panic!()
    }
}