about summary refs log tree commit diff
path: root/tests/ui/traits/trait-upcasting/impossible-method-modulo-binders-2.rs
blob: c03b5145aa73bf86d46407b522f0c4a9c35ad862 (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
32
33
34
35
36
37
38
39
//@ build-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
// Regression test for #135462.
#![allow(coherence_leak_check)]

type A = fn(&'static ());
type B = fn(&());

trait Bound<P: WithAssoc>: From<GetAssoc<P>> {
}
impl Bound<B> for String {}

trait Trt<T> {
    fn __(&self, x: T) where T: Bound<A> {
        T::from(());
    }
}

impl<T, S> Trt<T> for S {}

type GetAssoc<T> = <T as WithAssoc>::Ty;

trait WithAssoc {
    type Ty;
}

impl WithAssoc for B {
    type Ty = String;
}

impl WithAssoc for A {
    type Ty = ();
}

fn main() {
    let x: &'static dyn Trt<String> = &();
}