about summary refs log tree commit diff
path: root/tests/ui/pattern/deref-patterns/recursion-limit.rs
blob: c5fe520f6f1ab8b37a07230cb16b6dce2538c254 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! Test that implicit deref patterns respect the recursion limit
#![feature(deref_patterns)]
#![allow(incomplete_features)]
#![recursion_limit = "8"]

use std::ops::Deref;

struct Cyclic;
impl Deref for Cyclic {
    type Target = Cyclic;
    fn deref(&self) -> &Cyclic {
        &Cyclic
    }
}

fn main() {
    match &Box::new(Cyclic) {
        () => {}
        //~^ ERROR: reached the recursion limit while auto-dereferencing `Cyclic`
        //~| ERROR: the trait bound `Cyclic: DerefPure` is not satisfied
        _ => {}
    }
}