Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upGlobal const expr with macro causes compiler panic #29093
Comments
This comment has been minimized.
This comment has been minimized.
|
So, first const X: i32 = match Some(0) { _ => 10 };The compiler panic doesn't require a macro, this will ICE in exactly same way: pub const PACKET_BUFFER_SIZE : usize = match Some(10) {
Some(x) => 1,
None => 1,
};It seems that any binding inside the match will ICE instead of just giving the 'unsupported expression type in const expression' error. |
This comment has been minimized.
This comment has been minimized.
|
@cristicbz BTW, How can I achieve my first intend? |
This comment has been minimized.
This comment has been minimized.
|
The problem is you can't get the value out of an |
This comment has been minimized.
This comment has been minimized.
|
@cristicbz Thank you for your helpful comment :) |
leeopop commentedOct 16, 2015
I would like to have compile-time evaluation of my const values
from the environment variables.
I wonder whether I had some grammar mistakes, however the compiler panics.
This occurs all stable, beta, and nightly versions (from play.rust-lang.org).
I tried this code:
I expected to see this happen:
compiles with environment variables, statically evaluated.
Instead, this happened:
compiler panic.
Meta
http://puu.sh/kM1Yo/036518bf32.png