diff options
Diffstat (limited to 'tests/gats.rs')
-rw-r--r-- | tests/gats.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/gats.rs b/tests/gats.rs new file mode 100644 index 0000000..92e483c --- /dev/null +++ b/tests/gats.rs @@ -0,0 +1,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(); + } +} |