1
Fork 0

test: Add a test that POD types can be implicitly copied.

This commit is contained in:
Patrick Walton 2013-12-11 17:39:43 -08:00
parent e7fbc1f553
commit 36990dfa3f
2 changed files with 24 additions and 1 deletions

View file

@ -10,6 +10,10 @@
// Test which of the builtin types are considered POD.
#[feature(managed_boxes)];
use std::rc::Rc;
fn assert_pod<T:Pod>() { }
trait Dummy { }
@ -71,8 +75,12 @@ fn test<'a,T,U:Pod>(_: &'a int) {
// structs containing non-POD are not ok
assert_pod::<MyNonpodStruct>(); //~ ERROR does not fulfill `Pod`
// managed or ref counted types are not ok
assert_pod::<@int>(); //~ ERROR does not fulfill `Pod`
assert_pod::<Rc<int>>(); //~ ERROR does not fulfill `Pod`
}
fn main() {
pub fn main() {
}

View file

@ -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<T:Pod>(v: T) {
let _a = v;
let _b = v;
}
pub fn main() {}