diff options
author | Martin Fischer <martin@push-f.com> | 2021-11-20 18:53:55 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-11-20 19:19:29 +0100 |
commit | 9044eb941a310e4120dab93a43e6630efef72e4a (patch) | |
tree | 40940640b1ace6a11a6b89ea04a0d70b1f67e38a /tests/doctests.md | |
parent | 3170127a4ef79c43018775934c7e0444dc828b2d (diff) |
assert that dynamized traits are object-safe
Diffstat (limited to 'tests/doctests.md')
-rw-r--r-- | tests/doctests.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/doctests.md b/tests/doctests.md new file mode 100644 index 0000000..ef557fe --- /dev/null +++ b/tests/doctests.md @@ -0,0 +1,19 @@ +Tests that the object-safety assertion via `impl dyn` is working: + +```rust compile_fail +trait ObjectUnsafe: Sized {} + +#[dynamize::dynamize] +trait Trait: ObjectUnsafe {} +``` + +```rust compile_fail +trait ObjectUnsafe: Sized {} + +#[dynamize::dynamize] +trait Trait { + type A: ObjectUnsafe; + + fn f(&self) -> Self::A; +} +``` |