You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Internal compiler error: task failed at 'Unsupported constant expr' #5448
The code and the compiler backtrace output is in this gist.
The relevant parts of the compiler output seem to be:
rust: task failed at 'Unsupported constant expr', /home/leah/rust-0.5/src/librustc/middle/const_eval.rs:238
and maybe:
rust: task failed at 'explicit failure', /home/leah/rust-0.5/src/librustc/rustc.rc:425
The part of my code that I think causes it is this:
#[test]
fn insert_value() {
let bvt : Level1<int> = Level1 { data : @mut([@0,..@31]), current : 0};
bvt.append(@5);
}
Specifically, [@0,..@31] seems to be the change that triggered this bug.
I'm trying to find a way to create a static mutable array of managed pointers to ints, of size 32. Needing this might very well be a side-effect of my not knowing how to design/implement data structures in rust, but it's what I need to make the types work out at this point (to actually instantiate a Level1), I think.
"@0" means "allocate a box on the managed heap and write 0 into it", so you can't do that statically; the heap doesn't exist statically. I'm not sure if that's clear or not, but I could maybe say more if I knew more about what you're trying to do...
I'm fairly confused about pointers in Rust generally, but putting @ and mut everywhere seemed to make things compile.
I'm trying to write a Bitmapped Vector Trie. This means having a bunch of size 32 arrays of pointers. I wanted to be able to express that the array will always be size 32, so I used the [@A * 32] notation in the Level1 type. However, I'm not sure how to make a [@int * 32] when I don't actually care about the values yet.
I wanted it make it a more functional style data structure (with immutability/structure sharing), but that seemed to be making my pointer-lifetime compiler errors worse, so I'm currently (well, attempting) to use a @mut [@A * 32] to hold the data. I think this means that I have a managed array on the local heap containing 32 managed pointers, and that I can change any of the 32 pointers in the array. The current challenge is making an instance of that type, where I don't actually care about the values.
Activity
catamorphism commentedon Mar 20, 2013
"@0" means "allocate a box on the managed heap and write 0 into it", so you can't do that statically; the heap doesn't exist statically. I'm not sure if that's clear or not, but I could maybe say more if I knew more about what you're trying to do...
astrieanna commentedon Mar 20, 2013
I'm fairly confused about pointers in Rust generally, but putting
@andmuteverywhere seemed to make things compile.I'm trying to write a Bitmapped Vector Trie. This means having a bunch of size 32 arrays of pointers. I wanted to be able to express that the array will always be size 32, so I used the
[@A * 32]notation in theLevel1type. However, I'm not sure how to make a[@int * 32]when I don't actually care about the values yet.I wanted it make it a more functional style data structure (with immutability/structure sharing), but that seemed to be making my pointer-lifetime compiler errors worse, so I'm currently (well, attempting) to use a
@mut [@A * 32]to hold the data. I think this means that I have a managed array on the local heap containing 32 managed pointers, and that I can change any of the 32 pointers in the array. The current challenge is making an instance of that type, where I don't actually care about the values.jdm commentedon Mar 20, 2013
I think you want
@mut [@0, ..32].astrieanna commentedon Mar 20, 2013
@jdm Thanks! That fixed it. :)
Auto merge of rust-lang#5448 - Emerentius:update_new_ret_no_self_docs…
Merge pull request rust-lang#5448 from Hamdan-Khan/linux-shims-sig