aboutsummaryrefslogtreecommitdiff
path: root/tests/gats.rs
blob: 92e483cee55080268eeb8071f022baed06d303e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! This test can be run with `cargo +nightly test --features=nightly`
#![cfg_attr(feature = "nightly", feature(generic_associated_types))]

#[cfg(feature = "nightly")]
mod test_gats {
    #[dynamize::dynamize]
    pub trait MyTrait {
        type A<'a>: Into<&'a str>;

        fn test1<'b>(&self) -> Self::A<'b>;
    }

    fn test<T: MyTrait>(mut some: T) {
        let dyn_trait: &dyn DynMyTrait = &some;
        let _: &str = dyn_trait.test1();
    }
}