On 13-02-24 12:06 PM, Ashish Myles wrote:
> On Sun, Feb 24, 2013 at 3:03 PM, Ashish Myles <[email protected]> wrote:
>>
>> Wait a sec...I guess we are barking up the wrong tree.  The problem is
>> not that rust macros don't support $n:integer, but that static array
>> initialization seem to require a raw integer literal (possibly at the
>> parsing level).  One can imagine designing a statically-allocated
>> matrix for size C1 x C2 that would allocate similar to:
>>     const C1 : int = 2;
>>     const C2 : int = 2;
>>     let a : [int * (C1*C2)] = [1,2,3,4];
>> But the code above gives the following error
>>     error: expected integral vector length but found `(`
>>
> 
> To slightly modify this example to be more realistic, I would do
>      let a : [int * (C1*C2)] = [0, ..(C1*C2)];
> so that the initializer expression should also be valid.

Agreed. This has been open for a while:

https://github.com/mozilla/rust/issues/3469

There's some discussion in there about intertwining const eval and
typechecking. I'm still nervous about that, as I was back when I wrote
this comment:

https://github.com/mozilla/rust/issues/2317#issuecomment-5633079

but it seems we're sliding down the slippery slope I'm concerned about.
We'll see how far down it goes. I hope not all the way to C++-ish constexpr.

-Graydon

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to