Created
March 18, 2013 19:11
-
-
Save SiegeLord/5189925 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct A { a : int } | |
trait TA { } | |
impl TA for A { } | |
fn test_struct(a : &A) | |
{ | |
} | |
fn test_trait(a : &TA) | |
{ | |
} | |
fn main() | |
{ | |
let a = ~A{a : 1}; | |
let b = A{a : 1}; | |
let c = @A{a : 1}; | |
// This works fine | |
test_struct(a); | |
test_struct(&b); | |
test_struct(c); | |
// How to write these? | |
test_trait(a as &TA); | |
test_trait(&a as &TA); | |
test_trait(a as &TA); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment