diff options
Diffstat (limited to 'tests/ui/traits/copy-is-not-modulo-regions.rs')
-rw-r--r-- | tests/ui/traits/copy-is-not-modulo-regions.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/traits/copy-is-not-modulo-regions.rs b/tests/ui/traits/copy-is-not-modulo-regions.rs new file mode 100644 index 000000000..adb870237 --- /dev/null +++ b/tests/ui/traits/copy-is-not-modulo-regions.rs @@ -0,0 +1,19 @@ +// revisions: not_static yes_static +//[yes_static] check-pass + +#[derive(Clone)] +struct Foo<'lt>(&'lt ()); + +impl Copy for Foo<'static> {} + +#[derive(Clone)] +struct Bar<'lt>(Foo<'lt>); + +#[cfg(not_static)] +impl<'any> Copy for Bar<'any> {} +//[not_static]~^ the trait `Copy` may not be implemented for this type + +#[cfg(yes_static)] +impl<'any> Copy for Bar<'static> {} + +fn main() {} |