about summary refs log tree commit diff
path: root/tests/ui/methods/probe-error-on-infinite-deref.rs
blob: 196d026438be848a9e429461691c7514552731d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//@ compile-flags: -Zwrite-long-types-to-disk=yes
use std::ops::Deref;

// Make sure that method probe error reporting doesn't get too tangled up
// on this infinite deref impl. See #130224.

struct Wrap<T>(T);
impl<T> Deref for Wrap<T> {
    type Target = Wrap<Wrap<T>>;
    fn deref(&self) -> &Wrap<Wrap<T>> { todo!() }
}

fn main() {
    Wrap(1).lmao();
    //~^ ERROR reached the recursion limit
    //~| ERROR no method named `lmao`
}