Closed
Description
Using rustc 0.6, the compiled executable of the following code results in a segfault. I'm not exactly sure why, but I suppose this shouldn't happen ;).
Btw, using @Animal
instead of ~Animal
works fine. Using @Cage
or ~Cage
doesn't matter (both crash). Building ~Cage
directly in main()
also works fine.
pub trait Animal { }
struct Cage {
animal: ~Animal,
}
fn capture (animal: ~Animal) -> ~Cage {
let cage = ~Cage { animal: animal };
debug!("still alive");
cage
}
struct Duck { foo: int }
impl Animal for Duck { }
fn main () {
let duck = ~Duck { foo: 123 };
let _ = capture(duck as ~Animal);
debug!("never reached");
}
zargony@lina:~$ uname -a
Darwin lina.fritz.box 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
zargony@lina:~$ rustc --version
rustc 0.6
host: x86_64-apple-darwin
Metadata
Metadata
Assignees
Labels
No labels