diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-15 10:29:52 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-18 23:36:01 +0100 |
commit | 2a8a0601afcb82d90d0766db5a954b70b10f856d (patch) | |
tree | 0271062335d450e151598d4ad9aa327ffa0dfaea /tests/gats.rs |
publishv0.1.0
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(); + } +} |