about summary refs log tree commit diff
path: root/tests/ui/impl-trait/method/method-resolution5-deref.rs
blob: 6133a8efe244d3a360669a9472d28886cf851670 (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
//! The recursive method call yields the opaque type. We want
//! to use the trait candidate for `impl Foo` here while not
//! applying it for the `impl Deref`.

//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ check-pass

use std::ops::Deref;
trait Foo {
    fn method(&self) {}
}
impl Foo for u32 {}
fn via_deref() -> impl Deref<Target = impl Foo> {
    if false {
        via_deref().method();
    }

    Box::new(1u32)
}

fn via_deref_nested() -> Box<impl Deref<Target = impl Foo>> {
    if false {
        via_deref_nested().method();
    }

    Box::new(Box::new(1u32))
}

fn main() {}