diff options
Diffstat (limited to 'src/test/ui/derives/derive-assoc-type-not-impl.rs')
-rw-r--r-- | src/test/ui/derives/derive-assoc-type-not-impl.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/derives/derive-assoc-type-not-impl.rs b/src/test/ui/derives/derive-assoc-type-not-impl.rs new file mode 100644 index 000000000..0f642d63a --- /dev/null +++ b/src/test/ui/derives/derive-assoc-type-not-impl.rs @@ -0,0 +1,19 @@ +trait Foo { + type X; + fn method(&self) {} +} + +#[derive(Clone)] +struct Bar<T: Foo> { + x: T::X, +} + +struct NotClone; + +impl Foo for NotClone { + type X = i8; +} + +fn main() { + Bar::<NotClone> { x: 1 }.clone(); //~ ERROR +} |