2012-07-16 57 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

相關問題