[rust-dev] String constans
graydon at mozilla.com
Mon Apr 23 12:10:24 PDT 2012
On 12-04-22 05:19 PM, Alexander Stavonin wrote:
> Do you have a plan to adding string constans? Or are you proposing some
> other way for creating string constants?
> string_const.rs:3:18: 3:24 error: string constants are not supported
> string_const.rs:3 <http://string_const.rs:3> const NAME: str = "sting";
This derives from a basic inability to express long-lived pointers to
constants in the current system of memory ownership; we lost that
ability with the last vector-system rewrite and haven't yet regained it.
It's one of the (many) reasons we're making region pointers first class
and introducing slice types (that use region pointers). The new work on
vectors will permit constant strings, slices, and general vectors (and
other things built out of them).
More information about the Rust-dev