Created
April 24, 2013 00:23
-
-
Save dymk/5448608 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 Circle { radius: int } | |
| trait Shape {} | |
| impl Shape for Circle {} | |
| fn main() { | |
| //Doesn't crash if 'all' is immutable: | |
| // let all: ~[~Shape] = ~[~Circle{radius: 2} as ~Shape]; | |
| //Doesn't crash if 'all' is mutable: | |
| // let mut all: ~[~Shape] = ~[~Circle{radius: 2} as ~Shape]; | |
| //Does crash if 'all' is mutable, and is pushed to | |
| let mut all: ~[~Shape] = ~[]; | |
| all.push(~Circle{radius: 2} as ~Shape); | |
| //makes it here, then crashes when returning from main | |
| io::println("kaboom!"); | |
| } | |
| // > 'kaboom!' | |
| // > fatal crash on Windows 7 x64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment