mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 04:08:40 +00:00
24 lines
535 B
Rust
24 lines
535 B
Rust
//! 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
|
|
_ => {}
|
|
}
|
|
}
|