rust/tests/ui/traits/copy-is-not-modulo-regions.rs

20 lines
375 B
Rust
Raw Normal View History

// 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> {}
2023-03-07 23:55:51 +00:00
//[not_static]~^ the trait `Copy` cannot be implemented for this type
#[cfg(yes_static)]
impl<'any> Copy for Bar<'static> {}
fn main() {}