2012-07-16 58 views
0

对于下面的代码:什么“别名与非没有LP PTR”是指在锈

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()); 
} 

我得到一个错误:

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() 
        ^~~ 

如何解决呢?反正aliased ptr with a non-none lp是什么意思?

回答

2

内部编译器错误始终是Rust中的错误。当看到一个问题时,最好的做法是在https://github.com/mozilla/rust/issues处提交问题,其中包含导致错误的代码。

至于如何解决这个bug,如果你使用什么~[mut T]代替@[mut T]?我们最近添加了@载体,并且许多与它们一起工作的库代码仍然缺失。

+0

哈,我刚刚找到https://github.com/mozilla/rust/issues/2926,看到你已经提交了错误并找到了解决方法。干得不错! – 2012-07-16 18:42:47

+0

我的报告是重复的,原始错误https://github.com/mozilla/rust/issues/2797刚刚关闭。这个ICE在最近(0.3(30d94fe 2012-07-17 22:16:55 -0400))rustc中不再出现。谢谢! – 2012-07-18 12:52:58

相关问题