From 36990dfa3fdaa571c283ae9c06a765d6ca45a8da Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 11 Dec 2013 17:39:43 -0800 Subject: [PATCH] test: Add a test that POD types can be implicitly copied. --- src/test/compile-fail/kindck-pod.rs | 10 +++++++++- src/test/run-pass/can-copy-pod.rs | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/test/run-pass/can-copy-pod.rs diff --git a/src/test/compile-fail/kindck-pod.rs b/src/test/compile-fail/kindck-pod.rs index 29c101986ad2..60de67e214c0 100644 --- a/src/test/compile-fail/kindck-pod.rs +++ b/src/test/compile-fail/kindck-pod.rs @@ -10,6 +10,10 @@ // Test which of the builtin types are considered POD. +#[feature(managed_boxes)]; + +use std::rc::Rc; + fn assert_pod() { } trait Dummy { } @@ -71,8 +75,12 @@ fn test<'a,T,U:Pod>(_: &'a int) { // structs containing non-POD are not ok assert_pod::(); //~ ERROR does not fulfill `Pod` + + // managed or ref counted types are not ok + assert_pod::<@int>(); //~ ERROR does not fulfill `Pod` + assert_pod::>(); //~ ERROR does not fulfill `Pod` } -fn main() { +pub fn main() { } diff --git a/src/test/run-pass/can-copy-pod.rs b/src/test/run-pass/can-copy-pod.rs new file mode 100644 index 000000000000..03341e6f946e --- /dev/null +++ b/src/test/run-pass/can-copy-pod.rs @@ -0,0 +1,15 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that type parameters with the `Pod` are implicitly copyable. + +#[allow(dead_code)]; + +fn can_copy_pod(v: T) { + let _a = v; + let _b = v; +} + +pub fn main() {} + +