For the following code:
import io::*;
import to_str::*;
impl <T : to_str copy> of to_str for @[mut T] {
fn to_str() -> str {
let tmp = copy self;
tmp.map(|x| { x.to_str() }).to_str()
}
}
fn main() {
println((@[mut 1, 2, 3]).to_str());
}
rustc-0.3 produces an ICE:
example.rs:7:8: 7:11 error: internal compiler error: aliased ptr with a non-none lp
example.rs:7 tmp.map(|x| { x.to_str() }).to_str()
^~~
This is not happens with unique boxes (~[mut 1,2,3]/for ~[mut T])
Also tested on git snapshot (rustc 0.3 (6081eb7 2012-07-15 05:41:24 -0700)) -- same thing, except i had to change str to ~str to make it not fail with error: bare 'str' is not a type
For the following code:
rustc-0.3 produces an ICE:
This is not happens with unique boxes (
~[mut 1,2,3]/for ~[mut T])Also tested on git snapshot (
rustc 0.3 (6081eb7 2012-07-15 05:41:24 -0700)) -- same thing, except i had to changestrto~strto make it not fail witherror: bare 'str' is not a type