diff options
Diffstat (limited to 'src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs')
-rw-r--r-- | src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs b/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs new file mode 100644 index 000000000..0cd8eceef --- /dev/null +++ b/src/test/ui/repeat-expr/repeat-to-run-dtor-twice.rs @@ -0,0 +1,19 @@ +// Tests that one can't run a destructor twice with the repeated vector +// literal syntax. + +struct Foo { + x: isize, + +} + +impl Drop for Foo { + fn drop(&mut self) { + println!("Goodbye!"); + } +} + +fn main() { + let a = Foo { x: 3 }; + let _ = [ a; 5 ]; + //~^ ERROR the trait bound `Foo: Copy` is not satisfied [E0277] +} |