[rust-dev] "constants may only refer to crate-local constants" Any way to get around this?

Patrick Walton pwalton at mozilla.com
Tue Dec 18 15:32:22 PST 2012


On 12/18/12 3:09 PM, vince.raiken at gmail.com wrote:
> Hi, I'm just poking around a bit with Rust, and I wanted to set a
> const to float::consts::pi, but the rustc compiler (which is the most
> recent as of a few/week or two ago) won't let me. Is there any way to do
> this, or set some kind of global to that value? I didn't see any other
> kind of global I could create when I read through the 0.5 documentation.
> And this isn't documented as far as I could see.

This should be supported, but it's not yet implemented. We will need to 
serialize ASTs to do this in the general case and it's a decent amount 
of work.

Patrick



More information about the Rust-dev mailing list